mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-21 18:18:43 +00:00
Do not remove empty list items in HTML and DocBook export
This commit is contained in:
parent
c32e39786d
commit
2621fe0461
|
@ -1041,20 +1041,12 @@ publishing directory."
|
||||||
(if (eq major-mode (default-value 'major-mode))
|
(if (eq major-mode (default-value 'major-mode))
|
||||||
(nxml-mode)))
|
(nxml-mode)))
|
||||||
|
|
||||||
;; Remove empty paragraphs and lists. Replace them with a
|
;; Remove empty paragraphs. Replace them with a newline.
|
||||||
;; newline.
|
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (re-search-forward
|
(while (re-search-forward
|
||||||
"[ \r\n\t]*\\(<para>\\)[ \r\n\t]*</para>[ \r\n\t]*" nil t)
|
"[ \r\n\t]*\\(<para>\\)[ \r\n\t]*</para>[ \r\n\t]*" nil t)
|
||||||
(when (not (get-text-property (match-beginning 1) 'org-protected))
|
(when (not (get-text-property (match-beginning 1) 'org-protected))
|
||||||
(replace-match "\n")
|
(replace-match "\n")
|
||||||
;; Avoid empty <listitem></listitem> caused by inline tasks.
|
|
||||||
;; We should add an empty para to make everything valid.
|
|
||||||
(when (and (looking-at "</listitem>")
|
|
||||||
(save-excursion
|
|
||||||
(backward-char (length "<listitem>\n"))
|
|
||||||
(looking-at "<listitem>")))
|
|
||||||
(insert "<para></para>"))
|
|
||||||
(backward-char 1)))
|
(backward-char 1)))
|
||||||
;; Fill empty sections with <para></para>. This is to make sure
|
;; Fill empty sections with <para></para>. This is to make sure
|
||||||
;; that the DocBook document generated is valid and well-formed.
|
;; that the DocBook document generated is valid and well-formed.
|
||||||
|
|
|
@ -1719,16 +1719,16 @@ lang=\"%s\" xml:lang=\"%s\">
|
||||||
(goto-char (match-end 0))
|
(goto-char (match-end 0))
|
||||||
(insert "\n")))
|
(insert "\n")))
|
||||||
(insert "<div id=\"table-of-contents\">\n")
|
(insert "<div id=\"table-of-contents\">\n")
|
||||||
(mapc 'insert thetoc)
|
(let ((beg (point)))
|
||||||
(insert "</div>\n"))
|
(mapc 'insert thetoc)
|
||||||
;; remove empty paragraphs and lists
|
(insert "</div>\n")
|
||||||
|
(while (re-search-backward "<li>[ \r\n\t]*</li>\n?" beg t)
|
||||||
|
(replace-match ""))))
|
||||||
|
;; remove empty paragraphs
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (re-search-forward "<p>[ \r\n\t]*</p>" nil t)
|
(while (re-search-forward "<p>[ \r\n\t]*</p>" nil t)
|
||||||
(replace-match ""))
|
(replace-match ""))
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (re-search-forward "<li>[ \r\n\t]*</li>\n?" nil t)
|
|
||||||
(replace-match ""))
|
|
||||||
(goto-char (point-min))
|
|
||||||
;; Convert whitespace place holders
|
;; Convert whitespace place holders
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(let (beg end n)
|
(let (beg end n)
|
||||||
|
@ -2440,7 +2440,7 @@ the alist of previous items."
|
||||||
(let* ((counter (match-string 2 line))
|
(let* ((counter (match-string 2 line))
|
||||||
(checkbox (match-string 3 line))
|
(checkbox (match-string 3 line))
|
||||||
(desc-tag (or (match-string 4 line) "???"))
|
(desc-tag (or (match-string 4 line) "???"))
|
||||||
(body (match-string 5 line))
|
(body (or (match-string 5 line) ""))
|
||||||
(list-beg (org-list-get-list-begin pos struct prevs))
|
(list-beg (org-list-get-list-begin pos struct prevs))
|
||||||
(firstp (= list-beg pos))
|
(firstp (= list-beg pos))
|
||||||
;; Always refer to first item to determine list type, in
|
;; Always refer to first item to determine list type, in
|
||||||
|
|
Loading…
Reference in a new issue