Hi, A while ago Hans provided an example of typesetting a document from a docbook source.
I'm attaching an over-simplified version of the initial module (a somewhat more complete version exists, but it still needs lots of work) and a minimum working example with XML. I'm not sure how to extend the xml parser to support typesetting from something like this: <section xml:id="_hello_world_in_c_and_context"> <title>Hello World in C and ConTeXt</title> <programlisting language="cpp" linenumbering="unnumbered">#include <stdio.h> int main() { printf("Hello, World!\n"); return 0; }</programlisting> <programlisting language="context" linenumbering="numbered">\starttext Hello world! \stoptext</programlisting> </section> Maybe using the vim module would be the right approach here (since the built-in parser only has support for a limited set of languages), but I'm not exactly sure about the implementation to achieve that goal. I started with \startxmlsetups xml:programlisting \dontleavehmode \startframedtext[background=color,backgroundcolor=lightgray] \obeylines \tt \xmlflush{#1} \stopframedtext \stopxmlsetups but something more is needed to properly handle new lines and to properly pass the text to vim, for example. Any hints welcome. Thank you, Mojca
<?xml version="1.0" encoding="UTF-8"?> <?asciidoc-toc?> <?asciidoc-numbered?> <article xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en"> <info> <title>Syntax highlighting with AsciiDoc</title> <date>2020-11-30</date> </info> <section xml:id="_hello_world_in_c"> <title>Hello World in C</title> <programlisting language="cpp" linenumbering="unnumbered">#include <stdio.h> int main() { printf("Hello, World!\n"); return 0; }</programlisting> <programlisting language="context" linenumbering="numbered">\starttext Hello world! \stoptext</programlisting> </section> </article>
test-syntax-highlighting.tex
Description: Binary data
m-asciidoc-basic.tex
Description: Binary data
test-syntax-highlighting.adoc
Description: Binary data
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________