From 2621fe04619c7ca446b1c2d6821907c8f332972e Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 4 Jan 2011 22:10:25 +0100 Subject: [PATCH] Do not remove empty list items in HTML and DocBook export --- lisp/org-docbook.el | 10 +--------- lisp/org-html.el | 14 +++++++------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el index ac3d7f103..740a68cb0 100644 --- a/lisp/org-docbook.el +++ b/lisp/org-docbook.el @@ -1041,20 +1041,12 @@ publishing directory." (if (eq major-mode (default-value 'major-mode)) (nxml-mode))) - ;; Remove empty paragraphs and lists. Replace them with a - ;; newline. + ;; Remove empty paragraphs. Replace them with a newline. (goto-char (point-min)) (while (re-search-forward "[ \r\n\t]*\\(\\)[ \r\n\t]*[ \r\n\t]*" nil t) (when (not (get-text-property (match-beginning 1) 'org-protected)) (replace-match "\n") - ;; Avoid empty caused by inline tasks. - ;; We should add an empty para to make everything valid. - (when (and (looking-at "") - (save-excursion - (backward-char (length "\n")) - (looking-at ""))) - (insert "")) (backward-char 1))) ;; Fill empty sections with . This is to make sure ;; that the DocBook document generated is valid and well-formed. diff --git a/lisp/org-html.el b/lisp/org-html.el index 7ed3f2ada..a7199e26b 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1719,16 +1719,16 @@ lang=\"%s\" xml:lang=\"%s\"> (goto-char (match-end 0)) (insert "\n"))) (insert "
\n") - (mapc 'insert thetoc) - (insert "
\n")) - ;; remove empty paragraphs and lists + (let ((beg (point))) + (mapc 'insert thetoc) + (insert "\n") + (while (re-search-backward "
  • [ \r\n\t]*
  • \n?" beg t) + (replace-match "")))) + ;; remove empty paragraphs (goto-char (point-min)) (while (re-search-forward "

    [ \r\n\t]*

    " nil t) (replace-match "")) (goto-char (point-min)) - (while (re-search-forward "
  • [ \r\n\t]*
  • \n?" nil t) - (replace-match "")) - (goto-char (point-min)) ;; Convert whitespace place holders (goto-char (point-min)) (let (beg end n) @@ -2440,7 +2440,7 @@ the alist of previous items." (let* ((counter (match-string 2 line)) (checkbox (match-string 3 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)) (firstp (= list-beg pos)) ;; Always refer to first item to determine list type, in