[chora] Adding new language types for enscript

Ahmed ashihab@alcahest.com
Mon, 11 Feb 2002 18:40:16 +0000


Jan,

> If you really have the latest Horde code (extensions for enscript
> files 
> were added three days ago) you probably have no entry for the vhdl
> files in 
> mime_mapping.php.

I've added the vhd extension to /horde/config/mime_driver.php as 
follows:

/* Location of the enscript binary. */
$mime_drivers['horde']['enscript']['location'] 
= '/usr/local/bin/enscript';
$mime_drivers['horde']['enscript']['inline'] = true;
$mime_drivers['horde']['enscript']['handles'] = array(
    'text/html',
    'x-extension/pl',
    'x-extension/c',
    'text/xml',
    'application/x-sh',
    'application/x-javascript',
    'x-extension/java', 
    'x-extension/h', 
    'x-extension/cpp',
    'x-extension/vhd');
    
$mime_drivers['horde']['enscript']['icons'] = array(
    'default'          => 'text.gif',
    'text/html'        => 'html.gif',
    'text/xml'         => 'xml.gif',
    'x-extension/c'    => 'source-c.gif',
    'x-extension/h'    => 'source-h.gif',
    'x-extension/java' => 'source-java.gif',
    'x-extension/vhd'  => 'source-c.gif');

in the CVS listing I get the correct icon, but get the C language 
syntax highlighting, not VHDL. This is only natural since the 
enscript driver PHP file specifically calls enscript with the 
langauge set to 'C' with '-Ec' option:

        /* Execute the enscript command */
        exec(escapeShellCmd($mime_drivers['horde']['enscript']
['location'] . " -Ec --color -Whtml -p$tmpout $tmpin"));

simple way to check it out it to create a file with the lines

---- snip
-- this is a VHDL comment
-- so is this
---- snip

if you change the -Ec to -Evhdl you get the correct syntax 
highlighting!

or am I barking up th wrong tree?

Ahmed...