emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* html export
@ 2010-05-27 16:37 Thomas S. Dye
  2010-05-27 20:58 ` Carsten Dominik
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas S. Dye @ 2010-05-27 16:37 UTC (permalink / raw)
  To: emacs-orgmode Mode


[-- Attachment #1.1: Type: text/plain, Size: 584 bytes --]

Aloha all,

Org-mode html export recently began to format links improperly for me  
in projects that have been stable for some time and working properly.

I now get <p>img src="file:r/filename.png" alt="file:r/filename.png" / 
 ></p>

This isn't a bug report.  I've been having lots of problems publishing  
formerly stable projects, some of which I believe are due to changes  
in org-mode while others appear to stem from my setup.

I haven't investigated this one yet, but it would help me to know if  
others are seeing similar behavior when publishing to html.

All the best,
Tom

[-- Attachment #1.2: Type: text/html, Size: 1127 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please 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] 10+ messages in thread

* Re: html export
  2010-05-27 16:37 Thomas S. Dye
@ 2010-05-27 20:58 ` Carsten Dominik
  2010-05-27 21:29   ` Sebastian Rose
  0 siblings, 1 reply; 10+ messages in thread
From: Carsten Dominik @ 2010-05-27 20:58 UTC (permalink / raw)
  To: Thomas S. Dye, Sebastian Rose; +Cc: emacs-orgmode Mode

Hi Tom,

On May 27, 2010, at 6:37 PM, Thomas S. Dye wrote:

> Aloha all,
>
> Org-mode html export recently began to format links improperly for  
> me in projects that have been stable for some time and working  
> properly.
>
> I now get <p>img src="file:r/filename.png" alt="file:r/ 
> filename.png" /></p>
>
> This isn't a bug report.  I've been having lots of problems  
> publishing formerly stable projects, some of which I believe are due  
> to changes in org-mode while others appear to stem from my setup.
>
> I haven't investigated this one yet, but it would help me to know if  
> others are seeing similar behavior when publishing to html.

This i a bug introduced by a recent patch to factorize link creation  
in html export into a separate function.  We are still ironing out the  
small problems this patch created.  If this i a critical issue, switch  
back to an older verion for the time being.  I believe Sebastian Rose  
is now looking at the problem...

- Carsten

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

- Carsten

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

* Re: html export
  2010-05-27 20:58 ` Carsten Dominik
@ 2010-05-27 21:29   ` Sebastian Rose
  0 siblings, 0 replies; 10+ messages in thread
From: Sebastian Rose @ 2010-05-27 21:29 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode Mode

Hi Carsten and Thomas,


Carsten Dominik <carsten.dominik@gmail.com> writes:
> Hi Tom,
>
> On May 27, 2010, at 6:37 PM, Thomas S. Dye wrote:
>
>> Aloha all,
>>
>> Org-mode html export recently began to format links improperly for me in
>> projects that have been stable for some time and working  properly.
>>
>> I now get <p>img src="file:r/filename.png" alt="file:r/
>> filename.png" /></p>
>>
>> This isn't a bug report.  I've been having lots of problems publishing
>> formerly stable projects, some of which I believe are due  to changes in
>> org-mode while others appear to stem from my setup.
>>
>> I haven't investigated this one yet, but it would help me to know if others
>> are seeing similar behavior when publishing to html.
>
> This i a bug introduced by a recent patch to factorize link creation in html
> export into a separate function.  We are still ironing out the  small problems
> this patch created.  If this i a critical issue, switch  back to an older verion
> for the time being.  I believe Sebastian Rose  is now looking at the problem...


I just saw my patch was applied yesterday. For the bug is fixed, but
there might be corner cases I overlooked.

Thomas, does the current head not work for you?
If not, could you make up a little example for testing?


   Sebastian




>
> - Carsten
>
>>
>> All the best,
>> Tom
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
> - Carsten

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

* html export
@ 2010-06-20  1:50 Thomas S. Dye
  2010-06-20  3:28 ` Eric Schulte
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas S. Dye @ 2010-06-20  1:50 UTC (permalink / raw)
  To: Org Mode

Aloha all,

Exporting this small file to html here doesn't put a caption on the  
figure.

* No caption

#+CAPTION: Histogram of adze weights on a logarithmic scale
#+LABEL: fig:wt-log

[[file:~/Public/projects/903_adzes/r/sr-nb-scatter.png]]

Does anyone else see this?

All of a sudden, I'm having the devil's own time with html export.  I  
made small changes to a large export project file and was surprised  
when none of the links were exported.  The project has been exporting  
perfectly for months now.

All the best,
Tom

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

* Re: html export
  2010-06-20  1:50 html export Thomas S. Dye
@ 2010-06-20  3:28 ` Eric Schulte
  2010-06-20  3:58   ` Nick Dokos
  2010-06-20 16:11   ` Thomas S. Dye
  0 siblings, 2 replies; 10+ messages in thread
From: Eric Schulte @ 2010-06-20  3:28 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org Mode

Hi Tom,

"Thomas S. Dye" <tsd@tsdye.com> writes:

> Aloha all,
>
> Exporting this small file to html here doesn't put a caption on the
> figure.
>
> * No caption
>
> #+CAPTION: Histogram of adze weights on a logarithmic scale
> #+LABEL: fig:wt-log
>
> [[file:~/Public/projects/903_adzes/r/sr-nb-scatter.png]]
>
> Does anyone else see this?
>

Try removing the empty line between the #+LABEL:... line and the
[[file:... line, that worked for me.  or rather the following worked for
me

--8<---------------cut here---------------start------------->8---
* No caption

#+CAPTION: Histogram of adze weights on a logarithmic scale
#+LABEL: fig:wt-log
[[file:graph.png]]

--8<---------------cut here---------------end--------------->8---

also, if the file doesn't exist, then neither the file, nor the label or
caption will export.

>
> All of a sudden, I'm having the devil's own time with html export.  I
> made small changes to a large export project file and was surprised
> when none of the links were exported.  The project has been exporting
> perfectly for months now.
>

I agree it seems that the html export has been a little bit less stable
as of late.

Best -- Eric

>
> All the best,
> Tom
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please 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] 10+ messages in thread

* Re: html export
  2010-06-20  3:28 ` Eric Schulte
@ 2010-06-20  3:58   ` Nick Dokos
  2010-06-20 16:11   ` Thomas S. Dye
  1 sibling, 0 replies; 10+ messages in thread
From: Nick Dokos @ 2010-06-20  3:58 UTC (permalink / raw)
  To: Eric Schulte; +Cc: nicholas.dokos, Org Mode

Eric Schulte <schulte.eric@gmail.com> wrote:

> Hi Tom,
> 
> "Thomas S. Dye" <tsd@tsdye.com> writes:
> 
> > Aloha all,
> >
> > Exporting this small file to html here doesn't put a caption on the
> > figure.
> >
> > * No caption
> >
> > #+CAPTION: Histogram of adze weights on a logarithmic scale
> > #+LABEL: fig:wt-log
> >
> > [[file:~/Public/projects/903_adzes/r/sr-nb-scatter.png]]
> >
> > Does anyone else see this?
> >
> 
> Try removing the empty line between the #+LABEL:... line and the
> [[file:... line, that worked for me.  or rather the following worked for
> me
> 
> * No caption
> 
> #+CAPTION: Histogram of adze weights on a logarithmic scale
> #+LABEL: fig:wt-log
> [[file:graph.png]]
> 
> 
> also, if the file doesn't exist, then neither the file, nor the label or
> caption will export.
> 

I can't get it to work with or without the empty line:

Org-mode version 6.36trans (release_6.36.264.g74d3)

Be that as it may, I compared the html export code with the latex export
code and it seems to me that the caption is calculated too late in the
html code: it's done in org-export-html-format-image by looking for the
org-caption text property on its ``src'' argument, but afaict, the argument
is just a string - no text properties.

I tried the following patch, which makes the html caption handling look
a bit more like what the latex exporter does, and it seems to work in
this case, but I have not tested it any further.

Thanks,
Nick

diff --git a/lisp/org-html.el b/lisp/org-html.el
index d5809ab..73cba14 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -621,7 +621,8 @@ MAY-INLINE-P allows inlining it as an image."
 			opt-plist components-1)
 		     components-1))
 	       (type    (first  components-2))
-	       (thefile (second components-2)))
+	       (thefile (second components-2))
+	       (caption (org-find-text-property-in-string 'org-caption path)))
 
 
 	 ;;Third pass.  Build final link except for leading type
@@ -651,7 +652,7 @@ MAY-INLINE-P allows inlining it as an image."
 		(not fragment))
 	    (progn
 	       (message "image %s %s" thefile org-par-open)
-	       (org-export-html-format-image thefile org-par-open))
+	       (org-export-html-format-image thefile caption org-par-open))
 	    (concat
 	       "<a href=\"" thefile "\"" attr ">"
 	       (org-export-html-format-desc desc)
@@ -1674,14 +1675,13 @@ lang=\"%s\" xml:lang=\"%s\">
 	(org-html-do-expand s))
     s))
 
-(defun org-export-html-format-image (src par-open)
+(defun org-export-html-format-image (src caption par-open)
   "Create image tag with source and attributes."
   (save-match-data
     (if (string-match "^ltxpng/" src)
 	(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))
+      (let* ((attr (org-find-text-property-in-string 'org-attributes src))
 	     (label (org-find-text-property-in-string 'org-label src)))
 	(setq caption (and caption (org-html-do-expand caption)))
 	(concat

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

* Re: html export
  2010-06-20  3:28 ` Eric Schulte
  2010-06-20  3:58   ` Nick Dokos
@ 2010-06-20 16:11   ` Thomas S. Dye
  2010-06-20 18:14     ` Eric Schulte
  1 sibling, 1 reply; 10+ messages in thread
From: Thomas S. Dye @ 2010-06-20 16:11 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode

Hi Eric,

On Jun 19, 2010, at 5:28 PM, Eric Schulte wrote:

> Hi Tom,
>
> "Thomas S. Dye" <tsd@tsdye.com> writes:
>
>> Aloha all,
>>
>> Exporting this small file to html here doesn't put a caption on the
>> figure.
>>
>> * No caption
>>
>> #+CAPTION: Histogram of adze weights on a logarithmic scale
>> #+LABEL: fig:wt-log
>>
>> [[file:~/Public/projects/903_adzes/r/sr-nb-scatter.png]]
>>
>> Does anyone else see this?
>>
>
> Try removing the empty line between the #+LABEL:... line and the
> [[file:... line, that worked for me.  or rather the following worked  
> for
> me
>
> --8<---------------cut here---------------start------------->8---
> * No caption
>
> #+CAPTION: Histogram of adze weights on a logarithmic scale
> #+LABEL: fig:wt-log
> [[file:graph.png]]
>
> --8<---------------cut here---------------end--------------->8---
>
> also, if the file doesn't exist, then neither the file, nor the  
> label or
> caption will export.
>
>>
>> All of a sudden, I'm having the devil's own time with html export.  I
>> made small changes to a large export project file and was surprised
>> when none of the links were exported.  The project has been exporting
>> perfectly for months now.
>>
>
> I agree it seems that the html export has been a little bit less  
> stable
> as of late.
>
> Best -- Eric

Removing the blank line doesn't work for me either.

Org-mode version 6.36trans (release_6.36.291.gaf90f)

Ah, I'm finally able to reproduce the problem in my larger file.  Here  
is an example:

* No results exported

#+srcname: problem
#+begin_src R
   b <- 4
#+end_src

#+results: problem
[[file:~/Public/projects/903_adzes/r/sr-nb-scatter.png]]

The key is that srcname: and results: have the same name.  Changing  
the results: name works.

* Results exported

#+srcname: problem
#+begin_src R
   b <- 4
#+end_src

#+results: problem-not
[[file:~/Public/projects/903_adzes/r/sr-nb-scatter.png]]

All the best,
Tom

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

* Re: html export
  2010-06-20 16:11   ` Thomas S. Dye
@ 2010-06-20 18:14     ` Eric Schulte
  2010-06-20 20:17       ` Nick Dokos
  2010-06-20 20:54       ` Thomas S. Dye
  0 siblings, 2 replies; 10+ messages in thread
From: Eric Schulte @ 2010-06-20 18:14 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org Mode

"Thomas S. Dye" <tsd@tsdye.com> writes:

[...]
> Removing the blank line doesn't work for me either.
>
> Org-mode version 6.36trans (release_6.36.291.gaf90f)
>

Hmm, I just tried the above again using the HEAD (same org-version
output as you have above) of the org-mode git repository and a minimal
emacs config, and it *is* working for me, so maybe your problems will be
resolved with an update of org-mode, or maybe they're due to something
in your config?

>
> Ah, I'm finally able to reproduce the problem in my larger file.  Here
> is an example:
>
> * No results exported
>
> #+srcname: problem
> #+begin_src R
>   b <- 4
> #+end_src
>
> #+results: problem
> [[file:~/Public/projects/903_adzes/r/sr-nb-scatter.png]]
>
> The key is that srcname: and results: have the same name.  Changing
> the results: name works.
>
> * Results exported
>
> #+srcname: problem
> #+begin_src R
>   b <- 4
> #+end_src
>
> #+results: problem-not
> [[file:~/Public/projects/903_adzes/r/sr-nb-scatter.png]]
>

Yes, the key with the above is that babel by default only exports the
code of a code block, which means that if there are results in the
buffer they will be removed on export.  If you want both the code and
the results to be exported then change

  #+srcname: problem
  #+begin_src R
    b <- 4
  #+end_src

to

  #+srcname: problem
  #+begin_src R :exports both
    b <- 4
  #+end_src

Hope this helps -- Eric

>
> All the best,
> Tom

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

* Re: html export
  2010-06-20 18:14     ` Eric Schulte
@ 2010-06-20 20:17       ` Nick Dokos
  2010-06-20 20:54       ` Thomas S. Dye
  1 sibling, 0 replies; 10+ messages in thread
From: Nick Dokos @ 2010-06-20 20:17 UTC (permalink / raw)
  To: Eric Schulte; +Cc: nicholas.dokos, Org Mode

Eric Schulte <schulte.eric@gmail.com> wrote:

> "Thomas S. Dye" <tsd@tsdye.com> writes:
> 
> [...]
> > Removing the blank line doesn't work for me either.
> >
> > Org-mode version 6.36trans (release_6.36.291.gaf90f)
> >
> 
> Hmm, I just tried the above again using the HEAD (same org-version
> output as you have above) of the org-mode git repository and a minimal
> emacs config, and it *is* working for me, so maybe your problems will be
> resolved with an update of org-mode, or maybe they're due to something
> in your config?
> 

I think the difference between Eric's experiment and Tom's is the
filename of the image - Eric uses a relative pathname, whereas Tom uses
an absolute one:

,----
| 
| * No caption
| 
| #+CAPTION: Histogram of adze weights on a logarithmic scale
| #+LABEL: fig:wt-log
| [[file:Pic1.png]]
`----

produces a caption, but

,----
| 
| * No caption
| 
| #+CAPTION: Histogram of adze weights on a logarithmic scale
| #+LABEL: fig:wt-log
| [[file:~/Desktop/Pic1.png]]
`----

does not.

Also, the alignment of the image changes in the two cases, which leads
me to believe that one is treated as a display and the other as an
inline image.

Nick

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

* Re: html export
  2010-06-20 18:14     ` Eric Schulte
  2010-06-20 20:17       ` Nick Dokos
@ 2010-06-20 20:54       ` Thomas S. Dye
  1 sibling, 0 replies; 10+ messages in thread
From: Thomas S. Dye @ 2010-06-20 20:54 UTC (permalink / raw)
  To: Eric Schulte, nicholas.dokos; +Cc: Org Mode


[-- Attachment #1.1: Type: text/plain, Size: 2292 bytes --]

Hi Eric,

On Jun 20, 2010, at 8:14 AM, Eric Schulte wrote:

> "Thomas S. Dye" <tsd@tsdye.com> writes:
>
> [...]
>> Removing the blank line doesn't work for me either.
>>
>> Org-mode version 6.36trans (release_6.36.291.gaf90f)
>>
>
> Hmm, I just tried the above again using the HEAD (same org-version
> output as you have above) of the org-mode git repository and a minimal
> emacs config, and it *is* working for me, so maybe your problems  
> will be
> resolved with an update of org-mode, or maybe they're due to something
> in your config?
>
>>
>> Ah, I'm finally able to reproduce the problem in my larger file.   
>> Here
>> is an example:
>>
>> * No results exported
>>
>> #+srcname: problem
>> #+begin_src R
>>  b <- 4
>> #+end_src
>>
>> #+results: problem
>> [[file:~/Public/projects/903_adzes/r/sr-nb-scatter.png]]
>>
>> The key is that srcname: and results: have the same name.  Changing
>> the results: name works.
>>
>> * Results exported
>>
>> #+srcname: problem
>> #+begin_src R
>>  b <- 4
>> #+end_src
>>
>> #+results: problem-not
>> [[file:~/Public/projects/903_adzes/r/sr-nb-scatter.png]]
>>
>
> Yes, the key with the above is that babel by default only exports the
> code of a code block, which means that if there are results in the
> buffer they will be removed on export.  If you want both the code and
> the results to be exported then change
>
>  #+srcname: problem
>  #+begin_src R
>    b <- 4
>  #+end_src
>
> to
>
>  #+srcname: problem
>  #+begin_src R :exports both
>    b <- 4
>  #+end_src
>
> Hope this helps -- Eric

I didn't pay close attention when the default behavior changed.   
Adding #+property: exports both gets me back where I was before.

Also, following on Nick's message, the captions exported properly to  
html with absolute paths in the links and with lots of space between  
the caption and link.  Here's an example that exported properly:

#+CAPTION: Pairwise comparison of six metric variables
#+LABEL: fig:pairwise

#+srcname: pairs
#+begin_src R :results output :var x=whole-adzes :file r/adze_pairs.png
   whole.adze.metric <- x[,c(5,12,15,16,17,18)]
   names(whole.adze.metric) <-  
c("wt","len","edge","front","back","thick")
   pairs(whole.adze.metric)
#+end_src

#+results: pairs
[[file:r/adze_pairs.png]]

Thanks for your help.

Tom



[-- Attachment #1.2: Type: text/html, Size: 4268 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please 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] 10+ messages in thread

end of thread, other threads:[~2010-06-20 20:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-20  1:50 html export Thomas S. Dye
2010-06-20  3:28 ` Eric Schulte
2010-06-20  3:58   ` Nick Dokos
2010-06-20 16:11   ` Thomas S. Dye
2010-06-20 18:14     ` Eric Schulte
2010-06-20 20:17       ` Nick Dokos
2010-06-20 20:54       ` Thomas S. Dye
  -- strict thread matches above, loose matches on Subject: below --
2010-05-27 16:37 Thomas S. Dye
2010-05-27 20:58 ` Carsten Dominik
2010-05-27 21:29   ` Sebastian Rose

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