Yes, I wish to convert from latex to xml. I don't know much about pandoc filters and lua but they seem cool. I will see if I can get this to work.
On Thursday, May 30, 2019 at 1:38:40 PM UTC-4, John MacFarlane wrote:
John MacFarlane <j...-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
> Umut Acar <umut...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
>> Indeed, it works for quite a few standard languages but are custom language
>> definitions supported? In markdown -->html conversion via custom XML
>> spec's (Kate) seems possible. I got good results with that. Is this not
>> supported for LaTeX --> html?
>
> To be clear, do I understand correctly that you're
> converting from LaTeX to HTML, and you want LaTeX
> lstlistings environments to be converted with
> highlighting?
>
> That will work with recognized languages (those that
> lstlisting environment supports). And you can make
> it work with unrecognized languages, by using a filter.
> Note:
>
> % pandoc -f latex -t native
> \begin{lstlisting}[language=foobar]
> hi = 3
> \end{lstlisting}
> ^D
> [CodeBlock ("",[],[("language","foobar")]) "hi = 3"]
>
> What you need to do highlighting (using
> --syntax-definitio=foobar.xml) is rather
>
> [CodeBlock ("",["foobar"],[]) "hi = 3"]
>
> The solution is to use a simple lua filter
> that finds code blocks with a language attribute and
> makes its value a class.
Ultimately we may want to change pandoc so it
recognizes a language attribute if there is no
relevant class (feel free to put up an issue
about this), but this will work for now.