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'.
This commit is contained in:
Rick Frankel 2013-12-03 14:37:30 -05:00
parent 36a21d9372
commit 2c782da801
1 changed files with 42 additions and 7 deletions

View File

@ -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>[&#xa0;]</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>[&#xa0;]</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