emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Patch to fix two bugs in HTML/DocBook exporters
@ 2009-04-06 21:37 Baoqiu Cui
  2009-04-08 15:16 ` Carsten Dominik
  0 siblings, 1 reply; 10+ messages in thread
From: Baoqiu Cui @ 2009-04-06 21:37 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1501 bytes --]

Hi Carsten,

During the weekend, I found and fixed two bugs that exist in
HTML/DocBook exporters (see the following descriptions).  I am attaching
a patch for the fixes at the end of this email.

1. Bug One: two consecutive lists with different list types at the same
   level are exported as *one* list.  For example, the following two
   lists

   1. Ordered List Item 1
   2. Ordered List Item 2

   - Itemized List Item 1
   - Itemized List Item 2
   - Itemized List Item 3

   are exported as one ordered list in HTML (see below, similar problem
   also exist in DocBook).

   : <ol>
   : <li>
   : Ordered List Item 1
   : </li>
   : <li>
   : Ordered List Item 2
   : 
   : </li>
   : <li>
   : Itemized List Item 1
   : </li>
   : <li>
   : Itemized List Item 2
   : </li>
   : <li>
   : Itemized List Item 3
   : 
   : </li>
   : </ol>

2. Bug Two: a paragraph *immediately* after a block like quote, verse,
   centered block, example, etc. is not wrapped into paragraph tags
   (<p>...</p> in HTML or <para>...</para> in DocBook).  While it is not
   a big deal for HTML exporter, this bug makes exported DocBook XML
   document invalid.

   The following lines can reproduce this bug:

   : Code line one
   : Code line two
   This is a paragraph immediately after the above code block without an
   empty line before it, and it is NOT wrapped in a paragraph (<p> in
   HTML or <para> in DocBook) in exported format.

Please let me know if you see any problems in the fix.

Thanks,
Baoqiu


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: consecutive-lists.diff --]
[-- Type: text/x-patch, Size: 3782 bytes --]

diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el
index 3739181..0b87ada 100644
--- a/lisp/org-docbook.el
+++ b/lisp/org-docbook.el
@@ -606,6 +606,7 @@ publishing directory."
 	  ;; End of quote section?
 	  (when (and inquote (string-match "^\\*+ " line))
 	    (insert "]]>\n</programlisting>\n")
+	    (org-export-docbook-open-para)
 	    (setq inquote nil))
 	  ;; Inside a quote section?
 	  (when inquote
@@ -624,7 +625,8 @@ publishing directory."
 		      (not (string-match "^[ \t]*\\(:.*\\)"
 					 (car lines))))
 	      (setq infixed nil)
-	      (insert "]]>\n</programlisting>\n"))
+	      (insert "]]>\n</programlisting>\n")
+	      (org-export-docbook-open-para))
 	    (throw 'nextline nil))
 
 	  ;; Protected HTML
@@ -681,12 +683,14 @@ publishing directory."
 	  (when (equal "ORG-BLOCKQUOTE-END" line)
 	    (org-export-docbook-close-para-maybe)
 	    (insert "</blockquote>\n")
+	    (org-export-docbook-open-para)
 	    (throw 'nextline nil))
 
 	  ;; End of verses
 	  (when (equal "ORG-VERSE-END" line)
 	    (insert "</literallayout>\n</blockquote>\n")
 	    (setq inverse nil)
+	    (org-export-docbook-open-para)
 	    (throw 'nextline nil))
 
 	  ;; Text centering.  Element <para role="centered"> does not
@@ -704,6 +708,7 @@ publishing directory."
 	    (org-export-docbook-close-para-maybe)
 	    (insert "</entry></row></tbody>\n"
 		    "</tgroup>\n</informaltable>\n")
+	    (org-export-docbook-open-para)
 	    (throw 'nextline nil))
 
 	  ;; Make targets to anchors.  Note that currently FOP does not
@@ -969,7 +974,9 @@ publishing directory."
 	      (setq didclose nil)
 	      (while (and in-local-list
 			  (or (and (= ind (car local-list-indent))
-				   (not starter))
+				   (or (not starter)
+				       (not (equal item-type
+						   (car local-list-type)))))
 			      (< ind (car local-list-indent))))
 		(setq didclose t)
 		(let ((listtype (car local-list-type)))
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index df5c6a5..a8a3dfc 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -3687,6 +3687,7 @@ lang=\"%s\" xml:lang=\"%s\">
 	  ;; end of quote section?
 	  (when (and inquote (string-match "^\\*+ " line))
 	    (insert "</pre>\n")
+	    (org-open-par)
 	    (setq inquote nil))
 	  ;; inside a quote section?
 	  (when inquote
@@ -3706,7 +3707,8 @@ lang=\"%s\" xml:lang=\"%s\">
 		      (not (string-match "^[ \t]*:\\(\\([ \t]\\|$\\)\\(.*\\)\\)"
 					 (car lines))))
 	      (setq infixed nil)
-	      (insert "</pre>\n"))
+	      (insert "</pre>\n")
+	      (org-open-par))
 	    (throw 'nextline nil))
 
 	  ;; Protected HTML
@@ -3740,6 +3742,7 @@ lang=\"%s\" xml:lang=\"%s\">
 	  (when (equal "ORG-BLOCKQUOTE-END" line)
 	    (org-close-par-maybe)
 	    (insert "\n</blockquote>\n")
+	    (org-open-par)
 	    (throw 'nextline nil))
 	  (when (equal "ORG-VERSE-START" line)
 	    (org-close-par-maybe)
@@ -3749,6 +3752,7 @@ lang=\"%s\" xml:lang=\"%s\">
 	  (when (equal "ORG-VERSE-END" line)
 	    (insert "</p>\n")
 	    (setq inverse nil)
+	    (org-open-par)
 	    (throw 'nextline nil))
 	  (when (equal "ORG-CENTER-START" line)
 	    (org-close-par-maybe)
@@ -3758,6 +3762,7 @@ lang=\"%s\" xml:lang=\"%s\">
 	  (when (equal "ORG-CENTER-END" line)
 	    (org-close-par-maybe)
 	    (insert "\n</div>")
+	    (org-open-par)
 	    (throw 'nextline nil))
 	  (when inverse
 	    (let ((i (org-get-string-indentation line)))
@@ -4066,7 +4071,9 @@ lang=\"%s\" xml:lang=\"%s\">
 	      (setq didclose nil)
 	      (while (and in-local-list
 			  (or (and (= ind (car local-list-indent))
-				   (not starter))
+				   (or (not starter)
+				       (not (equal item-type
+						   (car local-list-type)))))
 			      (< ind (car local-list-indent))))
 		(setq didclose t)
 		(org-close-li (car local-list-type))

[-- Attachment #3: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-04-11  6:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-06 21:37 Patch to fix two bugs in HTML/DocBook exporters Baoqiu Cui
2009-04-08 15:16 ` Carsten Dominik
2009-04-09  5:27   ` Baoqiu Cui
2009-04-09  7:25     ` Leo
2009-04-09  8:06       ` Baoqiu Cui
2009-04-09 10:33     ` Carsten Dominik
2009-04-09 18:29       ` Baoqiu Cui
2009-04-11  6:19         ` Carsten Dominik
2009-04-09 21:03       ` Mike Newman
2009-04-11  6:20         ` Carsten Dominik

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).