|
| 1 | +/** |
| 2 | + * SyntaxHighlighter |
| 3 | + * http://alexgorbatchev.com/SyntaxHighlighter |
| 4 | + * |
| 5 | + * SyntaxHighlighter is donationware. If you are using it, please donate. |
| 6 | + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html |
| 7 | + * |
| 8 | + * @version |
| 9 | + * 3.0.83 (Wed, 16 Apr 2014 03:56:09 GMT) |
| 10 | + * |
| 11 | + * @copyright |
| 12 | + * Copyright (C) 2004-2013 Alex Gorbatchev. |
| 13 | + * |
| 14 | + * @license |
| 15 | + * Dual licensed under the MIT and GPL licenses. |
| 16 | + */ |
| 17 | +(function () { |
| 18 | + // CommonJS |
| 19 | + SyntaxHighlighter = |
| 20 | + SyntaxHighlighter || |
| 21 | + (typeof require !== "undefined" |
| 22 | + ? require("shCore").SyntaxHighlighter |
| 23 | + : null); |
| 24 | + |
| 25 | + function Brush() { |
| 26 | + var keywords = |
| 27 | + "bool break byte case chan complex128 complex64 const continue default defer else " + |
| 28 | + "fallthrough float32 float64 for func go goto if import int int16 int32 int64 int8 " + |
| 29 | + "interface map package range return rune select string struct switch type uint " + |
| 30 | + "uint16 uint32 uint64 uint8 uintptr var"; |
| 31 | + var funcs = |
| 32 | + "append cap close complex copy imag len make new panic print println real recover delete"; |
| 33 | + var special = "true false iota nil"; |
| 34 | + |
| 35 | + this.regexList = [ |
| 36 | + { |
| 37 | + regex: SyntaxHighlighter.regexLib.singleLineCComments, |
| 38 | + css: "comments", |
| 39 | + }, // one line comments |
| 40 | + { regex: /\/\*([^\*][\s\S]*?)?\*\//gm, css: "comments" }, // multiline comments |
| 41 | + { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: "preprocessor" }, // documentation comments |
| 42 | + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: "string" }, // strings |
| 43 | + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: "string" }, // strings |
| 44 | + { regex: XRegExp("`([^\\\\`]|\\\\.)*`", "gs"), css: "string" }, // strings |
| 45 | + { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: "value" }, // numbers |
| 46 | + { regex: new RegExp(this.getKeywords(keywords), "gm"), css: "keyword" }, // keywords |
| 47 | + { regex: new RegExp(this.getKeywords(funcs), "gmi"), css: "functions" }, // built-in functions |
| 48 | + { regex: new RegExp(this.getKeywords(special), "gm"), css: "color1" }, // literals |
| 49 | + ]; |
| 50 | + |
| 51 | + this.forHtmlScript({ |
| 52 | + left: /(<|<)%[@!=]?/g, |
| 53 | + right: /%(>|>)/g, |
| 54 | + }); |
| 55 | + } |
| 56 | + |
| 57 | + Brush.prototype = new SyntaxHighlighter.Highlighter(); |
| 58 | + Brush.aliases = ["go", "golang"]; |
| 59 | + |
| 60 | + SyntaxHighlighter.brushes.Go = Brush; |
| 61 | + |
| 62 | + // CommonJS |
| 63 | + typeof exports != "undefined" ? (exports.Brush = Brush) : null; |
| 64 | +})(); |
0 commit comments