On Thu, Nov 21, 2024 at 08:05:46AM +0200, Eli Zaretskii wrote: > Thanks, but I don't think I understand why you need a new variable. > Just teach texi2any that some specially-formatted value of > HIGHLIGHT_SYNTAX means to use whatever program is specified by the > value. For example, if the value is "(SOMETHING)", then SOMETHING is > the shell command to use. We could also have placeholders for > command-line arguments, e.g. "(SOMETHING %i %o)" means invoke > SOMETHING with a single command-line argument where %i is substituted > by the name of a file with the code to be highlighted ("input") and %o > with the name of the file to write the results ("output"). Or some > other similar convention that is unlikely to conflict with the > already-existing values.
I agree, it would be better to use HIGHLIGHT_SYNTAX. If the value is not a known value, then the command would be called. I prefer a called with fixed informations rather than %X arguments replacement. That means that users would have to use wrappers to translate the arguments to a command doing the highlighting, but that does not seems to be an issue to me. There are two modes for HIGHLIGHT_SYNTAX. Pass fragments on stdin and get results on stdout. In that case, I think that the only argument should be the $language. The other possibility is to go through input and output files, with fragments to be highlited separated by _______________________ $counter\n line ranges passed on the command line and the output files is supposed to use a range separator passed on the command line. In that case, more arguments should be passed, the language, the input and output files, the line ranges and the range separator. I think that it would be better to be able to specify which mode is used, probably with a customization variable. Maybe using a user-specified command could be first implemented for the first mode only. Carlos, do you want to have a try? Since the patch will not be small, you'll have to do a Copyright assignment with the FSF if you do not have already. > P.S. Btw, why wasn't this feature announced in any NEWS file? AFAICT, > it exists since Texinfo 6.8, but is not mentioned in NEWS. Perhaps it > should be mentioned in NEWS of the next release? It was not considered stable for now, I think it is why it was not in the NEWS at the beginning. Now it could be because we forgot... -- Pat