From: Matt Huszagh <email@example.com> To: Max Nikulin <firstname.lastname@example.org>, email@example.com Subject: Re: [PATCH] Fix regex for determining image width from attribute Date: Sun, 28 Nov 2021 16:23:02 -0800 [thread overview] Message-ID: <firstname.lastname@example.org> (raw) In-Reply-To: <email@example.com> Max Nikulin <firstname.lastname@example.org> 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
next prev parent reply other threads:[~2021-11-29 0:23 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-21 19:08 Matt Huszagh 2021-11-21 19:20 ` Timothy 2021-11-21 19:51 ` Matt Huszagh 2021-11-22 8:29 ` Timothy 2021-11-22 16:11 ` Matt Huszagh 2021-11-22 17:54 ` Timothy 2021-11-22 20:53 ` Matt Huszagh 2021-11-23 4:59 ` Kyle Meyer 2021-11-23 5:14 ` Timothy 2021-11-23 5:38 ` Matt Huszagh 2021-11-23 5:39 ` Timothy 2021-11-23 7:46 ` Matt Huszagh 2021-11-23 16:44 ` Max Nikulin 2021-11-24 1:57 ` Matt Huszagh 2021-11-24 14:48 ` Max Nikulin 2021-11-24 15:59 ` Matt Huszagh 2021-11-24 17:00 ` Max Nikulin 2021-11-25 16:43 ` Max Nikulin 2021-11-29 0:23 ` Matt Huszagh [this message] 2021-11-29 5:13 ` Timothy 2021-12-01 3:24 ` Matt Huszagh 2021-12-01 4:54 ` Timothy 2021-12-03 2:06 ` Matt Huszagh 2021-11-29 12:15 ` Max Nikulin 2021-11-22 14:30 ` Max Nikulin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://www.orgmode.org/ * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: [PATCH] Fix regex for determining image width from attribute' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this 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).