new source code formatting option

"Anton van Straaten" <[email protected]>
Newsgroups gmane.lisp.scheme.plt.schematics
Message-ID <[email protected]>
On the twiki site, I've installed a better Scheme code formatter, adapted
from Dorai Sitaram's TeX2page.  It deals with many more features of Scheme
than the current Enscript-based approach does, including recognizing many
more keywords, highlighting library functions, understanding character
constants, supporting the block comment syntax, etc.  It also has the
benefit that it uses a CSS stylesheet, rather than hardcoding the colors
into the HTML, so it will support customization via skins.

I've integrated it into the same SyntaxHighlighterPlugin that we've been
using.  It can currently be invoked using %begin scm%, instead of %begin
scheme%.  The latter currently still invokes enscript.  If everyone likes
the idea, I'll switch it so that %begin scheme% will invoke the new
formatter, which will cause the existing pages to use it automatically.

You can see the new formatter in action on the following pages:
http://shizuku.appsolutions.com/twiki/bin/view/Sandbox/ScmToXexpr
http://shizuku.appsolutions.com/twiki/bin/view/Sandbox/CodeFormatting

The latter page shows the new format as well as the same code formatted with
Enscript.

The only thing that I think could be considered a possible drawback of the
new system is that it doesn't highlight defined procedure names, the way
Enscript does.  Enscript highlights the name of anything defined with
'define'.  It shouldn't be difficult to add that feature to the new
formatter, though, if we want it.  Having the source in Scheme will make
changes like that easier.

This also acts as a proof of concept for integrating Scheme-generated
content with Twiki pages.  The way I've set this up is that the Twiki
formatter plugin retrieves Scheme-generated content using an HTTP request to
a local PLT servlet.  It seems to work fine (although consider it in beta
testing right now).  It may be more efficient than shelling out to Enscript,
since the PLT web server is running all the time, and doesn't have to be
launched on every request.

This opens the door to using Scheme to do other processing of the Cookbook
content.  Instead of being at the mercy of all the Twiki plugins implemented
in Perl, we can implement things in Scheme, and use our own tags on the
Twiki pages to invoke them.

I had said I would write up something to address the planning questions that
have been raised.  I'll still do that over the next couple of days.

Anton



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.