From 8855c23c68c96768605fbcc75972a74bb94d59e9 Mon Sep 17 00:00:00 2001 From: Rasmus Date: Mon, 13 Feb 2017 17:52:38 +0100 Subject: [PATCH] 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. --- lisp/ox-html.el | 65 ++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 36 deletions(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index ef8c9b546..bb29d4a35 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2557,21 +2557,22 @@ holding contextual information." (cdr ids) ""))) (if (org-export-low-level-p headline info) ;; This is a deep sub-tree: export it as a list item. - (let* ((type (if numberedp 'ordered 'unordered)) - (itemized-body - (org-html-format-list-item - contents type nil info nil + (let* ((html-type (if numberedp "ol" "ul"))) + (concat + (and (org-export-first-sibling-p headline info) + (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) extra-ids - full-text)))) - (concat (and (org-export-first-sibling-p headline info) - (org-html-begin-plain-list type)) - itemized-body - (and (org-export-last-sibling-p headline info) - (org-html-end-plain-list type)))) + full-text)) + (and (org-export-last-sibling-p headline info) + (format "" html-type)))) + ;; Standard headline. Export it as a section. (let ((extra-class (org-element-property :HTML_CONTAINER_CLASS headline)) (first-content (car (org-element-contents headline)))) - ;; Standard headline. Export it as a section. (format "<%s id=\"%s\" class=\"%s\">%s%s\n" (org-html--container headline info) (concat "outline-container-" @@ -3138,34 +3139,26 @@ the plist used as a communication channel." ;;;; Plain List -;; FIXME Maybe arg1 is not needed because
  • already sets -;; 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 "
      " - (if arg1 (format " start=\"%d\"" arg1) ""))) - (`unordered "
        ") - (`descriptive "
        "))) - -(defun org-html-end-plain-list (type) - "Insert the end of the HTML list depending on TYPE." - (pcase type - (`ordered "
    ") - (`unordered "") - (`descriptive ""))) - -(defun org-html-plain-list (plain-list contents _info) +(defun org-html-plain-list (plain-list contents info) "Transcode a PLAIN-LIST element from Org to HTML. CONTENTS is the contents of the list. INFO is a plist holding contextual information." - (let ((type (org-element-property :type plain-list))) - (format "%s\n%s%s" - (org-html-begin-plain-list type) - contents (org-html-end-plain-list type)))) + (let* ((type (org-element-property :type plain-list)) + (html-type (plist-get '(ordered "ol" unordered "ul" descriptive "dl") + 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 "" html-type)))) ;;;; Plain Text