After the first public display of Pitance, one of the initial weaknesses that Luke Hatcher mentioned was the lack of syntax highlighting. I suggested this was difficult because I was unaware of any Erlang-based1 lexer & formatting packages, making it rather hard.
Luke, on the other hand, suggested it was rather easy.
With that exchange in mind, I took a look at SyntaxHighlighter, which is a JavaScript based highlighting tool. It suited my needs pretty well, but was missing an Erlang lexer (well, lexer used in a very loose sense, since it is really just a collection of regular expressions).
I found an already made Erlang brush (SyntaxHighlighter term for lexer) courtesy of Steve Gilham, but had some trouble getting it working (perhaps his was based on SyntaxHighlighter version 1? Perhaps it was because he was operating in a different namespace? Perhaps I copied and pasted it incorrectly?), so rolled my own version.
You can see a highlighted template here.
SyntaxHighlighter.brushes.Erlang = function() {
this.regexList = [
{ regex: /<|\>/gm ,css: 'plain' },
{ regex: /[a-z](a-zA-Z0-9)*/gm, css: "color2"},
{ regex: /%(.*)$/gm, css: "comments"},
{ regex: /"(.*)"/gm, css: "string"},
{ regex: /[A-Z](\w*)/gm, css: "value"},
{ regex: /\??[A-Z][A-Z0-9]+/gm, css: 'keyword' }
];
}
SyntaxHighlighter.brushes.Erlang.prototype = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.Erlang.aliases = ['erlang', 'erl'];
You can grab the latest version of the Erlang brush on Pitance..
Pitance is Erlang all the way down, and to some reasonable extent I'd like to keep it that way.↩
Great to see an Erlang brush finally! I couldn't find any from the SyntaxHighlighter homepage and on an older (1.5) unmaintained version, someone said he started out, but that was all.
I've included your file in my compiled list of available SH brushes, but because your pages are all copyright protected, I'm not sure if that was allowed. Can you help me out? If you don't want it there, I'll immediately remove it, of course.
On this web site only some people will find superb things close to this topic. Thanks to you the the best sides of <a href="http://www.primewritings.com/blog/">blog</a> are provablefrank. I guess that after it is not really hard to receaive professional <a href="http://www.primewritings.com">custom essay writing</a> from essays writing firm.
And a small additional question: I see that Steve Gilham's original code contains a log of keywords and the like. I'm not an Erlang specialist, but should his and yours be combined to get the full version, or does yours work as a complete replacement for the original?
Reply to this entry