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 tried to post them to this
list a few days ago but the mail never showed up. Maybe because of the
attachment size.

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 tried to post 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?

The verb-*.lua files I created are for syntax highlighting of 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 as I didn't need more. 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

Regards,
Drazen
___________________________________________________________________________________
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to