Benoit BALON - 2008-07-08

Hi,

I added the support of diff output, which was not supported yet in CodePress. It's not perfect, but the CodePress team can be interested in including those files (JS + CSS) to the languages directory, maybe after performing my code a little bit... What do you think about it ?

This is the code for the diff.js file :
***************************************

/*
* CodePress regular expressions for DIFF syntax highlighting
*/

// DIFF
Language.syntax = [
    { input : /([0-9,]*)(c|d|a)([0-9,]+)(<br|<\/P)/g,output : '<lines>$1$2$3</lines>$4' },
    { input : /(>)(\-{3})(<br|<\/P)/g,output : '$1<separator>$2</separator>$3'},
    { input : /(>)(&lt;.+?)(<br|<\/P)/g,output : '$1<before>$2</before>$3'},
    { input : /(>)(&gt;.+?)(<br|<\/P)/g,output : '$1<after>$2</after>$3' },
    { input : /(Common subdirectories.+?)(<br|<\/P)/g,output : '<common>$1</common>$2' },
    { input : /(Only in )(.+?)(: )(.+?)(<br|<\/P)/g,output : '<onlyin>$1$2$3$4</onlyin>$5' },
    { input : /(diff )(.+?)( )(.+?)(<br|<\/P)/g,output : '<diff>$1$2$3$4</diff>$5' }
]

Language.snippets = []

Language.complete = []

Language.shortcuts = []

And here the code for the diff.css file :
*****************************************

/*
* CodePress color styles for DIFF syntax highlighting
*/

separator
{
    color: black;
}

before
{
    color: blue;
    font-size: 8pt;
}

after
{
    color: red;
    font-size: 8pt;
}

lines
{
    color: black;
    text-decoration: underline;
    font-weight: bold;
    font-size: 10pt;
}

common
{
    color: green;
    font-size: 10pt;
}

onlyin
{
    color: red;
    background-color: white;
    font-weight: bold;
    font-size: 10pt;
}

diff
{
    color: red;
    background-color: yellow;
    font-weight: bold;
    font-size: 10pt;
}

Cordially,
Benoit BALON.