Browse Source

Do not remove empty list items in HTML and DocBook export

Nicolas Goaziou 14 years ago
parent
commit
2621fe0461
2 changed files with 8 additions and 16 deletions
  1. 1 9
      lisp/org-docbook.el
  2. 7 7
      lisp/org-html.el

+ 1 - 9
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]*\\(<para>\\)[ \r\n\t]*</para>[ \r\n\t]*" nil t)
 	(when (not (get-text-property (match-beginning 1) 'org-protected))
 	  (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)))
       ;; Fill empty sections with <para></para>.  This is to make sure
       ;; that the DocBook document generated is valid and well-formed.

+ 7 - 7
lisp/org-html.el

@@ -1719,16 +1719,16 @@ lang=\"%s\" xml:lang=\"%s\">
 	    (goto-char (match-end 0))
 	    (insert "\n")))
 	(insert "<div id=\"table-of-contents\">\n")
-	(mapc 'insert thetoc)
-	(insert "</div>\n"))
-      ;; remove empty paragraphs and lists
+	(let ((beg (point)))
+	  (mapc 'insert thetoc)
+	  (insert "</div>\n")
+	  (while (re-search-backward "<li>[ \r\n\t]*</li>\n?" beg t)
+	    (replace-match ""))))
+      ;; remove empty paragraphs
       (goto-char (point-min))
       (while (re-search-forward "<p>[ \r\n\t]*</p>" nil t)
 	(replace-match ""))
       (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
       (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