* [PATCH] Fix a DocBook/HTML exporter bug for literal examples
@ 2009-06-14 10:56 Baoqiu Cui
2009-06-14 16:05 ` Carsten Dominik
0 siblings, 1 reply; 2+ messages in thread
From: Baoqiu Cui @ 2009-06-14 10:56 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1208 bytes --]
Carsten,
Recent changes to respect example indentations introduced a bug in both
DocBook and HTML exporters. The following example
------------------------------------------------------------------------
#+BEGIN_EXAMPLE
Group of lines separated by empty lines:
Line One.
Line Two.
Line Three.
Line Four.
Line Five.
#+END_EXAMPLE
------------------------------------------------------------------------
is exported to HTML like the following (note that every empty line in
the above example is repeated 3 times):
------------------------------------------------------------------------
<pre class="example">
Lines...
Line One.
Line Two.
Line Three.
Line Four.
Line Five.
</pre>
------------------------------------------------------------------------
and to DocBook format like this (empty lines are removed):
------------------------------------------------------------------------
<programlisting><![CDATA[Group of lines separated by empty lines:
Line One.
Line Two.
Line Three.
Line Four.
Line Five.
]]>
</programlisting>
------------------------------------------------------------------------
Attached please find a patch to fix this problem.
Thanks,
Baoqiu
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: example-indent.diff --]
[-- Type: text/x-patch, Size: 1222 bytes --]
diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el
index 12f6e8c..8a89675 100644
--- a/lisp/org-docbook.el
+++ b/lisp/org-docbook.el
@@ -653,7 +653,9 @@ publishing directory."
(replace-match "\\2\n"))
(insert line "\n")
(while (and lines
- (or (not ind) (equal ind (get-text-property 0 'original-indentation (car lines))))
+ (or (= (length (car lines)) 0)
+ (not ind)
+ (equal ind (get-text-property 0 'original-indentation (car lines))))
(or (= (length (car lines)) 0)
(get-text-property 0 'org-protected (car lines))))
(insert (pop lines) "\n"))
diff --git a/lisp/org-html.el b/lisp/org-html.el
index bb73f24..77f820e 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -850,7 +850,9 @@ lang=\"%s\" xml:lang=\"%s\">
(replace-match "\\2\n"))
(insert line "\n")
(while (and lines
- (or (not ind) (equal ind (get-text-property 0 'original-indentation (car lines))))
+ (or (= (length (car lines)) 0)
+ (not ind)
+ (equal ind (get-text-property 0 'original-indentation (car lines))))
(or (= (length (car lines)) 0)
(get-text-property 0 'org-protected (car lines))))
(insert (pop lines) "\n"))
[-- 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] 2+ messages in thread
* Re: [PATCH] Fix a DocBook/HTML exporter bug for literal examples
2009-06-14 10:56 [PATCH] Fix a DocBook/HTML exporter bug for literal examples Baoqiu Cui
@ 2009-06-14 16:05 ` Carsten Dominik
0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2009-06-14 16:05 UTC (permalink / raw)
To: Baoqiu Cui; +Cc: emacs-orgmode
Ahh, the beauty of a patch bug report with the patch attached...
Applied, thanks.
- Carsten
On Jun 14, 2009, at 12:56 PM, Baoqiu Cui wrote:
> Carsten,
>
> Recent changes to respect example indentations introduced a bug in
> both
> DocBook and HTML exporters. The following example
>
> ------------------------------------------------------------------------
> #+BEGIN_EXAMPLE
> Group of lines separated by empty lines:
>
> Line One.
>
> Line Two.
> Line Three.
>
> Line Four.
> Line Five.
> #+END_EXAMPLE
> ------------------------------------------------------------------------
>
> is exported to HTML like the following (note that every empty line in
> the above example is repeated 3 times):
>
> ------------------------------------------------------------------------
> <pre class="example">
> Lines...
>
>
>
> Line One.
>
>
>
> Line Two.
> Line Three.
>
>
>
> Line Four.
> Line Five.
> </pre>
> ------------------------------------------------------------------------
>
> and to DocBook format like this (empty lines are removed):
>
> ------------------------------------------------------------------------
> <programlisting><![CDATA[Group of lines separated by empty lines:
> Line One.
> Line Two.
> Line Three.
> Line Four.
> Line Five.
> ]]>
> </programlisting>
> ------------------------------------------------------------------------
>
> Attached please find a patch to fix this problem.
>
> Thanks,
> Baoqiu
>
> <example-indent.diff>_______________________________________________
> 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 [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-06-14 16:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-14 10:56 [PATCH] Fix a DocBook/HTML exporter bug for literal examples Baoqiu Cui
2009-06-14 16:05 ` 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).