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

15 lines
567 B
JavaScript

Prism.languages.python= {
'comment': {
pattern: /(^|[^\\])#.*?(\r?\n|$)/g,
lookbehind: true
},
'string' : /("|')(\\?.)*?\1/g,
'keyword' : /\b(as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/g,
'boolean' : /\b(True|False)\b/g,
'number' : /\b-?(0x)?\d*\.?[\da-f]+\b/g,
'operator' : /[-+]{1,2}|=?<|=?>|!|={1,2}|(&){1,2}|(&){1,2}|\|?\||\?|\*|\/|~|\^|%|\b(or|and|not)\b/g,
'ignore' : /&(lt|gt|amp);/gi,
'punctuation' : /[{}[\];(),.:]/g
};