Update Prism.js with Python syntax

pull/17/merge
Thibaut 11 years ago
parent e96b173ce4
commit 5878551f5e

@ -492,6 +492,21 @@ Prism.languages.insertBefore('coffeescript', 'keyword', {
},
'attr-name': /[_?a-z-|A-Z-]+(\s*:)| @[_?$?a-z-|A-Z-]+(\s*)| /g
});
;
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
};
;
/**
* Original by Samuel Flores
@ -514,4 +529,5 @@ Prism.languages.insertBefore('ruby', 'keyword', {
'variable': /[@$&]+\b[a-zA-Z_][a-zA-Z_0-9]*[?!]?\b/g,
'symbol': /:\b[a-zA-Z_][a-zA-Z_0-9]*[?!]?\b/g
});
;

Loading…
Cancel
Save