[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix regex for determining image width from attribute
From: |
Matt Huszagh |
Subject: |
Re: [PATCH] Fix regex for determining image width from attribute |
Date: |
Sun, 28 Nov 2021 16:23:02 -0800 |
Max Nikulin <manikulin@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 " 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
- Re: [PATCH] Fix regex for determining image width from attribute, (continued)
- Re: [PATCH] Fix regex for determining image width from attribute, Timothy, 2021/11/23
- Re: [PATCH] Fix regex for determining image width from attribute, Matt Huszagh, 2021/11/23
- Re: [PATCH] Fix regex for determining image width from attribute, Timothy, 2021/11/23
- Re: [PATCH] Fix regex for determining image width from attribute, Matt Huszagh, 2021/11/23
- Re: [PATCH] Fix regex for determining image width from attribute, Max Nikulin, 2021/11/23
- Re: [PATCH] Fix regex for determining image width from attribute, Matt Huszagh, 2021/11/23
- Re: [PATCH] Fix regex for determining image width from attribute, Max Nikulin, 2021/11/24
- Re: [PATCH] Fix regex for determining image width from attribute, Matt Huszagh, 2021/11/24
- Re: [PATCH] Fix regex for determining image width from attribute, Max Nikulin, 2021/11/24
- Re: [PATCH] Fix regex for determining image width from attribute, Max Nikulin, 2021/11/25
- Re: [PATCH] Fix regex for determining image width from attribute,
Matt Huszagh <=
- Re: [PATCH] Fix regex for determining image width from attribute, Timothy, 2021/11/29
- Re: [PATCH] Fix regex for determining image width from attribute, Matt Huszagh, 2021/11/30
- Re: [PATCH] Fix regex for determining image width from attribute, Max Nikulin, 2021/11/29
- Re: [PATCH] Fix regex for determining image width from attribute, Max Nikulin, 2021/11/22