emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Another HTML Export Problem
@ 2011-03-16  0:39 Scott Randby
  2011-03-16  1:31 ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: Scott Randby @ 2011-03-16  0:39 UTC (permalink / raw)
  To: emacs-orgmode

Some links are not exporting properly with org release_7.5.52.g0dc16. It
seems that any link that contains "&" does not export correctly. Take
the four links given below.

[[http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=xetex][XeTeX]]

http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=xetex

[[http://www.casio.com/products/Calculators_&_Dictionaries/][Casio]]

http://www.casio.com/products/Calculators_&_Dictionaries/


These links are incorrectly exported by version 7.5 as:

<p>
@&lt;a
href="http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&amp;amp;id=xetex"&gt;XeTeX</a>
</p>

<p>
@&lt;a
href="http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&amp;amp;id=xetex"&gt;http://scripts.sil.org/cms/scripts/page.php?site<sub>id</sub>=nrsi&amp;amp;id=xetex</a>
</p>

<p>
@&lt;a
href="http://www.casio.com/products/Calculators_&amp;amp;_Dictionaries/"&gt;Casio</a>
</p>

<p>
@&lt;a
href="http://www.casio.com/products/Calculators_&amp;amp;_Dictionaries/"&gt;http://www.casio.com/products/Calculators<sub>&amp</sub>;amp;<sub>Dictionaries</sub>/</a>
</p>

With version 7.4, the links are correctly exported as:

<p>
<a
href="http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&amp;id=xetex">XeTeX</a>
</p>

<p>
<a
href="http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&amp;id=xetex">http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&amp;id=xetex</a>
</p>

<p>
<a
href="http://www.casio.com/products/Calculators_&amp;_Dictionaries/">Casio</a>
</p>

<p>
<a
href="http://www.casio.com/products/Calculators_&amp;_Dictionaries/">http://www.casio.com/products/Calculators_&amp;_Dictionaries/</a>
</p>

Scott Randby

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

* Re: Another HTML Export Problem
  2011-03-16  0:39 Another HTML Export Problem Scott Randby
@ 2011-03-16  1:31 ` Bastien
  2011-03-17  8:07   ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: Bastien @ 2011-03-16  1:31 UTC (permalink / raw)
  To: Scott Randby; +Cc: emacs-orgmode

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

Hi Scott,

Scott Randby <srandby@gmail.com> writes:

> Some links are not exporting properly with org release_7.5.52.g0dc16. It
> seems that any link that contains "&" does not export correctly. Take
> the four links given below.

Yes, problems again here -- thanks for reporting.

If you can, please test this patch.  I'm not applying it right now as 
I want to make sure to apply a safe and complete patch.

Best,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-html.el.patch --]
[-- Type: text/x-patch, Size: 2623 bytes --]

diff --git a/lisp/org-html.el b/lisp/org-html.el
index 0abecac..c6f26b5 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -848,9 +848,9 @@ MAY-INLINE-P allows inlining it as an image."
 	       (message "image %s %s" thefile org-par-open)
 	       (org-export-html-format-image thefile org-par-open))
 	    (concat
-	       "@<a href=\"" thefile "\"" (if attr (concat " " attr)) ">"
+	       "<a href=\"" thefile "\"" (if attr (concat " " attr)) ">"
 	       (org-export-html-format-desc desc)
-	       "@</a>")))))
+	       "</a>")))))
 
 (defun org-html-handle-links (line opt-plist)
   "Return LINE with markup of Org mode links.
@@ -1530,9 +1530,6 @@ lang=\"%s\" xml:lang=\"%s\">
 				  "@</a> ")
 			  t t line)))))
 
-	  ;; Format the links
-	  (setq line (org-html-handle-links line opt-plist))
-
 	  (setq line (org-html-handle-time-stamps line))
 
 	  ;; replace "&" by "&amp;", "<" and ">" by "&lt;" and "&gt;"
@@ -1541,6 +1538,9 @@ lang=\"%s\" xml:lang=\"%s\">
 	  (or (string-match org-table-hline-regexp line)
 	      (setq line (org-html-expand line)))
 
+	  ;; Format the links
+	  (setq line (org-html-handle-links line opt-plist))
+
 	  ;; TODO items
 	  (if (and (string-match org-todo-line-regexp line)
 		   (match-beginning 2))
@@ -1829,7 +1829,7 @@ lang=\"%s\" xml:lang=\"%s\">
   "Create image tag with source and attributes."
   (save-match-data
     (if (string-match "^ltxpng/" src)
-	(format "@<img src=\"%s\" alt=\"%s\"/>"
+	(format "<img src=\"%s\" alt=\"%s\"/>"
                 src (org-find-text-property-in-string 'org-latex-src src))
       (let* ((caption (org-find-text-property-in-string 'org-caption src))
 	     (attr (org-find-text-property-in-string 'org-attributes src))
@@ -1837,20 +1837,20 @@ lang=\"%s\" xml:lang=\"%s\">
 	(setq caption (and caption (org-html-do-expand caption)))
 	(concat
 	(if caption
-	    (format "%s@<div %sclass=\"figure\">
-@<p>"
-		    (if org-par-open "@</p>\n" "")
+	    (format "%s<div %sclass=\"figure\">
+<p>"
+		    (if org-par-open "</p>\n" "")
 		    (if label (format "id=\"%s\" " (org-solidify-link-text label)) "")))
-	(format "@<img src=\"%s\"%s />"
+	(format "<img src=\"%s\"%s />"
 		src
 		(if (string-match "\\<alt=" (or attr ""))
 		    (concat " " attr )
 		  (concat " " attr " alt=\"" src "\"")))
 	(if caption
-	    (format "@</p>%s
-@</div>%s"
-		(concat "\n@<p>" caption "@</p>")
-		(if org-par-open "\n@<p>" ""))))))))
+	    (format "</p>%s
+</div>%s"
+		(concat "\n<p>" caption "</p>")
+		(if org-par-open "\n<p>" ""))))))))
 
 (defun org-export-html-get-bibliography ()
   "Find bibliography, cut it out and return it."

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


-- 
 Bastien

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

* Re: Another HTML Export Problem
@ 2011-03-16 11:51 David Maus
  2011-03-17 14:34 ` Eric S Fraga
  0 siblings, 1 reply; 8+ messages in thread
From: David Maus @ 2011-03-16 11:51 UTC (permalink / raw)
  To: bzg; +Cc: emacs-orgmode

Hi,

Bastien's patch looks good and/but introduces a regression: The commit
that started all this trobule --
163cd58ffd6461c98a96b1b63a3cf082b2825a52 -- fixed a problem with
exporting links with a description that contained an ISO Date.  The
current problem can be located in `org-html-do-expand' which uses the
regexp "@&lt;\\([^&]*\\)&gt;" to remove protection from elements.
Obviously this function was never meant to deal with links :|

I think we should accept the regression, restore the old behaviour and
find a better solution for the problem I tried to solve in the first
place.

Best,
  -- David

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

* Re: Another HTML Export Problem
  2011-03-16  1:31 ` Bastien
@ 2011-03-17  8:07   ` Bastien
  2011-03-17 14:45     ` Scott Randby
  0 siblings, 1 reply; 8+ messages in thread
From: Bastien @ 2011-03-17  8:07 UTC (permalink / raw)
  To: Scott Randby; +Cc: emacs-orgmode

Hi Scott,

Bastien <bzg@altern.org> writes:

> If you can, please test this patch.  I'm not applying it right now as 
> I want to make sure to apply a safe and complete patch.

I've applied this patch now.

-- 
 Bastien

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

* Re: Another HTML Export Problem
  2011-03-17  8:07   ` Bastien
@ 2011-03-17 14:45     ` Scott Randby
  0 siblings, 0 replies; 8+ messages in thread
From: Scott Randby @ 2011-03-17 14:45 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

On 03/17/2011 04:07 AM, Bastien wrote:
> Hi Scott,
> 
> Bastien <bzg@altern.org> writes:
> 
>> If you can, please test this patch.  I'm not applying it right now as 
>> I want to make sure to apply a safe and complete patch.
> 
> I've applied this patch now.

Hi Bastien,

It works and doesn't break anything else as far as I can tell. Thanks
for fixing this. I'm sorry I couldn't test the patch, but I want to
learn how to do such things sometime. I'll stick with reporting any bugs
I find for now.

Scott

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

* Re: Another HTML Export Problem
  2011-03-20 11:21   ` David Maus
@ 2011-03-21  1:46     ` Bernt Hansen
  2011-03-21  5:46       ` David Maus
  0 siblings, 1 reply; 8+ messages in thread
From: Bernt Hansen @ 2011-03-21  1:46 UTC (permalink / raw)
  To: David Maus; +Cc: bzg, emacs-orgmode

David Maus <maus.david@gmail.com> writes:

> At Thu, 17 Mar 2011 14:34:52 +0000,
> Eric S Fraga wrote:
>>
>> I don't know if this is the same problem but exporting, to HTML, the
>
> Yes, this was a symptom of the broken HTML export. Should be fixed now.

Hi David,

I think there is yet another HTML export issue with the current
development code.

--8<---------------cut here---------------start------------->8---
* Test
[2011-03-20 Sun]
[2011-03-20 Sun]
org.el
--8<---------------cut here---------------end--------------->8---

exported here: http://www.norang.ca/tmp/org-scratch.html

exports to HTML as

--8<---------------cut here---------------start------------->8---
...
<body>
<div id="content">

<h1 class="title">org-scratch</h1>

<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Test </a></li>
</ul>
</div>
</div>

<div id="outline-container-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> Test </h2>
<div class="outline-text-2" id="text-1">

<p> <span class="timestamp-wrapper"> <span class="timestamp">2011-03-20 Sun</span></span>&lt;br/&gt;
 <span class="timestamp-wrapper"> <span class="timestamp">2011-03-20 Sun</span></span>&lt;br/&gt;
org.el
</p></div>
</div>
<div id="postamble">
<p class="date">Date: 2011-03-20 21:31:20 EDT</p>
<p class="author">Author: Bernt Hansen</p>
<p class="creator">Org version 7.5 with Emacs version 23</p>
<a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a>
</div>
</div>
</body>
</html>
--8<---------------cut here---------------end--------------->8---

For the timestamps

,----
| <div class="outline-text-2" id="text-1">
| 
| <p> <span class="timestamp-wrapper"> <span class="timestamp">2011-03-20 Sun</span></span>&lt;br/&gt;
|  <span class="timestamp-wrapper"> <span class="timestamp">2011-03-20 Sun</span></span>&lt;br/&gt;
| org.el
| </p></div>
`----

The timestamps have the < and > brackets of <br/> converted to &lt; and
&gt; which is incorrect.

I ran bisect and identified the following commit

6a369c26d3f936bc71cba9d7148dcecf1b2c9677 is the first bad commit
commit 6a369c26d3f936bc71cba9d7148dcecf1b2c9677
Author: David Maus <dmaus@ictsoc.de>
Date:   Sun Mar 13 20:27:12 2011 +0100

    Expand char entities after creating markup for links and timestamps
    
    * org-html.el (org-html-make-link, org-html-handle-links): Protect
    generated XHTML elements.
    (org-export-as-html): Expand character entities after creating markup
    for links and timestamps.
    
    This fixes a problem with exporting active timestamps, reported by
    Daniel Clemente <n142857@gmail.com>.

:040000 040000 1508340e77dca86766af48df2eadf747070f89ce ca668c398391b307e49113fb592fb68195640896 M	lisp

Regards,
-- 
Bernt

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

* Re: Another HTML Export Problem
  2011-03-21  1:46     ` Bernt Hansen
@ 2011-03-21  5:46       ` David Maus
  2011-03-21 12:49         ` Bernt Hansen
  0 siblings, 1 reply; 8+ messages in thread
From: David Maus @ 2011-03-21  5:46 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: David Maus, emacs-orgmode, bzg

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

Hi Bernt,

At Sun, 20 Mar 2011 21:46:19 -0400,
Bernt Hansen wrote:
>
> David Maus <maus.david@gmail.com> writes:
>
> > At Thu, 17 Mar 2011 14:34:52 +0000,
> > Eric S Fraga wrote:
> >>
> >> I don't know if this is the same problem but exporting, to HTML, the
> >
> > Yes, this was a symptom of the broken HTML export. Should be fixed now.
>
> I think there is yet another HTML export issue with the current
> development code.

Indeed. This should be fixed now as well.

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #2: Type: application/pgp-signature, Size: 230 bytes --]

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

* Re: Another HTML Export Problem
  2011-03-21  5:46       ` David Maus
@ 2011-03-21 12:49         ` Bernt Hansen
  0 siblings, 0 replies; 8+ messages in thread
From: Bernt Hansen @ 2011-03-21 12:49 UTC (permalink / raw)
  To: David Maus; +Cc: bzg, emacs-orgmode

David Maus <maus.david@gmail.com> writes:

> At Sun, 20 Mar 2011 21:46:19 -0400,
> Bernt Hansen wrote:
>>
>> I think there is yet another HTML export issue with the current
>> development code.
>
> Indeed. This should be fixed now as well.

Hi David,

Thanks for the quick fix!

Regards,
-- 
Bernt

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

end of thread, other threads:[~2011-03-21 12:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-16  0:39 Another HTML Export Problem Scott Randby
2011-03-16  1:31 ` Bastien
2011-03-17  8:07   ` Bastien
2011-03-17 14:45     ` Scott Randby
  -- strict thread matches above, loose matches on Subject: below --
2011-03-16 11:51 David Maus
2011-03-17 14:34 ` Eric S Fraga
2011-03-20 11:21   ` David Maus
2011-03-21  1:46     ` Bernt Hansen
2011-03-21  5:46       ` David Maus
2011-03-21 12:49         ` Bernt Hansen

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).