diff --git a/syntaxhighlighter.php b/syntaxhighlighter.php index b6a27be..7e88e7d 100644 --- a/syntaxhighlighter.php +++ b/syntaxhighlighter.php @@ -136,6 +136,7 @@ function_exists( 'parse_blocks' ) // WordPress 5.0+ wp_register_script( 'syntaxhighlighter-brush-delphi', plugins_url( $this->shfolder . '/scripts/shBrushDelphi.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver ); wp_register_script( 'syntaxhighlighter-brush-diff', plugins_url( $this->shfolder . '/scripts/shBrushDiff.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver ); wp_register_script( 'syntaxhighlighter-brush-erlang', plugins_url( $this->shfolder . '/scripts/shBrushErlang.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver ); + wp_register_script( 'syntaxhighlighter-brush-go', plugins_url( $this->shfolder . '/scripts/shBrushGo.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver ); wp_register_script( 'syntaxhighlighter-brush-groovy', plugins_url( $this->shfolder . '/scripts/shBrushGroovy.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver ); wp_register_script( 'syntaxhighlighter-brush-java', plugins_url( $this->shfolder . '/scripts/shBrushJava.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver ); wp_register_script( 'syntaxhighlighter-brush-javafx', plugins_url( $this->shfolder . '/scripts/shBrushJavaFX.js', __FILE__ ), array( 'syntaxhighlighter-core' ), $this->agshver ); @@ -197,6 +198,8 @@ function_exists( 'parse_blocks' ) // WordPress 5.0+ 'erl' => 'erlang', 'erlang' => 'erlang', 'fsharp' => 'fsharp', + 'go' => 'go', + 'golang' => 'go', 'groovy' => 'groovy', 'java' => 'java', 'jfx' => 'javafx', @@ -251,6 +254,7 @@ function_exists( 'parse_blocks' ) // WordPress 5.0+ 'diff' => __( 'diff / patch', 'syntaxhighlighter' ), 'erlang' => __( 'Erlang', 'syntaxhighlighter' ), 'fsharp' => __( 'F#', 'syntaxhighlighter' ), + 'go' => __( 'Go', 'syntaxhighlighter' ), 'groovy' => __( 'Groovy', 'syntaxhighlighter' ), 'java' => __( 'Java', 'syntaxhighlighter' ), 'javafx' => __( 'JavaFX', 'syntaxhighlighter' ), diff --git a/syntaxhighlighter3/scripts/shBrushGo.js b/syntaxhighlighter3/scripts/shBrushGo.js new file mode 100644 index 0000000..80289eb --- /dev/null +++ b/syntaxhighlighter3/scripts/shBrushGo.js @@ -0,0 +1,60 @@ +/** + * SyntaxHighlighter + * http://alexgorbatchev.com/SyntaxHighlighter + * + * SyntaxHighlighter is donationware. If you are using it, please donate. + * http://alexgorbatchev.com/SyntaxHighlighter/donate.html + * + * @version + * 3.0.83 (Wed, 16 Apr 2014 03:56:09 GMT) + * + * @copyright + * Copyright (C) 2004-2013 Alex Gorbatchev. + * + * @license + * Dual licensed under the MIT and GPL licenses. + */ +(function () { + // CommonJS + SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null); + + function Brush() { + var keywords = + 'bool break byte case chan complex128 complex64 const continue default defer else ' + + 'fallthrough float32 float64 for func go goto if import int int16 int32 int64 int8 ' + + 'interface map package range return rune select string struct switch type uint ' + + 'uint16 uint32 uint64 uint8 uintptr var'; + var funcs = + 'append cap close complex copy imag len make new panic print println real recover delete'; + var special = 'true false iota nil'; + + this.regexList = [ + { + regex: SyntaxHighlighter.regexLib.singleLineCComments, + css: 'comments', + }, // one line comments + { regex: /\/\*([^\*][\s\S]*?)?\*\//gm, css: 'comments' }, // multiline comments + { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings + { regex: XRegExp('`([^\\\\`]|\\\\.)*`', 'gs'), css: 'string' }, // strings + { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers + { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords + { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // built-in functions + { regex: new RegExp(this.getKeywords(special), 'gm'), css: 'color1' }, // literals + ]; + + this.forHtmlScript({ + left: /(<|<)%[@!=]?/g, + right: /%(>|>)/g, + }); + } + + Brush.prototype = new SyntaxHighlighter.Highlighter(); + Brush.aliases = ['go', 'golang']; + + SyntaxHighlighter.brushes.Go = Brush; + + // CommonJS + typeof exports != 'undefined' ? (exports.Brush = Brush) : null; +})();