Cfengine3 lexer for Pygments
I have written a Cfengine3 lexer for Pygments, the open source syntax-highlighter used by Gist and many other sites. It seems to work fine on all the cfengine policy files I have tested, but if you find anything that doesn't quite work as expected, please let me know. This is my first-ever Pygments lexer, so if you are an expert and can advise me on better ways of doing things, I'd very much appreciate the feedback too.
Update: Since version 1.5, Pygments includes this lexer. If you are using 1.5 or later, you already have the CFEngine lexer. You can sometimes find a newer version of the lexer in my fork of the Pygments project (updates are infrequent, only when there are changes in the CFEngine language).
- Obtain the Pygments source code.
- Put the pygments_cfengine_lexer.py file into the pygments/lexers/ directory
- run (cd pygments/lexers; python _mapping.py)
- run ./setup.py install
If you already have Pygments installed, you should follow these instructions:
- Put the pygments_cfengine_lexer.py file in the installed pygments/lexers/ directory (on my Mac, this is /Library/Python/2.6/site-packages/Pygments-1.4-py2.6.egg/pygments/lexers, under Linux it should be something like /usr/lib/python2.6/site-packages/Pygments..../pygments/lexers)
- cd into that directory
- run "python _mapping.py"
Then run pygmentize on any .cf file, and it should output properly highlighted code. You can view a sample here.
- Limited Time Promotion! 50% off "Learning CFEngine 3"
- New Release of "Learning CFEngine 3"
- CFEngine talks at PICC'12 conference
- Learning CFEngine 3 has been released
- CFEngine posts moving to cf-learn.info
- cf-cmd: A command-line tool for running CFEngine snippets
- New website for "Learning CFEngine 3"
- "Learning CFEngine 3" Early Release now available -use AUTHD to get 40-50% off
- "Security in the Third Wave of IT Engineering"
- What's New in CFEngine 3: Making System Administration Even More Powerful - O'Reilly Radar
- "Introduction to CFEngine 3 Nova" webinar
- New job, new book
- Installing cfengine on Mac OS X
- Editing sshd configuration files with cfengine3
- Storing CFEngine configuration in CVS
- Hierarchical copying with cfengine3
- The State of Open Source System Automation
- Editing whitespace-separated config files with cfengine
- cfengine Community Open Promise Body Library on GitHub
- Detecting NICs that match certain IP addresses
- Implementing "single-copy nirvana" in cfengine3
- Installing cfengine on Windows 7 under cygwin