emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Bug: html export : adding a class attribute to an image [9.1.6 (


From: Nicolas Goaziou
Subject: Re: [O] Bug: html export : adding a class attribute to an image [9.1.6 (9.1.6-44-ge6f891-elpa @ /home/michel/.emacs.d/elpa/org-20180212/)]
Date: Wed, 14 Feb 2018 15:07:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hello,

Michel Damiens <address@hidden> writes:

> When exporting to html an image for which I added a class attribute, the
> result seems to depend on the fact that I insert or not an empty line
> after the image link. Example :
>
> with this text in my org file :
>
>     * Le sens des math
>  #+ATTR_HTML: :class vignette
>     [[file:logo_utl.jpg]]
>
>     [[file:utltb.org][UTL-TB]]
>     (Université du Temps Libre de Tarbes et Bigorre)
>
> I get the following html code :
>
>     <div id="outline-container-org4aefefe" class="outline-2">
>         <h2 id="org4aefefe">Le sens des math</h2>
>         <div class="outline-text-2" id="text-org4aefefe">
>             <figure>
>               <img src="logo_utl.jpg" alt="logo_utl.jpg" class="vignette">
>               <br>
>             </figure>
>         <p>
>             <a href="utltb.html">UTL-TB</a>
>     <br>(Université du Temps Libre de Tarbes et Bigorre)<br>
>
> and with this text (no blank line in the middle) :
>
>     * Le sens des math
> #+ATTR_HTML: :class vignette
>     [[file:logo_utl.jpg]]
>     [[file:utltb.org][UTL-TB]]
>     (Université du Temps Libre de Tarbes et Bigorre)
>
> I get :
>
>     div id="outline-container-org4aefefe" class="outline-2">
>     <h2 id="org4aefefe">Le sens des math</h2>
>     <div class="outline-text-2" id="text-org4aefefe">
>     <p class="vignette">
>     <img src="logo_utl.jpg" alt="logo_utl.jpg" class="vignette">
>     <br>
>     <a href="utltb.html">UTL-TB</a>
>     <br>(Université du Temps Libre de Tarbes et Bigorre)<br>

Off-topic: Nice organization! I wish I had heard about it when I was
living in Tarbes.

> In the second case the class attribute have been added both to <p> and
> <img> tags, which is not what I xant.
> Is it always necessary to separate the link from the rest of the text with a
> blank line ?

It is an Org limitation, which doesn't have proper syntax for images
attributes. 

More specifically, any paragraph containing only a link to an image file
is a stand-alone image. Org, whenever it encounters one of them, applies
paragraph attributes to the image instead, as in your first example. On
the other hand, when the paragraph contains anything else, attributes go
to the paragraph itself, as in the second example. The fact that the
first image still gets the attribute is more surprising, and could be
considered as a bug, but, AFAIU, this is not what your report is about.

Long story short: you cannot set attributes to multiple images within
a single paragraph. You need to insert one image per paragraph, or write
raw HTML code within the Org buffer.

Regards,

-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]