* Bugfix for org-export-format-source-code-or-example
@ 2009-06-20 5:29 sand
2009-06-20 18:40 ` Carsten Dominik
0 siblings, 1 reply; 2+ messages in thread
From: sand @ 2009-06-20 5:29 UTC (permalink / raw
To: emacs-orgmode
[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 1565 bytes --]
I switched my 'org-export-html-extension' variable from "html" to
"xhtml" and found that code examples are being formatted
incorrectly. I use Firefox, and when Firefox has (what it thinks is)
HTML-in-XML, it uses Standards Mode. This happens:
- if you get the document from a server and its MIME type is
"application/xhtml+xml", or
- if you get the document from a file, and its extension is
".xhtml".
Otherwise it uses Quirks mode. In Standards mode, Firefox attempts to
render everything per the spec. In Quirks mode, Firefox is being
backwards compatible with legacy browsers. (I'm ignoring Almost
Standards mode here.)
The current master repo generates HTML like
<pre class="example">
Quote paragraph 1.
Quote paragraph 2.
Quote paragraph 3.
</pre>
which Firefox displays as we expect in Quirks mode. In Standards
mode, Firefox adds an extra blank line before the "Quote paragraph 1."
This comes from Firefox presenting the newline that Org Mode has
inserted between the first ">" and the text. This blank line is very
obvious in the browser, because the sample has an enclosing box.
When I manually remove the newlines, both XHTML and HTML modes look
correct, so I have created a patch (attached) to remove the newlines
after the "pre". This fixes the XHTML display problem. The ASCII
exporter looks fine after the change, and I can't see any difference
in what the LaTeX and Docbook exporters generate.
(Why am I bothering with XHTML in the first place?
To embed SVG elements.)
Derek
--
Derek Upham
sand@blarg.net
[-- Attachment #2: Patch to remove incorrect newline when generating "pre" --]
[-- Type: text/plain, Size: 897 bytes --]
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 6d8dd4a..5412e1b 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -2228,7 +2228,7 @@ INDENT was the original indentation of the block."
(point-min) (point-max))))
(if (string-match "<pre\\([^>]*\\)>\n?" rtn)
(setq rtn (replace-match
- (format "<pre class=\"src src-%s\">\n" lang)
+ (format "<pre class=\"src src-%s\">" lang)
t t rtn))))
(if textareap
(setq rtn (concat
@@ -2243,7 +2243,7 @@ INDENT was the original indentation of the block."
'((?&."&")(?<."<")(?>.">"))))
t t))
(setq rtn (buffer-string)))
- (setq rtn (concat "<pre class=\"example\">\n" rtn "</pre>\n"))))
+ (setq rtn (concat "<pre class=\"example\">" rtn "</pre>\n"))))
(unless textareap
(setq rtn (org-export-number-lines rtn 'html 1 1 num
cont rpllbl fmt)))
[-- 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: Bugfix for org-export-format-source-code-or-example
2009-06-20 5:29 Bugfix for org-export-format-source-code-or-example sand
@ 2009-06-20 18:40 ` Carsten Dominik
0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2009-06-20 18:40 UTC (permalink / raw
To: sand; +Cc: emacs-orgmode
Applied, thanks, in particular for the extensive explanations.
- Carsten
On Jun 20, 2009, at 7:29 AM, sand@blarg.net wrote:
> I switched my 'org-export-html-extension' variable from "html" to
> "xhtml" and found that code examples are being formatted
> incorrectly. I use Firefox, and when Firefox has (what it thinks is)
> HTML-in-XML, it uses Standards Mode. This happens:
>
> - if you get the document from a server and its MIME type is
> "application/xhtml+xml", or
>
> - if you get the document from a file, and its extension is
> ".xhtml".
>
> Otherwise it uses Quirks mode. In Standards mode, Firefox attempts to
> render everything per the spec. In Quirks mode, Firefox is being
> backwards compatible with legacy browsers. (I'm ignoring Almost
> Standards mode here.)
>
> The current master repo generates HTML like
>
> <pre class="example">
> Quote paragraph 1.
>
> Quote paragraph 2.
>
> Quote paragraph 3.
> </pre>
>
> which Firefox displays as we expect in Quirks mode. In Standards
> mode, Firefox adds an extra blank line before the "Quote paragraph 1."
> This comes from Firefox presenting the newline that Org Mode has
> inserted between the first ">" and the text. This blank line is very
> obvious in the browser, because the sample has an enclosing box.
>
> When I manually remove the newlines, both XHTML and HTML modes look
> correct, so I have created a patch (attached) to remove the newlines
> after the "pre". This fixes the XHTML display problem. The ASCII
> exporter looks fine after the change, and I can't see any difference
> in what the LaTeX and Docbook exporters generate.
>
> (Why am I bothering with XHTML in the first place?
> To embed SVG elements.)
>
> Derek
>
> --
> Derek Upham
> sand@blarg.net
>
>
> diff --git a/lisp/org-exp.el b/lisp/org-exp.el
> index 6d8dd4a..5412e1b 100644
> --- a/lisp/org-exp.el
> +++ b/lisp/org-exp.el
> @@ -2228,7 +2228,7 @@ INDENT was the original indentation of the
> block."
> (point-min) (point-max))))
> (if (string-match "<pre\\([^>]*\\)>\n?" rtn)
> (setq rtn (replace-match
> - (format "<pre class=\"src src-%s\">\n" lang)
> + (format "<pre class=\"src src-%s\">" lang)
> t t rtn))))
> (if textareap
> (setq rtn (concat
> @@ -2243,7 +2243,7 @@ INDENT was the original indentation of the
> block."
> '((?&."&")(?<."<")(?>.">"))))
> t t))
> (setq rtn (buffer-string)))
> - (setq rtn (concat "<pre class=\"example\">\n" rtn "</pre>\n"))))
> + (setq rtn (concat "<pre class=\"example\">" rtn "</pre>\n"))))
> (unless textareap
> (setq rtn (org-export-number-lines rtn 'html 1 1 num
> cont rpllbl fmt)))
> _______________________________________________
> 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-20 18:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-20 5:29 Bugfix for org-export-format-source-code-or-example sand
2009-06-20 18:40 ` Carsten Dominik
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.