| OLD | NEW |
| 1 (function(){ | 1 (function(){ |
| 2 | 2 |
| 3 if (!self.Prism) { | 3 if ( |
| 4 » typeof self !== 'undefined' && !self.Prism || |
| 5 » typeof global !== 'undefined' && !global.Prism |
| 6 ) { |
| 4 return; | 7 return; |
| 5 } | 8 } |
| 6 | 9 |
| 7 if (Prism.languages.css) { | 10 if (Prism.languages.css) { |
| 8 Prism.languages.css.atrule.inside['atrule-id'] = /^@[\w-]+/; | 11 Prism.languages.css.atrule.inside['atrule-id'] = /^@[\w-]+/; |
| 9 | 12 |
| 10 // check whether the selector is an advanced pattern before extending it | 13 // check whether the selector is an advanced pattern before extending it |
| 11 if (Prism.languages.css.selector.pattern) | 14 if (Prism.languages.css.selector.pattern) |
| 12 { | 15 { |
| 13 Prism.languages.css.selector.inside['pseudo-class'] = /:[\w-]+/; | 16 Prism.languages.css.selector.inside['pseudo-class'] = /:[\w-]+/; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 34 'rp': 1, 'rt': 1, 'ruby': 1, 's': 1, 'samp': 1, 'small':
1, 'spacer': 1, 'strike': 1, 'strong': 1, 'sub': 1, 'sup': 1, 'time': 1, 'tt':
1, 'u': 1, | 37 'rp': 1, 'rt': 1, 'ruby': 1, 's': 1, 'samp': 1, 'small':
1, 'spacer': 1, 'strike': 1, 'strong': 1, 'sub': 1, 'sup': 1, 'time': 1, 'tt':
1, 'u': 1, |
| 35 'var': 1, 'wbr': 1, 'noframes': 1, 'summary': 1, 'comman
d': 1, 'dt': 1, 'dd': 1, 'figure': 1, 'figcaption': 1, 'center': 1, 'section': 1
, 'nav': 1, | 38 'var': 1, 'wbr': 1, 'noframes': 1, 'summary': 1, 'comman
d': 1, 'dt': 1, 'dd': 1, 'figure': 1, 'figcaption': 1, 'center': 1, 'section': 1
, 'nav': 1, |
| 36 'article': 1, 'aside': 1, 'hgroup': 1, 'header': 1, 'foo
ter': 1, 'address': 1, 'noscript': 1, 'isIndex': 1, 'main': 1, 'mark': 1, 'marqu
ee': 1, | 39 'article': 1, 'aside': 1, 'hgroup': 1, 'header': 1, 'foo
ter': 1, 'address': 1, 'noscript': 1, 'isIndex': 1, 'main': 1, 'mark': 1, 'marqu
ee': 1, |
| 37 'meter': 1, 'menu': 1 | 40 'meter': 1, 'menu': 1 |
| 38 }, | 41 }, |
| 39 SVG: { | 42 SVG: { |
| 40 'animateColor': 1, 'animateMotion': 1, 'animateTransform
': 1, 'glyph': 1, 'feBlend': 1, 'feColorMatrix': 1, 'feComponentTransfer': 1, | 43 'animateColor': 1, 'animateMotion': 1, 'animateTransform
': 1, 'glyph': 1, 'feBlend': 1, 'feColorMatrix': 1, 'feComponentTransfer': 1, |
| 41 'feFuncR': 1, 'feFuncG': 1, 'feFuncB': 1, 'feFuncA': 1,
'feComposite': 1, 'feConvolveMatrix': 1, 'feDiffuseLighting': 1, 'feDisplacement
Map': 1, | 44 'feFuncR': 1, 'feFuncG': 1, 'feFuncB': 1, 'feFuncA': 1,
'feComposite': 1, 'feConvolveMatrix': 1, 'feDiffuseLighting': 1, 'feDisplacement
Map': 1, |
| 42 'feFlood': 1, 'feGaussianBlur': 1, 'feImage': 1, 'feMerg
e': 1, 'feMergeNode': 1, 'feMorphology': 1, 'feOffset': 1, 'feSpecularLighting':
1, | 45 'feFlood': 1, 'feGaussianBlur': 1, 'feImage': 1, 'feMerg
e': 1, 'feMergeNode': 1, 'feMorphology': 1, 'feOffset': 1, 'feSpecularLighting':
1, |
| 43 'feTile': 1, 'feTurbulence': 1, 'feDistantLight': 1, 'fe
PointLight': 1, 'feSpotLight': 1, 'linearGradient': 1, 'radialGradient': 1, 'alt
Glyph': 1, | 46 'feTile': 1, 'feTurbulence': 1, 'feDistantLight': 1, 'fe
PointLight': 1, 'feSpotLight': 1, 'linearGradient': 1, 'radialGradient': 1, 'alt
Glyph': 1, |
| 44 » » » 'textPath': 1, 'tref': 1, 'altglyph': 1, 'textpath': 1,
'tref': 1, 'altglyphdef': 1, 'altglyphitem': 1, 'clipPath': 1, 'color-profile':
1, 'cursor': 1, | 47 » » » 'textPath': 1, 'tref': 1, 'altglyph': 1, 'textpath': 1,
'altglyphdef': 1, 'altglyphitem': 1, 'clipPath': 1, 'color-profile': 1, 'cursor'
: 1, |
| 45 » » » 'font-face': 1, 'font-face-format': 1, 'font-face-name':
1, 'font-face-src': 1, 'font-face-uri': 1, 'foreignObject': 1, 'glyph': 1, 'gly
phRef': 1, | 48 » » » 'font-face': 1, 'font-face-format': 1, 'font-face-name':
1, 'font-face-src': 1, 'font-face-uri': 1, 'foreignObject': 1, 'glyphRef': 1, |
| 46 » » » 'hkern': 1, 'vkern': 1, | 49 » » » 'hkern': 1, 'vkern': 1 |
| 47 }, | 50 }, |
| 48 MathML: {} | 51 MathML: {} |
| 49 } | 52 } |
| 50 } | 53 } |
| 51 | 54 |
| 52 var language; | 55 var language; |
| 53 | 56 |
| 54 Prism.hooks.add('wrap', function(env) { | 57 Prism.hooks.add('wrap', function(env) { |
| 55 » if ((['tag-id'].indexOf(env.type) > -1 | 58 » if ((env.type == 'tag-id' |
| 56 || (env.type == 'property' && env.content.indexOf('-') != 0) | 59 || (env.type == 'property' && env.content.indexOf('-') != 0) |
| 57 || (env.type == 'atrule-id'&& env.content.indexOf('@-') != 0) | 60 || (env.type == 'atrule-id'&& env.content.indexOf('@-') != 0) |
| 58 || (env.type == 'pseudo-class'&& env.content.indexOf(':-') != 0)
| 61 || (env.type == 'pseudo-class'&& env.content.indexOf(':-') != 0)
|
| 59 || (env.type == 'pseudo-element'&& env.content.indexOf('::-') !=
0) | 62 || (env.type == 'pseudo-element'&& env.content.indexOf('::-') !=
0) |
| 60 || (env.type == 'attr-name' && env.content.indexOf('data-') != 0) | 63 || (env.type == 'attr-name' && env.content.indexOf('data-') != 0) |
| 61 ) && env.content.indexOf('<') === -1 | 64 ) && env.content.indexOf('<') === -1 |
| 62 ) { | 65 ) { |
| 63 var searchURL = 'w/index.php?fulltext&search='; | 66 var searchURL = 'w/index.php?fulltext&search='; |
| 64 » » | 67 |
| 65 env.tag = 'a'; | 68 env.tag = 'a'; |
| 66 | 69 |
| 67 var href = 'http://docs.webplatform.org/'; | 70 var href = 'http://docs.webplatform.org/'; |
| 68 | 71 |
| 69 if (env.language == 'css') { | 72 if (env.language == 'css') { |
| 70 » » » href += 'wiki/css/' | 73 » » » href += 'wiki/css/'; |
| 71 | 74 |
| 72 if (env.type == 'property') { | 75 if (env.type == 'property') { |
| 73 href += 'properties/'; | 76 href += 'properties/'; |
| 74 } | 77 } |
| 75 else if (env.type == 'atrule-id') { | 78 else if (env.type == 'atrule-id') { |
| 76 href += 'atrules/'; | 79 href += 'atrules/'; |
| 77 } | 80 } |
| 78 else if (env.type == 'pseudo-class') { | 81 else if (env.type == 'pseudo-class') { |
| 79 href += 'selectors/pseudo-classes/'; | 82 href += 'selectors/pseudo-classes/'; |
| 80 } | 83 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 return 'html'; | 121 return 'html'; |
| 119 } | 122 } |
| 120 else if (Tags.SVG[tag]) { | 123 else if (Tags.SVG[tag]) { |
| 121 return 'svg'; | 124 return 'svg'; |
| 122 } | 125 } |
| 123 else if (Tags.MathML[tag]) { | 126 else if (Tags.MathML[tag]) { |
| 124 return 'mathml'; | 127 return 'mathml'; |
| 125 } | 128 } |
| 126 | 129 |
| 127 // Not in dictionary, perform check | 130 // Not in dictionary, perform check |
| 128 » if (Tags.HTML[tagL] !== 0) { | 131 » if (Tags.HTML[tagL] !== 0 && typeof document !== 'undefined') { |
| 129 var htmlInterface = (document.createElement(tag).toString().matc
h(/\[object HTML(.+)Element\]/) || [])[1]; | 132 var htmlInterface = (document.createElement(tag).toString().matc
h(/\[object HTML(.+)Element\]/) || [])[1]; |
| 130 | 133 |
| 131 if (htmlInterface && htmlInterface != 'Unknown') { | 134 if (htmlInterface && htmlInterface != 'Unknown') { |
| 132 Tags.HTML[tagL] = 1; | 135 Tags.HTML[tagL] = 1; |
| 133 return 'html'; | 136 return 'html'; |
| 134 } | 137 } |
| 135 } | 138 } |
| 136 | 139 |
| 137 Tags.HTML[tagL] = 0; | 140 Tags.HTML[tagL] = 0; |
| 138 | 141 |
| 139 » if (Tags.SVG[tag] !== 0) { | 142 » if (Tags.SVG[tag] !== 0 && typeof document !== 'undefined') { |
| 140 var svgInterface = (document.createElementNS('http://www.w3.org/
2000/svg', tag).toString().match(/\[object SVG(.+)Element\]/) || [])[1]; | 143 var svgInterface = (document.createElementNS('http://www.w3.org/
2000/svg', tag).toString().match(/\[object SVG(.+)Element\]/) || [])[1]; |
| 141 | 144 |
| 142 if (svgInterface && svgInterface != 'Unknown') { | 145 if (svgInterface && svgInterface != 'Unknown') { |
| 143 Tags.SVG[tag] = 1; | 146 Tags.SVG[tag] = 1; |
| 144 return 'svg'; | 147 return 'svg'; |
| 145 } | 148 } |
| 146 } | 149 } |
| 147 | 150 |
| 148 Tags.SVG[tag] = 0; | 151 Tags.SVG[tag] = 0; |
| 149 | 152 |
| 150 // Lame way to detect MathML, but browsers don’t expose interface names
there :( | 153 // Lame way to detect MathML, but browsers don’t expose interface names
there :( |
| 151 if (Tags.MathML[tag] !== 0) { | 154 if (Tags.MathML[tag] !== 0) { |
| 152 if (tag.indexOf('m') === 0) { | 155 if (tag.indexOf('m') === 0) { |
| 153 Tags.MathML[tag] = 1; | 156 Tags.MathML[tag] = 1; |
| 154 return 'mathml'; | 157 return 'mathml'; |
| 155 } | 158 } |
| 156 } | 159 } |
| 157 | 160 |
| 158 Tags.MathML[tag] = 0; | 161 Tags.MathML[tag] = 0; |
| 159 | 162 |
| 160 return null; | 163 return null; |
| 161 } | 164 } |
| 162 | 165 |
| 163 })(); | 166 })(); |
| OLD | NEW |