Hello, Michel Damiens <michel.dami...@gmail.com> 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