Changes between Initial Version and Version 1 of HighlightingWithEnscript


Ignore:
Timestamp:
Sep 30, 2006, 3:46:00 AM (14 years ago)
Author:
orlov
Comment:

Processing Refal programs with enscript.

Legend:

Unmodified
Added
Removed
Modified
  • HighlightingWithEnscript

    v1 v1  
     1Script source:devel-tools/trunk/enscript/refal.st allows to color in Refal programs with [http://www.iki.fi/~mtr/genscript/ GNU Enscript].
     2
     3Just place it alongside other enscript highlighting scripts and use `-E refal` option to get pretty looking refal sources in !PostScript or html.  Also you can change `namerules` in `enscript.st` for automatically recognize refal programs by file extensions.  Insert a line like this:
     4{{{
     5/\.(ref|rf|rfi)$/        refal;
     6}}}
     7
     8Trac uses enscript for [wiki:TracSyntaxColoring syntax coloring] of source code.
     9See source:to-imperative/trunk/rfp/rfpj.rf#2095 for colored example of "real" Refal program.
     10
     11And you can insert blocks of colored Refal code in wiki text as with other WikiProcessors:
     12{{{
     13{{{
     14#!refal
     15$func Fab e.in = e.out;
     16
     17Fab {
     18  e1 'a' e2 = e1 'b' <Fab e2>;
     19  e1        = e1;
     20};
     21}}}
     22}}}
     23
     24Results in:
     25{{{
     26#!refal
     27$func Fab e.in = e.out;
     28
     29Fab {
     30  e1 'a' e2 = e1 'b' <Fab e2>;
     31  e1        = e1;
     32};
     33}}}
     34
     35To set up Refal syntax coloring in Trac a few changes in the Trac source code were required though.
     36 1. First, new mime type `text/x-refal` had to be added to `MIME_MAP` in `mimeview/api.py`.
     37    It was used for file extensions `.ref`, `.rf`, and `.rfi`, and also `refal` for `#!refal` code blocks could work as shown above (or else one could use just `#!ref` or `#!rf`).
     38 2. And that new mime type was mapped to `refal` language type for enscript in `mimeview/enscript.py`.