Max Nikulin <maniku...@gmail.com> writes:

> I am confused. I can not figure out how to create the following as HTML 
> export result:
>
> <img src="img.png" alt="An image without :width 600 attribute">
>
> Attempt to add quotes leads to &quot; and does not prevent ":width" to 
> become another attribute.
>
>    #+attr_html: :alt An image without :width 600 attribute
>    [[file:img.png]]
>
>    <p><img src="img.png" alt="An image without" width="600 attribute" />
> </p>
>
> My current variant:
>
> ":\\(?:[^\n]*?[[:blank:]]\\)?:width[[:blank:]]+\\(\\S-+\\)"
>
> The regexp should not match e.g.
>
> #+attr_html: :alt something
> :width 600
>
> P.S. I would prefer to use the same parser as ox does.

(cadr par) contains all the attr_ keywords with their values. I think it
would be better to use this instead of doing a regex search, which I
expect would be slower and more prone to errors. If we want to be strict
(and probably more correct), we could use
org-export-registered-backends. Otherwise, we could look for any key
that starts with attr_.

I can probably implement this if people want. But, let me know if I
should indeed use org-export-registered-backends. However, I'm starting
to feel like this should be separate patch (the goal for mine was just
to prioritize attr_org). I also still don't really like the behavior
here. I don't think it makes sense to interpret a width as 120% if we
have something like

#+attr_latex: :width 1.2\columnwidth

Matt

Reply via email to