A python-based code-to-html syntax highlighter
The code is currently in very basic alpha status.
That means: use at your own risk.
pylite currently requires python 2.x, because of "import cgi" which is used to escape to html.
See INSTALL.
From the source:
Usage: pylite [-e <CSS>] [-i] [-s] [-p <PAT>] [-m <MSG>] <FILENAME>
where
-e <CSS> use specified external stylesheet CSS
-i use inline styles
-s output snippet
-p <PAT> force usage of pattern PAT
-m <MSG> display caption as "filename: MSG"
<FILENAME> the file to style
The default behaviour is to produce a full html5 webpage with embedded
stylesheet. The pattern is by default taken from the file extension.
By default no caption is displayed.
The output is sent to stdout.
$ cat simple.c
int main()
{
return 0;
}
$ pylite -m "" simple.c > simple.html
simple.c:
1 2 3 4 int main() { return 0; }
The code follows a very simple yacc/flex-like lexing format, where tokens are defined using regexes.
Lexing "states" are supported, so that multi-line regexes can be performed.
Output is simply <span>'ed as classes, letting the style.css take care of the appearance of the <pre>-formatted output.
See all TODOs in src/pylite.