ox-html: Better criterion for first paragraphs in lists

* lisp/ox-html.el (org-html-paragraph): Do not wrap first paragraph in
  an item within <p> tags in the most simple cases.

Thanks to Daniel Clemente for suggesting it.
http://permalink.gmane.org/gmane.emacs.orgmode/89413
This commit is contained in:
Nicolas Goaziou 2014-08-26 09:51:20 +02:00
parent b3ef4b9ea8
commit 9a34a13c07
1 changed files with 6 additions and 13 deletions

View File

@ -2896,19 +2896,12 @@ the plist used as a communication channel."
(org-export-read-attribute :attr_html paragraph)))
(extra (or (cadr (assoc parent-type style)) "")))
(cond
((and (eq (org-element-type parent) 'item)
(= (org-element-property :begin paragraph)
(org-element-property :contents-begin parent))
(not (org-element-map (org-export-get-parent parent) 'item
(lambda (item)
(let ((contents (org-element-contents item)))
(and contents
(or (cdr contents)
(not (eq (org-element-type (car contents))
'paragraph))))))
info 'first-match 'item)))
;; Leading paragraph in a list item have no tags if every
;; element of the containing list is only a single paragraph.
((and (not (org-export-get-previous-element paragraph info))
(let ((followers (org-export-get-next-element paragraph info 2)))
(and (not (cdr followers))
(memq (org-element-type (car followers)) '(nil plain-list)))))
;; First paragraph in an item has no tag if it is alone or
;; followed, at most, by a sub-list.
contents)
((org-html-standalone-image-p paragraph info)
;; Standalone image.