|
| 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 | + * @copyright |
| 9 | + * Copyright (C) 2019 Craig Andrews. |
| 10 | + * Copyright (C) 2016 Erik Wegner. |
| 11 | + * |
| 12 | + * @license |
| 13 | + * Dual licensed under the MIT and GPL licenses. |
| 14 | + */ |
| 15 | +;(function() |
| 16 | +{ |
| 17 | + // CommonJS |
| 18 | + SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null); |
| 19 | + |
| 20 | + function Brush() |
| 21 | + { |
| 22 | + |
| 23 | + // Yaml Brush |
| 24 | + |
| 25 | + var constants = '~ true false on off'; |
| 26 | + |
| 27 | + this.regexList = [ |
| 28 | + { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // comment |
| 29 | + { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted string |
| 30 | + { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted string |
| 31 | + { regex: /^\s*([a-z0-9\._-])+\s*:/gmi, css: 'variable' }, // key |
| 32 | + { regex: /\s?(\.)([a-z0-9\._-])+\s?:/gmi, css: 'comments' }, // section |
| 33 | + { regex: /\s(@|:)([a-z0-9\._-])+\s*$/gmi, css: 'variable bold' }, // variable, reference |
| 34 | + { regex: /\s+\d+\s?$/gm, css: 'color2 bold' }, // integers |
| 35 | + { regex: /(\{|\}|\[|\]|,|~|:)/gm, css: 'constants' }, // inline hash and array, comma, null |
| 36 | + { regex: /^\s+(-)+/gm, css: 'string bold' }, // array list entry |
| 37 | + { regex: /^---/gm, css: 'string bold' }, // category |
| 38 | + { regex: new RegExp(this.getKeywords(constants), 'gmi'), css: 'constants' } // constants |
| 39 | + ]; |
| 40 | + |
| 41 | + this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags); |
| 42 | + } |
| 43 | + Brush.prototype = new SyntaxHighlighter.Highlighter(); |
| 44 | + Brush.aliases = ['yaml', 'yml']; |
| 45 | + |
| 46 | + SyntaxHighlighter.brushes.Yaml = Brush; |
| 47 | + |
| 48 | + // CommonJS |
| 49 | + typeof(exports) != 'undefined' ? exports.Brush = Brush : null; |
| 50 | +})(); |
0 commit comments