Python Desktop Server Weblog 26.1.2004

a picture of myself

Münsterland.org

2004-01-26

Source code highlighting for more than just Python

There is a new dependency in PyDS - the SilverCity source highlighting component. This allows you to have codeblocks with highlighted sourcecode for all languages that are supported by SilverCity. The directive is code-block and you need to give one parameter, the language.

Supported language modules with SilverCity 0.9.5 are: Perl, Ruby, Python, CPP (for C and C++), CSS, SQL, XML, XSLT, HyperText (html with embedded ASP languages like VBScript!) and YAML. Many similar languages can be rendered with one of those renderers (like C or C++ headers).

An example in C (if you use the code-block directive, you probably need to bracket it in raw .. end raw cheetah directives because of the include statements in C or C++ or the comments in Python or Perl):

#include <stdio.h>

void main(int argc, char **argv) {
  
printf("Hello World\n");
}

Thanks go to Roberto Alsina for his pointer to an ASPN article that showed how to do it.

If you want to use this feature, it is currently only in CVS. You need to make changes to your stylesheet, too (there are several classes for the syntax highlighting). The styles that need to be added are in CVS as silvercity.css (they are merged into the default pyds.css, too). Of course you need to install the SilverCity module, too.

For Debian users there are new packages at the http://simon.bofh.ms/~gb/debian-dev/ repository.

This post references topics: python python_desktop_server
posted at 11:35:44    #
January 2004
MoTuWeThFrSaSu
    1 2 3 4
5 6 7 8 91011
12131415161718
19202122232425
262728293031 
Dec
2003
 Feb
2004

This is the Python Desktop Server weblog.


(Donations will be used by the author to buy stuff, fullfill selfish wishes or do other silly recreational things. You have been warned.).
The PyDS is
OSI Certified Open Source Software

Python Powered

XML-Image

© 2004-2007, Georg Bauer