On Sun, Sep 14, 2025 at 09:28:39PM +0200, Patrice Dumas wrote:
> On Sun, Sep 14, 2025 at 07:04:48PM +0100, Gavin Smith wrote:
> > On Sun, Sep 14, 2025 at 04:47:40PM +0200, Patrice Dumas wrote:
> > > Right now, with the development sources, you could call texi2any like:
> > > 
> > > ./texi2any.pl --html -c HIGHLIGHT_SYNTAX='pygmentize -f html -l ' 
> > > maxima.texi
> > > 
> > > to get the output you want (if I understood well).
> > > 
> > > Subject to change until an agreement is reached on the interface.
> >
> > Is the language name automatically appended to the value of 
> > HIGHLIGHT_SYNTAX?
> 
> Yes.
> 
> > I think we should use a placeholder like %s so it would look like
> > 
> > -c HIGHLIGHT_SYNTAX='pygmentize -f html -l %s'
> 
> I find the appendend language simpler, but that could be ok too.  We
> probably would also need a way to escape %, or % followed by s.

Yes, it should be %% to get % (as in printf template strings).  % followed
by a character other than % or s could give a warning (although it is
not a big deal as % is unlikely to occur in a command line).

I like the idea of a placeholder rather than simply appending the
language because it allows the language not to be at the end of the
command; it also avoids the awkward space at the end of the value as in
'pygmentize -f html -l '; and it also makes it clear to anybody looking
at the commmand line (e.g. in a Makefile) that text is being substituted,
without looking at the documentation of texi2any.  They can probably guess
easily how it works if they know anything about the invocation of the
highlighting program.

I'm fine with overloading HIGHLIGHT_SYNTAX (as it is currently) - special
options are recognised ("highlight", "pygments" and "source-highlight"),
and if the value is not in this list, it is used as a template for a command.

This could make it easier to change, for example somebody could change
the value of HIGHLIGHT_SYNTAX in a Makefile from "pygments" to
"pygmentize -l %s -O noclasses=True,style=github-dark" without needing
to lookup what the customisation variable should be changed to (another
reason why the %s is good to use is it makes such template values more
distinctive from specially recognized values).

Reply via email to