Changes

Jump to navigation Jump to search
m
\dostartdedentedtyping}
\protect</texcode>
The above macro works for simple cases, but there are some limitations. For example, there is an extra space of <code>\n</code> in the output. This macro will also fail if the contents have unbalanced braces (try removing the <code>}</code> from the example).
A more robust solution is to use ConTeXt's built in support for buffers. Using buffers, the above macro can be written as
)
}}</texcode>
Unlike MkII, where the contents of a buffer were written to an external file, in MkIV buffers are stored in memory. Thus, with LuaTeX is really simple to manipulate verbatim text: pass the contents of the environment to Lua; use Lua functions to do the text-manipulation; and in Lua call [[cld|<code>context.something()</code> ]] functions to produce the ConTeXt code you want.
= Conclusion =
188

edits

Navigation menu