diff options
author | Rick Frankel <rick@rickster.com> | 2013-05-29 09:53:51 -0400 |
---|---|---|
committer | Rick Frankel <rick@rickster.com> | 2013-05-29 15:23:04 -0400 |
commit | 9d22167c68d6ff7cfedc4b5aa7d538deee515df2 (patch) | |
tree | 5ee7fcf3dd14679acdd46e428bd2bd9754dd916d | |
parent | 60ca9e782b111bb9ade949141aa6cce11a1dde87 (diff) | |
download | org-mode-9d22167c68d6ff7cfedc4b5aa7d538deee515df2.tar.gz |
Refactor fetching html doctype from alist into function so it can be reused in inherited exporters.
* lisp/ox-html.el (org-html-doctype): Add new function `org-html-doctype'.
(org-html-template): Use `org-html-doctype' function instead of inline
code.
* contrib/lisp/ox-deck.el (org-deck-template): Use `org-html-doctype'
function instead of inline code.
* contrib/lisp/ox-s5.el (org-s5-template): Use `org-html-doctype'
function instead of inline code.
-rw-r--r-- | contrib/lisp/ox-deck.el | 6 | ||||
-rw-r--r-- | contrib/lisp/ox-s5.el | 2 | ||||
-rw-r--r-- | lisp/ox-html.el | 14 |
3 files changed, 11 insertions, 11 deletions
diff --git a/contrib/lisp/ox-deck.el b/contrib/lisp/ox-deck.el index c738389..dcb5879 100644 --- a/contrib/lisp/ox-deck.el +++ b/contrib/lisp/ox-deck.el @@ -392,11 +392,7 @@ holding export options." (mapconcat 'identity (list - (let* ((dt (plist-get info :html-doctype)) - (dt-cons (assoc dt org-html-doctype-alist))) - (if dt-cons - (cdr dt-cons) - dt)) + (org-html-doctype info) (let ((lang (plist-get info :language))) (mapconcat (lambda (x) diff --git a/contrib/lisp/ox-s5.el b/contrib/lisp/ox-s5.el index 3ea77b2..24a0506 100644 --- a/contrib/lisp/ox-s5.el +++ b/contrib/lisp/ox-s5.el @@ -306,7 +306,7 @@ holding export options." (mapconcat 'identity (list - (plist-get info :html-doctype) + (org-html-doctype info) (format "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"%s\" xml:lang=\"%s\">" (plist-get info :language) (plist-get info :language)) "<head>" diff --git a/lisp/ox-html.el b/lisp/ox-html.el index f4333e0..297cb55 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -1306,6 +1306,14 @@ CSS classes, then this prefix can be very useful." (concat "<" tag " " attr (if (org-html-xhtml-p info) " />" ">"))) +(defun org-html-doctype (info) + "Return correct html doctype tag from `org-html-doctype-alist', +or the literal value of :html-doctype from INFO if :html-doctype +is not found in the alist. +INFO is a plist used as a communication channel." + (let ((dt (plist-get info :html-doctype))) + (or (cdr (assoc dt org-html-doctype-alist)) dt))) + (defun org-html--make-attribute-string (attributes) "Return a list of attributes, as a string. ATTRIBUTES is a plist where values are either strings or nil. An @@ -1696,11 +1704,7 @@ holding export options." (fboundp 'coding-system-get) (coding-system-get org-html-coding-system 'mime-charset)) "iso-8859-1")))))) - (let* ((dt (plist-get info :html-doctype)) - (dt-cons (assoc dt org-html-doctype-alist))) - (if dt-cons - (cdr dt-cons) - dt)) + (org-html-doctype info) "\n" (concat "<html" (when (org-html-xhtml-p info) |