History

Update Prism.js with Python syntax

Thibaut committed 12 years ago

Commit 58785511 parent e96b1731 file · +16 −0Browse files

Unified · Split

assets/javascripts/vendor/prism.js+16−0
@@ -492,6 +492,21 @@ Prism.languages.insertBefore('coffeescript', 'keyword', { · 491 unmodified lines
492492 },
493493 'attr-name': /[_?a-z-|A-Z-]+(\s*:)| @[_?$?a-z-|A-Z-]+(\s*)| /g
494494 });
495+;
496+Prism.languages.python= {
497+ 'comment': {
498+ pattern: /(^|[^\\])#.*?(\r?\n|$)/g,
499+ lookbehind: true
500+ },
501+ 'string' : /("|')(\\?.)*?\1/g,
502+ '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,
503+ 'boolean' : /\b(True|False)\b/g,
504+ 'number' : /\b-?(0x)?\d*\.?[\da-f]+\b/g,
505+ 'operator' : /[-+]{1,2}|=?<|=?>|!|={1,2}|(&){1,2}|(&){1,2}|\|?\||\?|\*|\/|~|\^|%|\b(or|and|not)\b/g,
506+ 'ignore' : /&(lt|gt|amp);/gi,
507+ 'punctuation' : /[{}[\];(),.:]/g
508+};
509+
495510 ;
496511 /**
497512 * Original by Samuel Flores
@@ -514,4 +529,5 @@ Prism.languages.insertBefore('ruby', 'keyword', { · 16 unmodified lines
514529 'variable': /[@$&]+\b[a-zA-Z_][a-zA-Z_0-9]*[?!]?\b/g,
515530 'symbol': /:\b[a-zA-Z_][a-zA-Z_0-9]*[?!]?\b/g
516531 });
532+
517533 ;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t