emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 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/)]
@ 2018-02-13 23:12 Michel Damiens
  2018-02-14 14:07 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Michel Damiens @ 2018-02-13 23:12 UTC (permalink / raw)
  To: emacs-orgmode

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

Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------

Hello,
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>


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 ?

(Sorry, I didn't find in documentation a way to format code in the
mail. I hope it is readable)

Thanks a lot for your help

Michel

Emacs  : GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2017-09-20 on lcy01-07, modified by Debian
Package: Org mode version 9.1.6 (9.1.6-44-ge6f891-elpa @ /home/michel/.emac=
s.d/elpa/org-20180212/)

[-- Attachment #2: Type: text/html, Size: 3318 bytes --]

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

* Re: 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/)]
  2018-02-13 23:12 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/)] Michel Damiens
@ 2018-02-14 14:07 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2018-02-14 14:07 UTC (permalink / raw)
  To: Michel Damiens; +Cc: emacs-orgmode

Hello,

Michel Damiens <michel.damiens@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

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

end of thread, other threads:[~2018-02-14 14:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-13 23:12 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/)] Michel Damiens
2018-02-14 14:07 ` Nicolas Goaziou

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