Re: [PATCH] Fix regex for determining image width from attribute

2024-05-13 Thread Ihor Radchenko
Max Nikulin writes: >>> I think, it is better to avoid "is ignored" here. >> >> May you convert your suggestion into a patch? > > See the attachment. > From 7bc9d909867bf2f99a77d5d1554cd41e4fc664ae Mon Sep 17 00:00:00 2001 > From: Max Nikulin > Date: Thu, 9 May 2024 17:32:54 +0700 > Subject:

Re: [PATCH] Fix regex for determining image width from attribute

2024-05-13 Thread Ihor Radchenko
Max Nikulin writes: > I ma afraid, the code is a bit fragile. Consider > > #+attr_html: :alt Image width test > #+attr_beamer: :width \linewidth > #+attr_latex: :width +.5\textwidth > #+attr_md: :width 75% > [[file:babelfish.png]] > > - It is really confusing that #+attr_html casts shadow on

Re: [PATCH] Fix regex for determining image width from attribute

2024-05-09 Thread Max Nikulin
On 08/05/2024 17:54, Ihor Radchenko wrote: Max Nikulin writes: #+attr_html: :alt Image width test #+attr_beamer: :width \linewidth #+attr_latex: :width +.5\textwidth #+attr_md: :width 75% [[file:babelfish.png]] - I do not mind that just "\linewidth" is ignored. - The case of "+.5" should

Re: [PATCH] Fix regex for determining image width from attribute

2024-05-08 Thread Ihor Radchenko
Max Nikulin writes: >> 1. #+attr_org is prioritised > > I ma afraid, the code is a bit fragile. Consider > > #+attr_html: :alt Image width test > #+attr_beamer: :width \linewidth > #+attr_latex: :width +.5\textwidth > #+attr_md: :width 75% > [[file:babelfish.png]] > > - I do not mind that just

Re: [PATCH] Fix regex for determining image width from attribute

2024-05-08 Thread Max Nikulin
On 02/05/2024 23:28, Ihor Radchenko wrote: 1. #+attr_org is prioritised I ma afraid, the code is a bit fragile. Consider #+attr_html: :alt Image width test #+attr_beamer: :width \linewidth #+attr_latex: :width +.5\textwidth #+attr_md: :width 75% [[file:babelfish.png]] - I do not mind that

Re: [PATCH] Fix regex for determining image width from attribute

2024-05-06 Thread Karthik Chikmagalur
> 1. #+attr_org is prioritised > 2. Docstrings are updated > > Handled, on main. > https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=fede1c990 Just a note that we already prioritize #+attr_org when aligning/centering images. So this change makes sense. Karthik

Re: [PATCH] Fix regex for determining image width from attribute

2024-05-02 Thread Ihor Radchenko
Matt Huszagh writes: >> Thanks for continuing with this. Moving forward, I think it would be best to: >> ⁃ Make a patch just for prioritising `#+attr_org' >> ⁃ Make a patch just improving the regex (before or after the `#+attr_org' >> patch) > ... >> Lastly, a comment on your documentation

Re: [PATCH] Fix regex for determining image width from attribute

2021-12-02 Thread Matt Huszagh
Timothy writes: > Thanks for your thoughtful deliberation on this. No worries, and thanks for continuing to engage with it. >> The other consideration is if we take the first point as a given (that >> org should use width directives for other backends), should it also >> attempt to interpret

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-30 Thread Timothy
Hi Matt, Thanks for your thoughtful deliberation on this. > I think the essential disagreement is whether org should take an action if not > explicitly told to do so. I think org should only perform some action if given > a clear directive. In this context, I feel that org is guessing what the

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-30 Thread Matt Huszagh
Timothy writes: > What would be a more sensible interpretation in your mind? The “true” value > depends on the number of columns, and fetching that information seems a bit > unreasonable. Since this isn’t just used if nothing else if given, I see a > 120% > interpretation as fairly reasonable.

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-29 Thread Max Nikulin
On 29/11/2021 07:23, Matt Huszagh wrote: Max Nikulin writes: 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. I can probably

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-28 Thread Timothy
Hi Matt, > 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 What would be a more sensible interpretation in your mind? The “true” value depends on the number of columns, and

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-28 Thread Matt Huszagh
Max Nikulin writes: > I am confused. I can not figure out how to create the following as HTML > export result: > > > > Attempt to add quotes leads to and does not prevent ":width" to > become another attribute. > >#+attr_html: :alt An image without :width 600 attribute >

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-25 Thread Max Nikulin
On 25/11/2021 00:00, Max Nikulin wrote: On 24/11/2021 22:59, Matt Huszagh wrote: I am sorry that I confused you by my note concerning space before :width. I am afraid, current variant means repeated ":" +  (concat "^[ \t]*#\\+attr_" +  backend

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-24 Thread Max Nikulin
On 24/11/2021 22:59, Matt Huszagh wrote: Better? Certainly. I have not tested the patch though. I am sorry that I confused you by my note concerning space before :width. I am afraid, current variant means repeated ":" + (concat "^[ \t]*#\\+attr_" +

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-24 Thread Matt Huszagh
Max Nikulin writes: > This is related solely to docscring. > >> +that is not found, use the first #+ATTR_.*:width specification. > > I am unsure how to make this phrase more clear, maybe something like > "use :width value from the first #+ATTR_,*" or even "#+ATTR_xxx" to > avoid ".*". > >> +

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-24 Thread Max Nikulin
On 24/11/2021 08:57, Matt Huszagh wrote: Max Nikulin writes: I may be wrong, but it seems both the old and the new regexps match #+attr_html : :width 50% that is not a keyword due to a space before ":". The dot in the regexp is too permissive. I agree. Despite ".*" includes ": "

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-23 Thread Matt Huszagh
Max Nikulin writes: > I may be wrong, but it seems both the old and the new regexps match > > #+attr_html : :width 50% > > that is not a keyword due to a space before ":". The dot in the regexp > is too permissive. I agree. > Despite ".*" includes ": " before ":width", I would prefer

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-23 Thread Max Nikulin
On 23/11/2021 14:46, Matt Huszagh wrote: Here are two patches that prioritize attr_org over other attr_ keywords. I believe this is what you had in mind Timothy. But let me know if not. diff --git a/lisp/org.el b/lisp/org.el index 308bb7d51..bf5d08e09 100644 --- a/lisp/org.el +++

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-22 Thread Matt Huszagh
Here are two patches that prioritize attr_org over other attr_ keywords. I believe this is what you had in mind Timothy. But let me know if not. The second patch (intended to be applied after the first) improves the documentation. It describes behavior that wasn't previously documented and

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-22 Thread Timothy
Hi Matt, (sigh) well that’s silly. Thanks, I’ve just pushed that. All the best, Timothy

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-22 Thread Matt Huszagh
Timothy writes: > This issue and Kyle’s change were resolved in another thread, just FYI this is > fixed now. Thanks for mentioning it. There is just one small residual error I could find. This patch fixes it. Matt >From 3724b5bcadab6900367848dadcf470494b5b0d79 Mon Sep 17 00:00:00 2001 From:

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-22 Thread Timothy
Hi Matt, This issue and Kyle’s change were resolved in another thread, just FYI this is fixed now. Thanks for mentioning it. All the best, Timothy

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-22 Thread Kyle Meyer
Matt Huszagh writes: > Timothy writes: > >> I’ve just pushed the change I described in 4514a32. This improves the >> interpretation of :width attributes and makes a value of “t” work as >> discussed. >> I have not prioritised #+attr_org for now, but that sounds like a change we >> could make in

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-22 Thread Matt Huszagh
Timothy writes: > I’ve just pushed the change I described in 4514a32. This improves the > interpretation of :width attributes and makes a value of “t” work as > discussed. > I have not prioritised #+attr_org for now, but that sounds like a change we > could make in the future. Thanks Timothy.

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-22 Thread Timothy
Hi Matt, I’ve just pushed the change I described in 4514a32. This improves the interpretation of :width attributes and makes a value of “t” work as discussed. I have not prioritised #+attr_org for now, but that sounds like a change we could make in the future. All the best, Timothy

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-22 Thread Matt Huszagh
Timothy writes: > Actually, it’s almost possible with the current implementation. Consider this > example: > ┌ > │ #+attr_org: :width t > │ #+attr_html: :width 20% > │ [[file:image.png]] > └ > > At the moment Org tries to interpret `t' as a number (and obviously fails), > however with a

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-22 Thread Max Nikulin
On 22/11/2021 02:51, Matt Huszagh wrote: Maybe a solution to accomplish all goals would be to add an #+attr_fallback (or attr_default, attr_any, attr_all, etc.) that is used for any backend unless a specific setting is made for that backend. Then it is necessary make all backends aware of

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-22 Thread Timothy
Hi Matt, > Unfortunately, I think this makes a valid use case > impossible. Specifically, I like to be able to set an image width > explicitly with #+attr_org (or some other attr_ for the corresponding > export) and fall back to the actual image width when this isn’t > specified. This includes

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-21 Thread Matt Huszagh
Timothy writes: > Once again, thank you for the patch. The fact that the current regexp matches > `#+attr_latex' and `#+attr_html' is in fact by design though*. This is > because I > consider it safe to assume that a `#+attr_*' which gives non-integer width > between > 0 and 2 can be safely

Re: [PATCH] Fix regex for determining image width from attribute

2021-11-21 Thread Timothy
Hi Matt, > A recent patch started computing the inline image width from any attr_ > line. This is incorrect, as it matches settings like attr_latex, or > attr_html. We only want to look for settings specifically for the org > buffer. This patch fixes that. Once again, thank you for the patch.

[PATCH] Fix regex for determining image width from attribute

2021-11-21 Thread Matt Huszagh
Hi, A recent patch started computing the inline image width from any attr_ line. This is incorrect, as it matches settings like attr_latex, or attr_html. We only want to look for settings specifically for the org buffer. This patch fixes that. Thanks Matt >From