diff options
Diffstat (limited to 'Back/Blocks/syntax/scripts/shBrushXml.js')
-rw-r--r-- | Back/Blocks/syntax/scripts/shBrushXml.js | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/Back/Blocks/syntax/scripts/shBrushXml.js b/Back/Blocks/syntax/scripts/shBrushXml.js new file mode 100644 index 0000000..69d9fd0 --- /dev/null +++ b/Back/Blocks/syntax/scripts/shBrushXml.js | |||
@@ -0,0 +1,69 @@ | |||
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 (July 02 2010) | ||
10 | * | ||
11 | * @copyright | ||
12 | * Copyright (C) 2004-2010 Alex Gorbatchev. | ||
13 | * | ||
14 | * @license | ||
15 | * Dual licensed under the MIT and GPL licenses. | ||
16 | */ | ||
17 | ;(function() | ||
18 | { | ||
19 | // CommonJS | ||
20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; | ||
21 | |||
22 | function Brush() | ||
23 | { | ||
24 | function process(match, regexInfo) | ||
25 | { | ||
26 | var constructor = SyntaxHighlighter.Match, | ||
27 | code = match[0], | ||
28 | tag = new XRegExp('(<|<)[\\s\\/\\?]*(?<name>[:\\w-\\.]+)', 'xg').exec(code), | ||
29 | result = [] | ||
30 | ; | ||
31 | |||
32 | if (match.attributes != null) | ||
33 | { | ||
34 | var attributes, | ||
35 | regex = new XRegExp('(?<name> [\\w:\\-\\.]+)' + | ||
36 | '\\s*=\\s*' + | ||
37 | '(?<value> ".*?"|\'.*?\'|\\w+)', | ||
38 | 'xg'); | ||
39 | |||
40 | while ((attributes = regex.exec(code)) != null) | ||
41 | { | ||
42 | result.push(new constructor(attributes.name, match.index + attributes.index, 'color1')); | ||
43 | result.push(new constructor(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string')); | ||
44 | } | ||
45 | } | ||
46 | |||
47 | if (tag != null) | ||
48 | result.push( | ||
49 | new constructor(tag.name, match.index + tag[0].indexOf(tag.name), 'keyword') | ||
50 | ); | ||
51 | |||
52 | return result; | ||
53 | } | ||
54 | |||
55 | this.regexList = [ | ||
56 | { regex: new XRegExp('(\\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\>|>)', 'gm'), css: 'color2' }, // <![ ... [ ... ]]> | ||
57 | { regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // <!-- ... --> | ||
58 | { regex: new XRegExp('(<|<)[\\s\\/\\?]*(\\w+)(?<attributes>.*?)[\\s\\/\\?]*(>|>)', 'sg'), func: process } | ||
59 | ]; | ||
60 | }; | ||
61 | |||
62 | Brush.prototype = new SyntaxHighlighter.Highlighter(); | ||
63 | Brush.aliases = ['xml', 'xhtml', 'xslt', 'html']; | ||
64 | |||
65 | SyntaxHighlighter.brushes.Xml = Brush; | ||
66 | |||
67 | // CommonJS | ||
68 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; | ||
69 | })(); | ||