Changes between Version 1 and Version 2 of PygmentsHighlighter
- Timestamp:
- 12/08/09 05:21:21 (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
PygmentsHighlighter
v1 v2 1 "TheManiac", as he's known on the forums, has created a [http://pygments.org/ Pygments]-based highlighter which is important because Pygments drives [http://pygments.org/projects/ other projects] such as [http://trac.edgewall.org/ Trac].1 We have morphed the original Cobra highlighter for [http://pygments.org/ Pygments] provided by "TheManiac" to include the very latest the the Cobra Programming language supports. TheManiac started this work, which is very important because Pygments drives [http://pygments.org/projects/ other projects] such as [http://trac.edgewall.org/ Trac]. Please find the forum discussion surrounding the earlier development at [http://cobra-language.com/forums/viewtopic.php?f=4&t=74#p363 specific forum post]. 2 2 3 There is a [http://cobra-language.com/forums/viewtopic.php?f=4&t=74#p363 specific forum post] on using it. 3 = Getting started with Pygments = 4 The most common scenario for using Pygments is converting source code to HTML. Cobra provides this support using the CobraLexer found in the dotnet.py file. dotnet.py is attached to this page. 4 5 5 You might be interested in the [http://cobra-language.com/forums/viewtopic.php?f=4&t=74 entire forum topic] on it.6 If you already have Pygments installed skip to the next paragraph, else install Pygments using one of the ways mentioned on the [http://pygments.org/download/ Pygments download page]. 6 7 8 The following assumes that your main Pygments directory is named "pygments". 9 1. Change your directory to pygments/pygments/lexers 10 2. Overwrite the existing dotnet.py file with the file attached below 11 3. Execute the command "python _mapping.py" 12 And you are all set. 13 14 = Usage = 15 Change your directory back to the Pygments root directory (in there you will see '''pygmentize'''). 16 17 To convert a Cobra source file to HTML use the following command: 18 {{{ 19 ./pygmentize -l cobra -f html -O full,style=colorful -o <output filename>.html <input file>.cobra 20 }}} 21 22 Above the '''-l''' option specifies the input language--Cobra in this case--and, the '''-f''' option specifies the output format. Pygments is able to infer the language and output formats when an applicable extension is used for the output file and input filenames, respectively. The above could be shortened to: 23 {{{ 24 ./pygmentize -O full,style=colorful -o <output filename>.html <input file>.cobra 25 }}} 26 27 By default the Cobra lexer will set the tabsize to 4 per Cobra public guidelines. 28 29 How do I list all the available styles and output formats? How do I change the input/output encoding? For these and other questions consult the [http://pygments.org/docs/cmdline/ Pygments command line help] web page.