ox-html: Plain list supports arbitrary attributes
* lisp/ox-html.el (org-html-begin-plain-list): (org-html-end-plain-list): Remove. (org-html-plain-list): (org-html-headline): Remove dependency on org-html-begin-plain-list and org-html-end-plain-list.
This commit is contained in:
parent
add0be3093
commit
8855c23c68
|
@ -2557,21 +2557,22 @@ holding contextual information."
|
||||||
(cdr ids) "")))
|
(cdr ids) "")))
|
||||||
(if (org-export-low-level-p headline info)
|
(if (org-export-low-level-p headline info)
|
||||||
;; This is a deep sub-tree: export it as a list item.
|
;; This is a deep sub-tree: export it as a list item.
|
||||||
(let* ((type (if numberedp 'ordered 'unordered))
|
(let* ((html-type (if numberedp "ol" "ul")))
|
||||||
(itemized-body
|
(concat
|
||||||
(org-html-format-list-item
|
(and (org-export-first-sibling-p headline info)
|
||||||
contents type nil info nil
|
(apply 'format "<%s class=\"org-%s\">"
|
||||||
|
(make-list 2 html-type)))
|
||||||
|
(org-html-format-list-item
|
||||||
|
contents (if numberedp 'ordered 'unordered)
|
||||||
|
nil info nil
|
||||||
(concat (org-html--anchor preferred-id nil nil info)
|
(concat (org-html--anchor preferred-id nil nil info)
|
||||||
extra-ids
|
extra-ids
|
||||||
full-text))))
|
full-text))
|
||||||
(concat (and (org-export-first-sibling-p headline info)
|
(and (org-export-last-sibling-p headline info)
|
||||||
(org-html-begin-plain-list type))
|
(format "</%s>" html-type))))
|
||||||
itemized-body
|
;; Standard headline. Export it as a section.
|
||||||
(and (org-export-last-sibling-p headline info)
|
|
||||||
(org-html-end-plain-list type))))
|
|
||||||
(let ((extra-class (org-element-property :HTML_CONTAINER_CLASS headline))
|
(let ((extra-class (org-element-property :HTML_CONTAINER_CLASS headline))
|
||||||
(first-content (car (org-element-contents headline))))
|
(first-content (car (org-element-contents headline))))
|
||||||
;; Standard headline. Export it as a section.
|
|
||||||
(format "<%s id=\"%s\" class=\"%s\">%s%s</%s>\n"
|
(format "<%s id=\"%s\" class=\"%s\">%s%s</%s>\n"
|
||||||
(org-html--container headline info)
|
(org-html--container headline info)
|
||||||
(concat "outline-container-"
|
(concat "outline-container-"
|
||||||
|
@ -3138,34 +3139,26 @@ the plist used as a communication channel."
|
||||||
|
|
||||||
;;;; Plain List
|
;;;; Plain List
|
||||||
|
|
||||||
;; FIXME Maybe arg1 is not needed because <li value="20"> already sets
|
(defun org-html-plain-list (plain-list contents info)
|
||||||
;; the correct value for the item counter
|
|
||||||
(defun org-html-begin-plain-list (type &optional arg1)
|
|
||||||
"Insert the beginning of the HTML list depending on TYPE.
|
|
||||||
When ARG1 is a string, use it as the start parameter for ordered
|
|
||||||
lists."
|
|
||||||
(pcase type
|
|
||||||
(`ordered
|
|
||||||
(format "<ol class=\"org-ol\"%s>"
|
|
||||||
(if arg1 (format " start=\"%d\"" arg1) "")))
|
|
||||||
(`unordered "<ul class=\"org-ul\">")
|
|
||||||
(`descriptive "<dl class=\"org-dl\">")))
|
|
||||||
|
|
||||||
(defun org-html-end-plain-list (type)
|
|
||||||
"Insert the end of the HTML list depending on TYPE."
|
|
||||||
(pcase type
|
|
||||||
(`ordered "</ol>")
|
|
||||||
(`unordered "</ul>")
|
|
||||||
(`descriptive "</dl>")))
|
|
||||||
|
|
||||||
(defun org-html-plain-list (plain-list contents _info)
|
|
||||||
"Transcode a PLAIN-LIST element from Org to HTML.
|
"Transcode a PLAIN-LIST element from Org to HTML.
|
||||||
CONTENTS is the contents of the list. INFO is a plist holding
|
CONTENTS is the contents of the list. INFO is a plist holding
|
||||||
contextual information."
|
contextual information."
|
||||||
(let ((type (org-element-property :type plain-list)))
|
(let* ((type (org-element-property :type plain-list))
|
||||||
(format "%s\n%s%s"
|
(html-type (plist-get '(ordered "ol" unordered "ul" descriptive "dl")
|
||||||
(org-html-begin-plain-list type)
|
type))
|
||||||
contents (org-html-end-plain-list type))))
|
(html-class (format "org-%s" html-type))
|
||||||
|
(attributes (org-export-read-attribute :attr_html plain-list)))
|
||||||
|
(concat
|
||||||
|
(format "<%s %s>\n"
|
||||||
|
html-type
|
||||||
|
(org-html--make-attribute-string
|
||||||
|
(plist-put attributes :class
|
||||||
|
(org-trim
|
||||||
|
(mapconcat #'identity
|
||||||
|
(list html-class (plist-get attributes :class))
|
||||||
|
" ")))))
|
||||||
|
contents
|
||||||
|
(format "</%s>" html-type))))
|
||||||
|
|
||||||
;;;; Plain Text
|
;;;; Plain Text
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue