[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-mime c6a3d73e78 107/118: remove org-mime-default-heade
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/org-mime c6a3d73e78 107/118: remove org-mime-default-header |
Date: |
Wed, 5 Jan 2022 07:58:51 -0500 (EST) |
branch: elpa/org-mime
commit c6a3d73e78b11157ceb49bf5d79c6fd125efe0ac
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>
remove org-mime-default-header
---
org-mime.el | 25 +++++++++++--------------
test/org-mime-tests.el | 38 +++++++++++++++++++++++++-------------
2 files changed, 36 insertions(+), 27 deletions(-)
diff --git a/org-mime.el b/org-mime.el
index bac7e415fb..d36a4a4f0f 100644
--- a/org-mime.el
+++ b/org-mime.el
@@ -129,13 +129,6 @@
:group 'org-mime
:type 'boolean)
-(defcustom org-mime-default-header
- "#+OPTIONS: latex:t toc:nil H:3\n"
- "Default header to control html export options.
-And ensure first line isn't assumed to be a title line."
- :group 'org-mime
- :type 'string)
-
(defcustom org-mime-library 'mml
"Library to use for marking up MIME elements."
:group 'org-mime
@@ -249,16 +242,20 @@ SUBTREEP is t if current node is subtree."
(kill-buffer buf))))
(cons body plain)))
-(defun org-mime-export-string (string &optional opts)
- "Export STRING into html.
-OPTS is export options."
+(defun org-mime-export-string (string &optional options)
+ "Export STRING into html with OPTIONS."
;; Emacs 25+ prefer exporting drawer by default
;; obviously not acceptable in exporting to mail body
(let* ((org-export-with-drawers nil))
+
+ (when org-mime-export-options
+ (setq options org-mime-export-options))
+
;; we won't export title from org file anyway
- (if opts (setq opts (plist-put opts 'title nil)))
+ (if options (setq options (plist-put options 'title nil)))
+
;; emacs24.4+
- (org-export-string-as string 'html t (or org-mime-export-options opts))))
+ (org-export-string-as string 'html t options)))
;; example hook, for setting a dark background in
;; <pre style="background-color: #EEE;"> elements
@@ -490,8 +487,8 @@ If called with an active region only export that region,
otherwise entire body."
;; to hold attachments for inline html images
(opts (org-mime-get-buffer-export-options))
(ascii-charset (org-mime-use-ascii-charset))
- (plain (org-mime-export-ascii-maybe (concat org-mime-default-header
org-text) org-text))
- (html (org-mime-export-string (concat org-mime-default-header
org-text) opts))
+ (plain (org-mime-export-ascii-maybe org-text org-text))
+ (html (org-mime-export-string org-text opts))
(file (make-temp-name (expand-file-name
"mail" temporary-file-directory))))
diff --git a/test/org-mime-tests.el b/test/org-mime-tests.el
index 25f366267a..fb790bf469 100644
--- a/test/org-mime-tests.el
+++ b/test/org-mime-tests.el
@@ -35,22 +35,34 @@
"--\n"
"Some quote\n"))
+(defun run-org-mime-htmlize (&rest mail-body)
+ "Create mail containing MAIL-BODY and run `org-mime-htmlize'."
+ (with-temp-buffer
+ (apply #'insert mail-header)
+ (apply #'insert mail-body)
+ (apply #'insert mail-footer)
+ (message-mode)
+ (goto-char (point-min))
+ (org-mime-htmlize)
+ (buffer-string)))
+
(ert-deftest test-org-mime-htmlize ()
- (let* (str)
- (with-temp-buffer
- (apply #'insert mail-header)
- (insert "* hello\n"
- "** world\n"
- "#+begin_src javascript\n"
- "console.log('hello world');\n"
- "#+end_src\n")
- (apply #'insert mail-footer)
- (message-mode)
- (goto-char (point-min))
- (org-mime-htmlize)
- (setq str (buffer-string)))
+ (let* ((str (run-org-mime-htmlize "* hello\n"
+ "** world\n"
+ "#+begin_src javascript\n"
+ "console.log('hello world');\n"
+ "#+end_src\n")))
(should (string-match "<#multipart" str))))
+(ert-deftest test-org-mime-export-options ()
+ (let* (str)
+ (setq org-mime-export-options '(:with-toc t))
+ (setq str (run-org-mime-htmlize "* hello\n"))
+ (should (string-match "Table of Contents" str))
+ (setq org-mime-export-options '(:with-toc nil))
+ (setq str (run-org-mime-htmlize "* hello\n"))
+ (should (not (string-match "Table of Contents" str)))))
+
(ert-deftest test-org-mime-org-subtree-htmlize ()
(let* (str opts)
(with-temp-buffer
- [nongnu] elpa/org-mime f8eac8ccde 066/118: restore plain text mail, (continued)
- [nongnu] elpa/org-mime f8eac8ccde 066/118: restore plain text mail, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 95c33ec353 067/118: add screenshot, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 562cb5a3f0 074/118: Use compose-mail, rather than explicitly using message-mail, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 7475a592c2 081/118: drop emacs 24 support, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime e81651d848 084/118: clean code, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 9bb6351b25 085/118: un-bundled htmlize.el, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 2581fc2dd9 091/118: org-mime-confirm-when-no-multipart function + docs, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 8ad1218456 095/118: Combine two insert calls, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 2cbd5de7bd 100/118: general export options should always override buffer options, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime ecbc66f16a 106/118: fixed typo, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime c6a3d73e78 107/118: remove org-mime-default-header,
ELPA Syncer <=
- [nongnu] elpa/org-mime 04e6ce9db6 108/118: try fixing ci again, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime eb21c02ba8 109/118: fixed org subtree htmlize, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 21692f16ce 110/118: use buffer properties, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 59bf130c76 113/118: secure tag should be at the beginning of email body, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime df99e631c5 031/118: quoted mail use modern UI style, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime e5e4c59022 103/118: fixed some typo, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 3b119a22be 112/118: handle file url on Windows elegantly, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime f7a45f5573 115/118: Upgrade test file to GPLv3, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime 77c3f07ce4 046/118: documentation, ELPA Syncer, 2022/01/05
- [nongnu] elpa/org-mime e5c68b1c66 044/118: minor changes to docstrings for readability and style changes., ELPA Syncer, 2022/01/05