[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-mime 778f818ad3 078/118: Add ASCII text/plain export t
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/org-mime 778f818ad3 078/118: Add ASCII text/plain export test |
Date: |
Wed, 5 Jan 2022 07:58:48 -0500 (EST) |
branch: elpa/org-mime
commit 778f818ad3d101f27786556c2a7a9995d5da47c6
Author: konezny <konezny@users.noreply.github.com>
Commit: konezny <konezny@users.noreply.github.com>
Add ASCII text/plain export test
The ASCII export test checks for org-mode markup for the default case,
where the export variable is nil or not valid, and checks for absent
org-mode markup for the three valid plain text exports. The ASCII export
test does not attempt to verify the exported coding type.
---
org-mime.el | 18 +++++++++---------
test/org-mime-tests.el | 41 ++++++++++++++++++++++++++++++++++++++++-
2 files changed, 49 insertions(+), 10 deletions(-)
diff --git a/org-mime.el b/org-mime.el
index c6dc1de437..9c21ddffd4 100644
--- a/org-mime.el
+++ b/org-mime.el
@@ -204,14 +204,14 @@ buffer holding the text to be exported.")
"Similar to `org-html-export-as-html' and `org-org-export-as-org'.
SUBTREEP is t if current node is subtree."
(let* (
- (plain
- (cl-case org-mime-export-ascii
- (ascii (org-export-string-as (buffer-string) 'ascii nil
'(:ascii-charset ascii)))
- (latin1 (org-export-string-as (buffer-string) 'ascii nil
'(:ascii-charset latin1)))
- (utf-8 (org-export-string-as (buffer-string) 'ascii nil
'(:ascii-charset utf-8)))
- (t (buffer-string)) ;; default is the original org file
- )
- )
+ (plain (cl-case org-mime-export-ascii
+ (ascii (org-export-string-as (buffer-string)
+ 'ascii nil '(:ascii-charset ascii)))
+ (latin1 (org-export-string-as (buffer-string)
+ 'ascii nil '(:ascii-charset latin1)))
+ (utf-8 (org-export-string-as (buffer-string)
+ 'ascii nil '(:ascii-charset utf-8)))
+ (t (buffer-string)))) ;; original org file
(buf (org-export-to-buffer 'html "*Org Mime Export*"
nil subtreep nil (org-mime-get-export-options subtreep)))
(body (prog1
@@ -307,7 +307,7 @@ If html portion of message includes IMAGES they are wrapped
in multipart/related
(mml (concat "<#multipart type=alternative>\n<#part type=text/plain>\n"
plain
(when images "<#multipart type=related>")
- "<#part type=text/html>"
+ "<#part type=text/html>\n"
(if org-mime-beautify-quoted-mail
(org-mime-beautify-quoted html)
html)
diff --git a/test/org-mime-tests.el b/test/org-mime-tests.el
index dea0846277..9bac50c04e 100644
--- a/test/org-mime-tests.el
+++ b/test/org-mime-tests.el
@@ -114,4 +114,43 @@
(should (string= (car h) "Cc"))
(should (string= (cdr h) cc))))
-(ert-run-tests-batch-and-exit)
\ No newline at end of file
+;;; The ASCII export test checks for org-mode markup for the default case,
where
+;;; the export variable is nil or not valid, and checks for absent org-mode
+;;; markup for the three valid plain text exports. The ASCII export test does
+;;; not attempt to verify the exported coding type.
+
+(ert-deftest test-org-mime-org-buffer-htmlize-ascii-plain-text ()
+ (let* (str opts)
+ (setq orgBuf (generate-new-buffer "*org-mode-test-buf*"))
+ (with-current-buffer orgBuf
+ (insert "#+OPTIONS: toc:nil num:nil\n"
+ "\n#+begin_example\n"
+ "$ echo nothing to see here\n"
+ "#+end_example\n")
+ (org-mode)
+ (goto-char (point-min))
+ (setq opts (org-mime-get-export-options t))
+ (should opts)
+ ;; default: org-mode file
+ (mapcar (lambda (backend)
+ (setq org-mime-export-ascii backend)
+ (switch-to-buffer orgBuf)
+ (org-mime-org-buffer-htmlize)
+ (switch-to-buffer (car (message-buffers)))
+ (setq str (buffer-string))
+ (should (string-match "<#multipart" str))
+ (should (string-match "#\\+begin_example" str)))
+ '(nil bogus))
+ ;; 'ascii, 'latin1, and 'utf-8 exports
+ (mapcar (lambda (backend)
+ (setq org-mime-export-ascii backend)
+ (switch-to-buffer orgBuf)
+ (org-mime-org-buffer-htmlize)
+ (switch-to-buffer (car (message-buffers)))
+ (setq str (buffer-string))
+ (should (string-match "<#multipart" str))
+ (should-not (string-match "#\\+begin_example" str)))
+ '(ascii latin1 utf-8)))
+ (kill-buffer orgBuf)))
+
+(ert-run-tests-batch-and-exit)
- [nongnu] elpa/org-mime 0a0aa9b110 034/118: README, (continued)
- [nongnu] elpa/org-mime 0a0aa9b110 034/118: README, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime ad30f199cb 036/118: provide org-mime-find-html-start callback, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 5f253f541c 037/118: only use export header when creating html, keep out of email, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime c6e2b95664 047/118: clean code, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 64a3f56651 041/118: (setq org-html-with-latex nil) sometimes useful #16, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 10098b001c 049/118: Fix file attachments and equations and enhance emails from org-files, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 1e792ef061 059/118: Merge pull request #28 from titaniumbones/fix-klipse-error, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime f610861858 063/118: htmlize current subtree, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 9506727ca7 072/118: README, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime b189976217 076/118: fixed CI, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 778f818ad3 078/118: Add ASCII text/plain export test,
ELPA Syncer <=
- [nongnu] elpa/org-mime 9f84446038 082/118: make emacs 25 test pass, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 484bf3b0b8 083/118: can edit mail-body in org-mode buffer directly, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 5980ccaace 080/118: fixed unit test, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime b129579986 087/118: Regexp search for sig sep, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 30bb3e663d 117/118: Merge pull request #66 from skangas/gplv3, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 4105d1bb9c 004/118: support Emacs 23.4, 24.3 24.4, 24.5, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime e9b0be2860 005/118: mails need NO TOC, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 3a16180195 006/118: clean code according to org-mode review, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 351b233a7e 018/118: Don't use obsoleted function, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 44e7a78ffd 019/118: Fix for cl-lib, ELPA Syncer, 2022/01/05