From 7fe32640e6676d4ef51d69b6df367c46312a3576 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Fri, 7 Feb 2014 00:35:22 -0500 Subject: [PATCH] misc: added brush for SyntaxHighlighter JS script SyntaxHighlighter is an open source Javascript client side code syntax hilighter. More details on http://alexgorbatchev.com/SyntaxHighlighter/ Signed-off-by: Alexandre Terrasa --- misc/README | 10 +++++++ misc/syntaxhighlighter/shBrushNit.js | 52 ++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 misc/syntaxhighlighter/shBrushNit.js diff --git a/misc/README b/misc/README index 5166943..6f19e2c 100644 --- a/misc/README +++ b/misc/README @@ -1,6 +1,16 @@ # gtksourceview (gedit and other GTK editors) To install in your home, just link (or copy) the language definition file in ~/.local/share/gtksourceview-2.0/language-specs +# syntaxhighlighter + +Nit brush for the Alex Gorbatchev's JS syntaxhighlighter. + +To install the JS syntaxhighlighter, please refer to http://alexgorbatchev.com/SyntaxHighlighter/ + +Then can add the brush to your html page: + + + # vim vim is a powerful text editor. diff --git a/misc/syntaxhighlighter/shBrushNit.js b/misc/syntaxhighlighter/shBrushNit.js new file mode 100644 index 0000000..e9d1f78 --- /dev/null +++ b/misc/syntaxhighlighter/shBrushNit.js @@ -0,0 +1,52 @@ +/* This file is part of NIT ( http://www.nitlanguage.org ). + + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + + * http://www.apache.org/licenses/LICENSE-2.0 + + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Nit Brush for SyntaxHighlighter + * see http://alexgorbatchev.com/SyntaxHighlighter + */ + +;(function() +{ + // CommonJS + typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; + + function Brush() + { + var keywords = 'abort abstract and as assert break class continue do else end enum extern false for fun' + + 'if import in init interface intrude is isa isset label loop module new null nullable not' + + 'once or protected private redef return self super then type true universal var' + + 'when while writable'; + var builtins = 'exit sys args get_time getc getcwd gets print printn'; + + this.regexList = [ + { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings + { regex: /\b[A-Z0-9_]+\b/g, css: 'constants' }, // types + { regex: /[A-Z][A-Za-z0-9_]*/g, css: 'color2' }, // classes + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords + { regex: new RegExp(this.getKeywords(builtins), 'gm'), css: 'color3' } // builtins + ]; + this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); + }; + + Brush.prototype = new SyntaxHighlighter.Highlighter(); + Brush.aliases = ['nit']; + + SyntaxHighlighter.brushes.Nit = Brush; + + // CommonJS + typeof(exports) != 'undefined' ? exports.Brush = Brush : null; +})(); + -- 1.7.9.5