mquinson / po4a

Maintain the translations of your documentation with ease (PO for anything)
http://po4a.org/
GNU General Public License v2.0
121 stars 58 forks source link

Maybe expand LaTex.pm #375

Open Mechtilde opened 1 year ago

Mechtilde commented 1 year ago

Hello,

I have an enhancement for the LaTeX format plugin.

I often use a plugin in for LaTeX to do literate programming "NoWeb" (e.g https://salsa.debian.org/ddp-team/dpb) Here I put an example.

in Noweb (File: Part3.nw, line 81-89) you see the start of a code chunk and at line 89(@) the end of the code chunk

<>= ##############

Here it starts

BuildApp

##############

This is the end, my friend

@

The text in between shouldn't be translatable.

In the TeX File I generate it shows like

\nwfilename{Part3.nw}\nwbegincode{1}\sublabel{NW4L0rMe-2dfaZH-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4L0rMe-2dfaZH-1}}}\moddef{MainProgram~{\nwtagstyle{}\subpageref{NW4L0rMe-2dfaZH-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\{NW4L0rMe-2uaRFM-1}}\nwenddeflinemarkup ##############

Here it starts

BuildApp

##############

This is the end, my friend

\nwused{\{NW4L0rMe-2uaRFM-1}}\nwendcode{}\nwbegindocs{2}\nwdocspar

As far as I know and use it. all other things are the same as in LaTeX. So I hope it is possible to extend the LaTeX plugin for NoWeb.

Kind regards

mquinson commented 1 year ago

If you plan to implement it, I'd be glad to assist you and guide you in the po4a source code. Writing a new module is not difficult in general, but the trick here is that the LaTeX module is one of the hardest one because it's able of interpreting most TeX commands to find the content to translate and appropriate configuration.

Maybe we should think of a composite module, that parses this format, constitute a LaTeX fragment, and feeds it to the existing po4a-latex module. I suspect that it would be easier than extending the latex module directly, but I may well be wrong: I didn't dive in that part of the code for at least a decade.

The bad news is I'm in maintenance mode for po4a since several years: I will not find the time to implement such thing myself, so it probably won't happen if you don't implement it yourself. Sorry about it.