Hi,

Hans helped me out with some asciidoc processing a while ago.

I played a bit further, but I'm currently facing two minor issues:

(a) I don't know how to turn program listing (verbatim code) from xml
to (perhaps, vim-based) syntax highlighting (but most importantly, to
make sure that line breaks work properly)

(b) some section titles are missing


Ad (a). The source that looks similar to this:

<programlisting language="cpp" linenumbering="unnumbered">
int main()
{
    return 0;
}
</programlisting>

should be converted into some kind of equivalent of

% on top
\usemodule[vim]
\definevimtyping [CPP] [syntax=cpp]

\startCPP
int main()
{
    return 0;
}
\stopCPP

In the attachment I have the source document (test.adoc), the
generated docbook xml that should be further processed, and test.tex
that one processes to get the final pdf.

Any hints would be greatly appreciated.

Mojca

Attachment: test.tex
Description: Binary data

Attachment: test.adoc
Description: Binary data

<?xml version="1.0" encoding="UTF-8"?>
<?asciidoc-toc maxdepth="4"?>
<?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>Document title (completely missing)</title>
<date>2022-08-12</date>
</info>
<section xml:id="_this_title_seems_to_be_missing">
<title>This title seems to be missing</title>
<simpara>Hello code &#8230;&#8203;</simpara>
<section xml:id="_how_it_works">
<title>How it works</title>
<programlisting language="cpp" linenumbering="unnumbered">// test.cpp:

halfword tex_copy_node(halfword p)
{
    /*tex
        We really need a stub for copying because mem might move in the meantime due to resizing!
    */
    if (p &lt; 0 || p &gt;= lmt_node_memory_state.nodes_data.allocated) {
        return tex_formatted_error("nodes", "attempt to copy an impossible node %d", (int) p);
    } else if (p &gt; lmt_node_memory_state.reserved &amp;&amp; lmt_node_memory_state.nodesizes[p] == 0) {
        return tex_formatted_error("nodes", "attempt to copy a free %s node %d", get_node_name(node_type(p)), (int) p);
    } else {
        /*tex type of node */
        halfword t = node_type(p);
        int i = get_node_size(t);
        /*tex current node being fabricated for new list */
        halfword r = tex_get_node(i);
        /*tex this saves work */
        memcpy((void *) (lmt_node_memory_state.nodes + r), (void *) (lmt_node_memory_state.nodes + p), (sizeof(memoryword) * (unsigned) i));
        if (tex_nodetype_is_complex(i)) {
         // halfword copy_stub;
            if (tex_nodetype_has_attributes(t)) {
                add_attribute_reference(node_attr(p));
                node_prev(r) = null;
                lmt_properties_copy(lmt_lua_state.lua_instance, r, p);
            }
            node_next(r) = null;
            switch (t) {
                case glue_node:
                    copy_sub_list(glue_leader_ptr(r), glue_leader_ptr(p));
                    break;</programlisting>
</section>
</section>
</article>

Attachment: m-asciidoc-manual.tex
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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

Reply via email to