Wiki

Changes between Version 1 and Version 2 of PygmentsHighlighter

Show
Ignore:
Timestamp:
12/08/09 05:21:21 (15 years ago)
Author:
todd.a
Comment:

Updated for the new dotnet.py

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]. 
     1We 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]. 
    22 
    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 = 
     4The 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.  
    45 
    5 You might be interested in the [http://cobra-language.com/forums/viewtopic.php?f=4&t=74 entire forum topic] on it. 
     6If 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]. 
    67 
     8The following assumes that your main Pygments directory is named "pygments". 
     91. Change your directory to pygments/pygments/lexers 
     102. Overwrite the existing dotnet.py file with the file attached below 
     113. Execute the command "python _mapping.py" 
     12And you are all set. 
     13 
     14= Usage = 
     15Change your directory back to the Pygments root directory (in there you will see '''pygmentize'''). 
     16 
     17To 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 
     22Above 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 
     27By default the Cobra lexer will set the tabsize to 4 per Cobra public guidelines. 
     28 
     29How 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.