1
0
mirror of https://github.com/arsenetar/PrismHighlight.git synced 2024-11-24 04:39:01 +00:00
PrismHighlight/prism/components/prism-coffeescript.js
Andrew Senetar 7e04feff9f First Version ( v0.1 )
First Version of the PrismHighlight Mediawiki extension.
2013-06-07 01:49:35 -04:00

17 lines
783 B
JavaScript

Prism.languages.coffeescript = Prism.languages.extend('javascript', {
'block-comment': /([#]{3}\s*\r?\n(.*\s*\r*\n*)\s*?\r?\n[#]{3})/g,
'comment': /(\s|^)([#]{1}[^#^\r^\n]{2,}?(\r?\n|$))/g,
'keyword': /\b(this|window|delete|class|extends|namespace|extend|ar|let|if|else|while|do|for|each|of|return|in|instanceof|new|with|typeof|try|catch|finally|null|undefined|break|continue)\b/g
});
Prism.languages.insertBefore('coffeescript', 'keyword', {
'function': {
pattern: /[a-z|A-z]+\s*[:|=]\s*(\([.|a-z\s|,|:|{|}|\"|\'|=]*\))?\s*->/gi,
inside: {
'function-name': /[_?a-z-|A-Z-]+(\s*[:|=])| @[_?$?a-z-|A-Z-]+(\s*)| /g,
'operator': /[-+]{1,2}|!|=?<|=?>|={1,2}|(&){1,2}|\|?\||\?|\*|\//g
}
},
'attr-name': /[_?a-z-|A-Z-]+(\s*:)| @[_?$?a-z-|A-Z-]+(\s*)| /g
});