diff options
author | Rick Frankel <rick@rickster.com> | 2013-12-03 14:37:30 -0500 |
---|---|---|
committer | Rick Frankel <rick@rickster.com> | 2014-01-09 18:04:09 -0500 |
commit | 2c782da8019de4eded3b5686fcfffa51abda1585 (patch) | |
tree | 23677a6abe88da219cc01f454631f2234e43c19a | |
parent | 36a21d9372727f4ce0627282a75246ddf172fbf8 (diff) | |
download | org-mode-2c782da8019de4eded3b5686fcfffa51abda1585.tar.gz |
Add customization options for html checkboxes.
(org-html-checkbox-types): New constant. Contains unicode, ascii and html
checkbox alists.
(org_html_checkbox_type): New customzation variable can be set to one
of the above choices. Defaults to "ascii"
(org-html-checkbox): Use the appropriate set of checkboxes as
specified in `org-html-checkbox-type'.
-rw-r--r-- | lisp/ox-html.el | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/lisp/ox-html.el b/lisp/ox-html.el index db23f95..61defc9 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -975,6 +975,39 @@ org-info.js for your website." (list :tag "Postamble" (const :format "" postamble) (string :tag " id") (string :tag "element")))) +(defconst org-html-checkbox-types + '((unicode . + ((on . "☑") (off . "☐") (trans . "☐"))) + (ascii . + ((on . "<code>[X]</code>") + (off . "<code>[ ]</code>") + (trans . "<code>[-]</code>"))) + (html . + ((on . "<input type='checkbox' checked='checked' />") + (off . "<input type='checkbox' />") + (trans . "<input type='checkbox' />")))) + "Alist of checkbox types. +The cdr of each entry is an alist list three checkbox types for +html export: \"on\", \"off\" and \"trans\". + +The choices are: + - unicode characters (html entities) + - ascii characters + - html checkboxes +Note that only the ascii characters implement tri-state +checkboxes. The other two use the \"off\" checkbox for \"trans\".") + +(defcustom org-html-checkbox-type "ascii" + "The type of checkboxes to use for html export. See +`org-html-checkbox-types' for for the values used for each option." + :group 'org-export-html + :version "24.4" + :package-version '(Org . "8.0") + :type '(choice + (const :tag "ASCII characters" "ascii") + (const :tag "Unicode characters" "unicode") + (const :tag "HTML checkboxes" "html"))) + (defcustom org-html-metadata-timestamp-format "%Y-%m-%d %a %H:%M" "Format used for timestamps in preamble, postamble and metadata. See `format-time-string' for more information on its components." @@ -2417,18 +2450,20 @@ contextual information." ;;;; Item -(defun org-html-checkbox (checkbox) - "Format CHECKBOX into HTML." - (case checkbox (on "<code>[X]</code>") - (off "<code>[ ]</code>") - (trans "<code>[-]</code>") - (t ""))) +(defun org-html-checkbox (checkbox info) + "Format CHECKBOX into HTML. INFO is a plist holding contextual +information. +See `org-html-checkbox-type' for customization options." + (cdr (assoc checkbox + (cdr (assoc (intern org-html-checkbox-type) + org-html-checkbox-types))))) (defun org-html-format-list-item (contents type checkbox info &optional term-counter-id headline) "Format a list item into HTML." - (let ((checkbox (concat (org-html-checkbox checkbox) (and checkbox " "))) + (let ((checkbox (concat (org-html-checkbox checkbox info) + (and checkbox " "))) (br (org-html-close-tag "br" nil info))) (concat (case type |