Re: [docutils:feature-requests] Re: #113 scale option in docutils.conf

"Karl O. Pinc" <[email protected]> Wed, 23 Apr 2025 17:32:18 -0500
Newsgroups gmane.text.docutils.devel
Message-ID <[email protected]>
On Wed, 23 Apr 2025 18:57:34 -0000
Günter Milde via Docutils-develop
<[email protected]> wrote:

> This approach would add a level of complexity that makes it more
> suitable for an extension or a custom HTML writer than for standard
> Docutils.
> 
> Some alternatives come to mind:
> 
> A "simple script" could also be used to pre-process the rST source or
> post-process the generated HTML to add image dimensions instead of
> generating sidecar files.

FWIW, I've used the m4 macro processor
(https://www.gnu.org/software/m4/m4.html) 
for pre-processing rST.  With plain-old macro text substitution it's 
hard to go wrong.  

It is easy to be seduced and utilize more
sophisticated m4 features, conditionals, calling out to shell,
and so forth, which can lead to over-engineering.
That said, utilizing ImageMagic, it should be easy to write a 
m4 macro that takes a path to an image and returns
(one of) the dimensions for substitution into the rsT source.

Regards,

Karl <[email protected]>
Free Software:  "You don't pay back, you pay forward."
                 -- Robert A. Heinlein


_______________________________________________
Docutils-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/docutils-develop

Please use "Reply All" to reply to the list.