Files for verbatim output of Python source, zc.buildout and Apache config files
Hello, I'm using MKIV and needed syntax highlighting for a few source and config files. I read on the Wiki and on this list that it should be pretty easy to do this in Lua and although I never wrote anything in Lua I just tried it. Maybe the result will be of use for somebody so I'm posting them to this list. I read on the Wiki that the best place for putting custom formatter files would be the context distribution or http://modules.contextgarden.net but as I'm pretty sure that some stuff is missing and I'm sure there are some bugs included I'm just posting them here. Would it be OK to put the files in a section on the Wiki to start something like a repository for verb-*.lua files where it would be easy to extend and correct them? I have created verb-*.lua files for pretty printing Python source code Apache http.conf and zc.buildout config files. For the zc.buildout files I used a simple solution and just defined the keywords that appear in a standard Plone buildout.cfg file. I hope to finish two additional verbatim files for XML and Shell scripts in the next days. As I don't have any experience in writing Lua code I chose to use the tex/context/base/verb-*.lua and the verb-cpp.lua files posted by Shen Chen in http://archive.contextgarden.net/message/20081002.173802.460c46fe.en.html) for a start. Additionally I used the vim syntax files and the official Apache documentation. Here is an overview of what is covered: The verb-apa.lua file distinguishes between the following five states: - declarations - strings - sections (like <Directory> and </Directory>) - comments - options The verb-py.lua file distinguishes between the following five states: - all statements, repeats, conditionals and operators - strings (multi line comment wit ''' or """ are supported) - preconditions (import, from, as) - comments - builtins The verb-py.cfg file distinguishes between the following four states: - sections - variables - keywords - comments I've attached a minimal test file to show how they work. Just put everything in one directory and execute texexec --lua test.tex Regards, Drazen
participants (1)
-
Drazen Baic