From 5edb31d2f6f7640d0c95fc4e685a126ff0feb51c Mon Sep 17 00:00:00 2001 From: Victorien ELVINGER Date: Thu, 4 Dec 2014 19:54:03 +0100 Subject: [PATCH 001/137] Add Eiffel programming language definition. --- components.js | 4 ++++ components/prism-eiffel.js | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 components/prism-eiffel.js diff --git a/components.js b/components.js index 94a440e5df..8803042ed1 100644 --- a/components.js +++ b/components.js @@ -58,6 +58,10 @@ var components = { "title": "C-like", "option": "default" }, + "eiffel": { + "title": "Eiffel", + "option": "default" + }, "javascript": { "title": "JavaScript", "option": "default", diff --git a/components/prism-eiffel.js b/components/prism-eiffel.js new file mode 100644 index 0000000000..444e686df2 --- /dev/null +++ b/components/prism-eiffel.js @@ -0,0 +1,27 @@ +Prism.languages.eiffel = { + 'string': [ + // Aligned-verbatim-strings (verbatim option not supported) + /"\[(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[cC][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*|\d(?:_?\d)*)\/)*?]"/g, + // Non-aligned-verbatim-strings (verbatim option not supported) + /"\{(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[cC][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*|\d(?:_?\d)*)\/)*?}"/g, + // Single-line string + /"(?:[^%\b\f\n\r\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[cC][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*|\d(?:_?\d)*)\/)*?"/g + ], + // (comments including quoted strings not supported) + 'comment': /--.*/, + // normal char | special char | char code + 'char': /'(?:[^%\b\f\n\r\t\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[cC][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*|\d(?:_?\d)*)\/)'/g, + 'keyword': /\b(?:across|agent|alias|all|and|attached|as|assign|attribute|check|class|convert|create|Current|debug|deferred|detachable|do|else|elseif|end|ensure|expanded|export|external|feature|from|frozen|if|implies|inherit|inspect|invariant|like|local|loop|not|note|obsolete|old|once|or|Precursor|redefine|rename|require|rescue|Result|retry|select|separate|some|then|undefine|until|variant|Void|when|xor)\b/gi, + 'boolean': /\b(?:True|False)\b/gi, + 'number': [ + // Decimal + { + pattern: /(\s)(?:\d(?:_?\d)*\.|(?:(?:\d(?:_?\d)*)?\.(?:\d(?:_?\d)*)?(?:[eE][+-]?)?)?\d(?:_?\d)*)(?=\s)/g, + lookbehind: true + }, + // hexa | octal | bin + /\b0(?:[xX][\da-fA-F](?:_?[\da-fA-F])*|[cC][0-7](?:_?[0-7])*|[bB][01](?:_?[01])*)\b/g + ], + 'punctuation': /:=|<<|>>|\(\||\|\)|->|\.(?=\w)|[{}[\];(),:?]/g, + 'operator': /\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[-+*^=~]/g +}; From cb8a1c38ef79e78ee3eaf97b2a4288f581f91acd Mon Sep 17 00:00:00 2001 From: Victorien ELVINGER Date: Thu, 4 Dec 2014 23:44:54 +0100 Subject: [PATCH 002/137] Enable juxtaposed digit separators --- components/prism-eiffel.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/prism-eiffel.js b/components/prism-eiffel.js index 444e686df2..3a16f806d6 100644 --- a/components/prism-eiffel.js +++ b/components/prism-eiffel.js @@ -1,26 +1,26 @@ Prism.languages.eiffel = { 'string': [ // Aligned-verbatim-strings (verbatim option not supported) - /"\[(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[cC][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*|\d(?:_?\d)*)\/)*?]"/g, + /"\[(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)*?]"/g, // Non-aligned-verbatim-strings (verbatim option not supported) - /"\{(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[cC][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*|\d(?:_?\d)*)\/)*?}"/g, + /"\{(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)*?}"/g, // Single-line string - /"(?:[^%\b\f\n\r\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[cC][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*|\d(?:_?\d)*)\/)*?"/g + /"(?:[^%\b\f\n\r\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)*?"/g ], // (comments including quoted strings not supported) 'comment': /--.*/, // normal char | special char | char code - 'char': /'(?:[^%\b\f\n\r\t\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[cC][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*|\d(?:_?\d)*)\/)'/g, + 'char': /'(?:[^%\b\f\n\r\t\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)'/g, 'keyword': /\b(?:across|agent|alias|all|and|attached|as|assign|attribute|check|class|convert|create|Current|debug|deferred|detachable|do|else|elseif|end|ensure|expanded|export|external|feature|from|frozen|if|implies|inherit|inspect|invariant|like|local|loop|not|note|obsolete|old|once|or|Precursor|redefine|rename|require|rescue|Result|retry|select|separate|some|then|undefine|until|variant|Void|when|xor)\b/gi, 'boolean': /\b(?:True|False)\b/gi, 'number': [ // Decimal { - pattern: /(\s)(?:\d(?:_?\d)*\.|(?:(?:\d(?:_?\d)*)?\.(?:\d(?:_?\d)*)?(?:[eE][+-]?)?)?\d(?:_?\d)*)(?=\s)/g, + pattern: /(\s)(?:\d(?:_*\d)*\.|(?:(?:\d(?:_*\d)*)?\.(?:\d(?:_*\d)*)?(?:[eE][+-]?)?)?\d(?:_*\d)*)(?=\s)/g, lookbehind: true }, // hexa | octal | bin - /\b0(?:[xX][\da-fA-F](?:_?[\da-fA-F])*|[cC][0-7](?:_?[0-7])*|[bB][01](?:_?[01])*)\b/g + /\b0(?:[xX][\da-fA-F](?:_*[\da-fA-F])*|[cC][0-7](?:_*[0-7])*|[bB][01](?:_*[01])*)\b/g ], 'punctuation': /:=|<<|>>|\(\||\|\)|->|\.(?=\w)|[{}[\];(),:?]/g, 'operator': /\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[-+*^=~]/g From 25a775e8f662a98f5f66abc2b7363c8f86492538 Mon Sep 17 00:00:00 2001 From: Victorien ELVINGER Date: Fri, 5 Dec 2014 01:16:35 +0100 Subject: [PATCH 003/137] Improve number handling for Eiffel. --- components/prism-eiffel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-eiffel.js b/components/prism-eiffel.js index 3a16f806d6..34089e4ef5 100644 --- a/components/prism-eiffel.js +++ b/components/prism-eiffel.js @@ -16,7 +16,7 @@ Prism.languages.eiffel = { 'number': [ // Decimal { - pattern: /(\s)(?:\d(?:_*\d)*\.|(?:(?:\d(?:_*\d)*)?\.(?:\d(?:_*\d)*)?(?:[eE][+-]?)?)?\d(?:_*\d)*)(?=\s)/g, + pattern: /(\b|\s)(?:\d(?:_*\d)*\.|(?:(?:\d(?:_*\d)*)?\.(?:\d(?:_*\d)*)?(?:[eE][+-]?)?)?\d(?:_*\d)*)(?=\b|\s)/g, lookbehind: true }, // hexa | octal | bin From 50513d1f7f88c12daed378345871101d294d8217 Mon Sep 17 00:00:00 2001 From: Victorien ELVINGER Date: Sat, 6 Dec 2014 19:45:05 +0100 Subject: [PATCH 004/137] Make simpler decimal number regex --- components/prism-eiffel.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/components/prism-eiffel.js b/components/prism-eiffel.js index 34089e4ef5..0b9589d069 100644 --- a/components/prism-eiffel.js +++ b/components/prism-eiffel.js @@ -14,13 +14,10 @@ Prism.languages.eiffel = { 'keyword': /\b(?:across|agent|alias|all|and|attached|as|assign|attribute|check|class|convert|create|Current|debug|deferred|detachable|do|else|elseif|end|ensure|expanded|export|external|feature|from|frozen|if|implies|inherit|inspect|invariant|like|local|loop|not|note|obsolete|old|once|or|Precursor|redefine|rename|require|rescue|Result|retry|select|separate|some|then|undefine|until|variant|Void|when|xor)\b/gi, 'boolean': /\b(?:True|False)\b/gi, 'number': [ - // Decimal - { - pattern: /(\b|\s)(?:\d(?:_*\d)*\.|(?:(?:\d(?:_*\d)*)?\.(?:\d(?:_*\d)*)?(?:[eE][+-]?)?)?\d(?:_*\d)*)(?=\b|\s)/g, - lookbehind: true - }, // hexa | octal | bin - /\b0(?:[xX][\da-fA-F](?:_*[\da-fA-F])*|[cC][0-7](?:_*[0-7])*|[bB][01](?:_*[01])*)\b/g + /\b0(?:[xX][\da-fA-F](?:_*[\da-fA-F])*|[cC][0-7](?:_*[0-7])*|[bB][01](?:_*[01])*)\b/g, + // Decimal + /(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/, ], 'punctuation': /:=|<<|>>|\(\||\|\)|->|\.(?=\w)|[{}[\];(),:?]/g, 'operator': /\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[-+*^=~]/g From 5d7913cbc3e8a108b22150cc0bc469fb3f2a7188 Mon Sep 17 00:00:00 2001 From: Victorien ELVINGER Date: Sat, 6 Dec 2014 20:14:31 +0100 Subject: [PATCH 005/137] Add g flag for Eiffel decimals --- components/prism-eiffel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-eiffel.js b/components/prism-eiffel.js index 0b9589d069..2c387c6e33 100644 --- a/components/prism-eiffel.js +++ b/components/prism-eiffel.js @@ -17,7 +17,7 @@ Prism.languages.eiffel = { // hexa | octal | bin /\b0(?:[xX][\da-fA-F](?:_*[\da-fA-F])*|[cC][0-7](?:_*[0-7])*|[bB][01](?:_*[01])*)\b/g, // Decimal - /(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/, + /(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/g, ], 'punctuation': /:=|<<|>>|\(\||\|\)|->|\.(?=\w)|[{}[\];(),:?]/g, 'operator': /\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[-+*^=~]/g From 2932a42207491120f5a497fff1293477d1b0b8a0 Mon Sep 17 00:00:00 2001 From: Golmote Date: Tue, 9 Dec 2014 18:54:22 +0100 Subject: [PATCH 006/137] Minified Handlebars file is not up to date with original --- components/prism-handlebars.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-handlebars.min.js b/components/prism-handlebars.min.js index 206d085c4a..4de5ee8049 100644 --- a/components/prism-handlebars.min.js +++ b/components/prism-handlebars.min.js @@ -1 +1 @@ -Prism.languages.handlebars={expression:{pattern:/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g,inside:{comment:{pattern:/(\{\{)![\w\W]*(?=\}\})/g,lookbehind:!0},delimiter:{pattern:/\{\{\{?|\}\}\}?/gi,alias:"punctuation"},block:{pattern:/^(\s*~?\s*)[#\/]\w+/gi,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/g,variable:/[\w\W]+/g}},string:/(["'])(\\?.)+?\1/g,punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g}}},Prism.languages.markup&&(Prism.hooks.add("before-highlight",function(a){console.log(a.language),"handlebars"===a.language&&(a.tokenStack=[],a.backupCode=a.code,a.code=a.code.replace(/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/gi,function(b){return console.log(b),a.tokenStack.push(b),"___HANDLEBARS"+a.tokenStack.length+"___"}))}),Prism.hooks.add("before-insert",function(a){"handlebars"===a.language&&(a.code=a.backupCode,delete a.backupCode)}),Prism.hooks.add("after-highlight",function(a){if("handlebars"===a.language){for(var c,b=0;c=a.tokenStack[b];b++)a.highlightedCode=a.highlightedCode.replace("___HANDLEBARS"+(b+1)+"___",Prism.highlight(c,a.grammar,"handlebars"));a.element.innerHTML=a.highlightedCode}}),Prism.hooks.add("wrap",function(a){"handlebars"===a.language&&"markup"===a.type&&(a.content=a.content.replace(/(___HANDLEBARS[0-9]+___)/g,'$1'))}),Prism.languages.insertBefore("handlebars","expression",{markup:{pattern:/<[^?]\/?(.*?)>/g,inside:Prism.languages.markup},handlebars:/___HANDLEBARS[0-9]+___/g})); \ No newline at end of file +Prism.languages.handlebars={expression:{pattern:/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g,inside:{comment:{pattern:/(\{\{)![\w\W]*(?=\}\})/g,lookbehind:!0},delimiter:{pattern:/^\{\{\{?|\}\}\}?$/gi,alias:"punctuation"},string:/(["'])(\\?.)+?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,"boolean":/\b(true|false)\b/g,block:{pattern:/^(\s*~?\s*)[#\/]\w+/gi,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/g,variable:/[\w\W]+/g}},punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g}}},Prism.languages.markup&&(Prism.hooks.add("before-highlight",function(a){console.log(a.language),"handlebars"===a.language&&(a.tokenStack=[],a.backupCode=a.code,a.code=a.code.replace(/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/gi,function(b){return console.log(b),a.tokenStack.push(b),"___HANDLEBARS"+a.tokenStack.length+"___"}))}),Prism.hooks.add("before-insert",function(a){"handlebars"===a.language&&(a.code=a.backupCode,delete a.backupCode)}),Prism.hooks.add("after-highlight",function(a){if("handlebars"===a.language){for(var c,b=0;c=a.tokenStack[b];b++)a.highlightedCode=a.highlightedCode.replace("___HANDLEBARS"+(b+1)+"___",Prism.highlight(c,a.grammar,"handlebars"));a.element.innerHTML=a.highlightedCode}}),Prism.hooks.add("wrap",function(a){"handlebars"===a.language&&"markup"===a.type&&(a.content=a.content.replace(/(___HANDLEBARS[0-9]+___)/g,'$1'))}),Prism.languages.insertBefore("handlebars","expression",{markup:{pattern:/<[^?]\/?(.*?)>/g,inside:Prism.languages.markup},handlebars:/___HANDLEBARS[0-9]+___/g})); \ No newline at end of file From 0c2a2085ddbf45b448f7b7a7469a4a8325ba4154 Mon Sep 17 00:00:00 2001 From: Golmote Date: Tue, 9 Dec 2014 20:53:18 +0100 Subject: [PATCH 007/137] Added color and number to CSS --- components/prism-css.js | 11 +++++++++++ components/prism-css.min.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/components/prism-css.js b/components/prism-css.js index 5b027ee12f..3c97be7a22 100644 --- a/components/prism-css.js +++ b/components/prism-css.js @@ -12,6 +12,17 @@ Prism.languages.css = { 'string': /("|')(\\?.)*?\1/g, 'important': /\B!important\b/gi, 'punctuation': /[\{\};:]/g, + 'color': [ + { + pattern: /#(?:[0-9a-f]{3}){1,2}/ig, + alias: 'builtin' + }, + { + pattern: /(?:rgb|hsl)a?\(\s*\d+\s*(?:,\s*(?:\d+(?:\.\d*)?|\.\d+)%?\s*)+\)/, + alias: 'builtin' + } + ], + 'number': /(?:\d+(?:\.\d*)?|\.\d+)(?:%|ch|cm|deg|dpcm|dpi|dppx|ex|grad|k?Hz|in|mm|m?s|pc|pt|px|rad|r?em|turn|vh|vw|vmin|vmax)?/g, 'function': /[-a-z0-9]+(?=\()/ig }; diff --git a/components/prism-css.min.js b/components/prism-css.min.js index c07e428a94..1f4cc28624 100644 --- a/components/prism-css.min.js +++ b/components/prism-css.min.js @@ -1 +1 @@ -Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/gi,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,punctuation:/[\{\};:]/g,"function":/[-a-z0-9]+(?=\()/gi},Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/[\w\W]*?<\/style>/gi,inside:{tag:{pattern:/|<\/style>/gi,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css},alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').+?\1/gi,inside:{"attr-name":{pattern:/^\s*style/gi,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/gi,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)); \ No newline at end of file +Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/gi,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,punctuation:/[\{\};:]/g,color:[{pattern:/#(?:[0-9a-f]{3}){1,2}/gi,alias:"builtin"},{pattern:/(?:rgb|hsl)a?\(\s*\d+\s*(?:,\s*(?:\d+(?:\.\d*)?|\.\d+)%?\s*)+\)/,alias:"builtin"}],number:/(?:\d+(?:\.\d*)?|\.\d+)(?:%|ch|cm|deg|dpcm|dpi|dppx|ex|grad|k?Hz|in|mm|m?s|pc|pt|px|rad|r?em|turn|vh|vw|vmin|vmax)?/g,"function":/[-a-z0-9]+(?=\()/gi},Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/[\w\W]*?<\/style>/gi,inside:{tag:{pattern:/|<\/style>/gi,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css},alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').+?\1/gi,inside:{"attr-name":{pattern:/^\s*style/gi,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/gi,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)); \ No newline at end of file From f22f3249341d778fc30ab24ad3ed385949c12017 Mon Sep 17 00:00:00 2001 From: Golmote Date: Tue, 9 Dec 2014 20:53:41 +0100 Subject: [PATCH 008/137] Keep prism.js up to date --- prism.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/prism.js b/prism.js index 6e610df117..edb75cff77 100644 --- a/prism.js +++ b/prism.js @@ -494,6 +494,17 @@ Prism.languages.css = { 'string': /("|')(\\?.)*?\1/g, 'important': /\B!important\b/gi, 'punctuation': /[\{\};:]/g, + 'color': [ + { + pattern: /#(?:[0-9a-f]{3}){1,2}/ig, + alias: 'builtin' + }, + { + pattern: /(?:rgb|hsl)a?\(\s*\d+\s*(?:,\s*(?:\d+(?:\.\d*)?|\.\d+)%?\s*)+\)/, + alias: 'builtin' + } + ], + 'number': /(?:\d+(?:\.\d*)?|\.\d+)(?:%|ch|cm|deg|dpcm|dpi|dppx|ex|grad|k?Hz|in|mm|m?s|pc|pt|px|rad|r?em|turn|vh|vw|vmin|vmax)?/g, 'function': /[-a-z0-9]+(?=\()/ig }; From 6b37690da9336a54a0aeb185628db587a54ff533 Mon Sep 17 00:00:00 2001 From: Golmote Date: Wed, 10 Dec 2014 22:54:29 +0100 Subject: [PATCH 009/137] Added Markdown language --- components.js | 4 ++ components/prism-markdown.js | 103 +++++++++++++++++++++++++++++++ components/prism-markdown.min.js | 1 + 3 files changed, 108 insertions(+) create mode 100644 components/prism-markdown.js create mode 100644 components/prism-markdown.min.js diff --git a/components.js b/components.js index 7bae5697d4..c1156cd919 100644 --- a/components.js +++ b/components.js @@ -206,6 +206,10 @@ var components = { "handlebars": { "title": "Handlebars", "owner": "Golmote" + }, + "markdown": { + "title": "Markdown", + "owner": "Golmote" } }, "plugins": { diff --git a/components/prism-markdown.js b/components/prism-markdown.js new file mode 100644 index 0000000000..47cd45bcd9 --- /dev/null +++ b/components/prism-markdown.js @@ -0,0 +1,103 @@ +Prism.languages.markdown = Prism.languages.extend('markup', { + 'blockquote': { + // > ... + pattern: /(^|\n)>(?:[\t ]*>)*/, + lookbehind: true, + alias: 'operator' + }, + 'code': [ + { + // Prefixed by 4 spaces or 1 tab + pattern: /(^|\n)(?: {4}|\t).+/, + lookbehind: true, + alias: 'keyword' + }, + { + // `code` + // ``code`` + pattern: /``.+?``|`[^`\n]+`/, + alias: 'keyword' + } + ], + 'title': [ + { + // title 1 + // ======= + + // title 2 + // ------- + pattern: /\w+.*\n(?:==+|--+)/, + alias: 'important' + }, + { + // # title 1 + // ###### title 6 + pattern: /#+.+/, + alias: 'important' + } + ], + 'hr': { + // *** + // --- + // * * * + // ----------- + pattern: /([*-])([\t ]*\1){2,}/, + alias: 'punctuation' + }, + 'list': { + // * item + // + item + // - item + // 1. item + pattern: /(?:[*+-]|\d+\.)(?=[\t ].)/, + alias: 'operator' + }, + 'link-reference': { + // [id]: http://example.com "Optional title" + // [id]: http://example.com 'Optional title' + // [id]: http://example.com (Optional title) + // [id]: "Optional title" + pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:[^>]|\\>)+>)(?:[\t ]+(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\)))?/, + alias: 'symbol namespace' + }, + 'link': [ + { + // [example](http://example.com "Optional title") + pattern: /!?\[[^\]]+\]\([^\s)]+(?:[\t ]+"(?:[^"]|\\")*")?\)/, + alias: 'symbol' + }, + { + // [example] [id] + pattern: /!?\[[^\]]+\] ?\[[^\]\n]*\]/, + alias: 'symbol' + } + ], + 'strong': [ + { + // **strong** + // __strong__ + pattern: /(^|[^\\])\*\*[\s\S]+?\*\*/, + lookbehind: true, + alias: 'string' + }, + { + pattern: /(^|[^\\])__[\s\S]+?__/, + lookbehind: true, + alias: 'string' + } + ], + 'em': [ + { + // *em* + pattern: /(^|[^\\])\*[^*\t ][^*]*\*/, + lookbehind: true, + alias: 'string' + }, + { + // _em_ + pattern: /(^|[^\\])_[^_]+_/, + lookbehind: true, + alias: 'string' + } + ] +}); \ No newline at end of file diff --git a/components/prism-markdown.min.js b/components/prism-markdown.min.js new file mode 100644 index 0000000000..f19c436f41 --- /dev/null +++ b/components/prism-markdown.min.js @@ -0,0 +1 @@ +Prism.languages.markdown=Prism.languages.extend("markup",{blockquote:{pattern:/(^|\n)>(?:[\t ]*>)*/,lookbehind:!0,alias:"operator"},code:[{pattern:/(^|\n)(?: {4}|\t).+/,lookbehind:!0,alias:"keyword"},{pattern:/``.+?``|`[^`\n]+`/,alias:"keyword"}],title:[{pattern:/\w+.*\n(?:==+|--+)/,alias:"important"},{pattern:/#+.+/,alias:"important"}],hr:{pattern:/([*-])([\t ]*\1){2,}/,alias:"punctuation"},list:{pattern:/(?:[*+-]|\d+\.)(?=[\t ].)/,alias:"operator"},"link-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:[^>]|\\>)+>)(?:[\t ]+(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\)))?/,alias:"symbol namespace"},link:[{pattern:/!?\[[^\]]+\]\([^\s)]+(?:[\t ]+"(?:[^"]|\\")*")?\)/,alias:"symbol"},{pattern:/!?\[[^\]]+\] ?\[[^\]\n]*\]/,alias:"symbol"}],strong:[{pattern:/(^|[^\\])\*\*[\s\S]+?\*\*/,lookbehind:!0,alias:"string"},{pattern:/(^|[^\\])__[\s\S]+?__/,lookbehind:!0,alias:"string"}],em:[{pattern:/(^|[^\\])\*[^*\t ][^*]*\*/,lookbehind:!0,alias:"string"},{pattern:/(^|[^\\])_[^_]+_/,lookbehind:!0,alias:"string"}]}); \ No newline at end of file From 7c55b9cc5dcaaba6f6b1c54c26994bc843d4372c Mon Sep 17 00:00:00 2001 From: Golmote Date: Thu, 11 Dec 2014 19:49:57 +0100 Subject: [PATCH 010/137] New download page with dynamic loading of the scripts --- download.html | 1 + download.js | 135 ++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 99 insertions(+), 37 deletions(-) diff --git a/download.html b/download.html index 8b366a8a8f..29ea909ce0 100644 --- a/download.html +++ b/download.html @@ -154,6 +154,7 @@

Customize your download

+ diff --git a/download.js b/download.js index d6f106d7d5..b56b28bf09 100644 --- a/download.js +++ b/download.js @@ -10,6 +10,18 @@ var minified = true; var dependencies = {}; +var treeURL = 'https://github.com/gitapi/repos/LeaVerou/prism/git/trees/gh-pages?recursive=1'; +var treePromise = new Promise(function(resolve) { + $u.xhr({ + url: treeURL, + callback: function(xhr) { + if (xhr.status < 400) { + resolve(JSON.parse(xhr.responseText).tree); + } + } + }); +}); + var qstr = window.location.search.match(/(?:languages|plugins)=[-+\w]+|themes=[-\w]+/g); if (qstr) { qstr.forEach(function(str) { @@ -174,10 +186,20 @@ form.elements.compression[0].onclick = form.elements.compression[1].onclick = function() { minified = !!+this.value; - fetchFiles(); + getFilesSizes(); +} + +function getFileSize(filepath) { + return treePromise.then(function(tree) { + for(var i=0, l=tree.length; i Date: Thu, 11 Dec 2014 20:01:50 +0100 Subject: [PATCH 011/137] Fix filename of minified Scheme --- components/{prism-scheme-min.js => prism-scheme.min.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename components/{prism-scheme-min.js => prism-scheme.min.js} (100%) diff --git a/components/prism-scheme-min.js b/components/prism-scheme.min.js similarity index 100% rename from components/prism-scheme-min.js rename to components/prism-scheme.min.js From 3aa77a380f2a26e9c138aa8a3318c0d4e05101c0 Mon Sep 17 00:00:00 2001 From: Golmote Date: Thu, 11 Dec 2014 20:16:17 +0100 Subject: [PATCH 012/137] Improved CoffeeScript keywords based on the documentation. Fixes #389 --- components/prism-coffeescript.js | 2 +- components/prism-coffeescript.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/prism-coffeescript.js b/components/prism-coffeescript.js index 6f374ed62a..b54f593f83 100644 --- a/components/prism-coffeescript.js +++ b/components/prism-coffeescript.js @@ -3,7 +3,7 @@ Prism.languages.coffeescript = Prism.languages.extend('javascript', { /([#]{3}\s*\r?\n(.*\s*\r*\n*)\s*?\r?\n[#]{3})/g, /(\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 + 'keyword': /\b(and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/g }); Prism.languages.insertBefore('coffeescript', 'keyword', { diff --git a/components/prism-coffeescript.min.js b/components/prism-coffeescript.min.js index 3b7c550d95..960017cade 100644 --- a/components/prism-coffeescript.min.js +++ b/components/prism-coffeescript.min.js @@ -1 +1 @@ -Prism.languages.coffeescript=Prism.languages.extend("javascript",{comment:[/([#]{3}\s*\r?\n(.*\s*\r*\n*)\s*?\r?\n[#]{3})/g,/(\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}); \ No newline at end of file +Prism.languages.coffeescript=Prism.languages.extend("javascript",{comment:[/([#]{3}\s*\r?\n(.*\s*\r*\n*)\s*?\r?\n[#]{3})/g,/(\s|^)([#]{1}[^#^\r^\n]{2,}?(\r?\n|$))/g],keyword:/\b(and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\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}); \ No newline at end of file From 92878f6b618012b48da429344c83d872ac198c4a Mon Sep 17 00:00:00 2001 From: Golmote Date: Thu, 11 Dec 2014 20:29:36 +0100 Subject: [PATCH 013/137] Improved Markdown titles detection --- components/prism-markdown.js | 3 ++- components/prism-markdown.min.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/prism-markdown.js b/components/prism-markdown.js index 47cd45bcd9..6f89eeb1ca 100644 --- a/components/prism-markdown.js +++ b/components/prism-markdown.js @@ -32,7 +32,8 @@ Prism.languages.markdown = Prism.languages.extend('markup', { { // # title 1 // ###### title 6 - pattern: /#+.+/, + pattern: /((?:^|\n)\s*)#+.+/, + lookbehind: true, alias: 'important' } ], diff --git a/components/prism-markdown.min.js b/components/prism-markdown.min.js index f19c436f41..ff36a05e51 100644 --- a/components/prism-markdown.min.js +++ b/components/prism-markdown.min.js @@ -1 +1 @@ -Prism.languages.markdown=Prism.languages.extend("markup",{blockquote:{pattern:/(^|\n)>(?:[\t ]*>)*/,lookbehind:!0,alias:"operator"},code:[{pattern:/(^|\n)(?: {4}|\t).+/,lookbehind:!0,alias:"keyword"},{pattern:/``.+?``|`[^`\n]+`/,alias:"keyword"}],title:[{pattern:/\w+.*\n(?:==+|--+)/,alias:"important"},{pattern:/#+.+/,alias:"important"}],hr:{pattern:/([*-])([\t ]*\1){2,}/,alias:"punctuation"},list:{pattern:/(?:[*+-]|\d+\.)(?=[\t ].)/,alias:"operator"},"link-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:[^>]|\\>)+>)(?:[\t ]+(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\)))?/,alias:"symbol namespace"},link:[{pattern:/!?\[[^\]]+\]\([^\s)]+(?:[\t ]+"(?:[^"]|\\")*")?\)/,alias:"symbol"},{pattern:/!?\[[^\]]+\] ?\[[^\]\n]*\]/,alias:"symbol"}],strong:[{pattern:/(^|[^\\])\*\*[\s\S]+?\*\*/,lookbehind:!0,alias:"string"},{pattern:/(^|[^\\])__[\s\S]+?__/,lookbehind:!0,alias:"string"}],em:[{pattern:/(^|[^\\])\*[^*\t ][^*]*\*/,lookbehind:!0,alias:"string"},{pattern:/(^|[^\\])_[^_]+_/,lookbehind:!0,alias:"string"}]}); \ No newline at end of file +Prism.languages.markdown=Prism.languages.extend("markup",{blockquote:{pattern:/(^|\n)>(?:[\t ]*>)*/,lookbehind:!0,alias:"operator"},code:[{pattern:/(^|\n)(?: {4}|\t).+/,lookbehind:!0,alias:"keyword"},{pattern:/``.+?``|`[^`\n]+`/,alias:"keyword"}],title:[{pattern:/\w+.*\n(?:==+|--+)/,alias:"important"},{pattern:/((?:^|\n)\s*)#+.+/,lookbehind:!0,alias:"important"}],hr:{pattern:/([*-])([\t ]*\1){2,}/,alias:"punctuation"},list:{pattern:/(?:[*+-]|\d+\.)(?=[\t ].)/,alias:"operator"},"link-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:[^>]|\\>)+>)(?:[\t ]+(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\)))?/,alias:"symbol namespace"},link:[{pattern:/!?\[[^\]]+\]\([^\s)]+(?:[\t ]+"(?:[^"]|\\")*")?\)/,alias:"symbol"},{pattern:/!?\[[^\]]+\] ?\[[^\]\n]*\]/,alias:"symbol"}],strong:[{pattern:/(^|[^\\])\*\*[\s\S]+?\*\*/,lookbehind:!0,alias:"string"},{pattern:/(^|[^\\])__[\s\S]+?__/,lookbehind:!0,alias:"string"}],em:[{pattern:/(^|[^\\])\*[^*\t ][^*]*\*/,lookbehind:!0,alias:"string"},{pattern:/(^|[^\\])_[^_]+_/,lookbehind:!0,alias:"string"}]}); \ No newline at end of file From 3599113b44dfd23307dfbfc9cdbb1ea18037ea6d Mon Sep 17 00:00:00 2001 From: Golmote Date: Thu, 11 Dec 2014 22:35:53 +0100 Subject: [PATCH 014/137] Coffeescript refiew and improvements --- components/prism-coffeescript.js | 85 ++++++++++++++++++++++++---- components/prism-coffeescript.min.js | 2 +- 2 files changed, 76 insertions(+), 11 deletions(-) diff --git a/components/prism-coffeescript.js b/components/prism-coffeescript.js index b54f593f83..2611dc35ae 100644 --- a/components/prism-coffeescript.js +++ b/components/prism-coffeescript.js @@ -1,18 +1,83 @@ +(function(Prism) { + +// Ignore comments starting with { to privilege string interpolation highlighting +var comment = /#(?!\{).+/g, + interpolation = { + pattern: /#\{[^}]+\}/g, + alias: 'variable' + }; + Prism.languages.coffeescript = Prism.languages.extend('javascript', { - 'comment': [ - /([#]{3}\s*\r?\n(.*\s*\r*\n*)\s*?\r?\n[#]{3})/g, - /(\s|^)([#]{1}[^#^\r^\n]{2,}?(\r?\n|$))/g + 'comment': comment, + 'string': [ + + // Strings are multiline + /'(?:\\?[\s\S])*?'/g, + + { + // Strings are multiline + pattern: /"(?:\\?[\s\S])*?"/g, + inside: { + 'interpolation': interpolation + } + } ], - 'keyword': /\b(and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/g + 'keyword': /\b(and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/g, + 'class-member': { + pattern: /@(?!\d)\w+/, + alias: 'variable' + } }); -Prism.languages.insertBefore('coffeescript', 'keyword', { - 'function': { - pattern: /[a-z|A-z]+\s*[:|=]\s*(\([.|a-z\s|,|:|{|}|\"|\'|=]*\))?\s*->/gi, +Prism.languages.insertBefore('coffeescript', 'comment', { + 'multiline-comment': { + pattern: /###[\s\S]+?###/g, + alias: 'comment' + }, + + // Block regexp can contain comments and interpolation + 'block-regex': { + pattern: /\/{3}[\s\S]*?\/{3}/, + alias: 'regex', inside: { - 'function-name': /[_?a-z-|A-Z-]+(\s*[:|=])| @[_?$?a-z-|A-Z-]+(\s*)| /g, - 'operator': /[-+]{1,2}|!|=?<|=?>|={1,2}|(&){1,2}|\|?\||\?|\*|\//g + 'comment': comment, + 'interpolation': interpolation + } + } +}); + +Prism.languages.insertBefore('coffeescript', 'string', { + 'inline-javascript': { + pattern: /`(?:\\?[\s\S])*?`/g, + inside: { + 'delimiter': { + pattern: /^`|`$/g, + alias: 'punctuation' + }, + rest: Prism.languages.javascript } }, - 'attr-name': /[_?a-z-|A-Z-]+(\s*:)| @[_?$?a-z-|A-Z-]+(\s*)| /g + + // Block strings + 'multiline-string': [ + { + pattern: /'''[\s\S]*?'''/, + alias: 'string' + }, + { + pattern: /"""[\s\S]*?"""/, + alias: 'string', + inside: { + interpolation: interpolation + } + } + ] + }); + +Prism.languages.insertBefore('coffeescript', 'keyword', { + // Object property + 'property': /(?!\d)\w+(?=\s*:(?!:))/g +}); + +}(Prism)); \ No newline at end of file diff --git a/components/prism-coffeescript.min.js b/components/prism-coffeescript.min.js index 960017cade..6f871fff72 100644 --- a/components/prism-coffeescript.min.js +++ b/components/prism-coffeescript.min.js @@ -1 +1 @@ -Prism.languages.coffeescript=Prism.languages.extend("javascript",{comment:[/([#]{3}\s*\r?\n(.*\s*\r*\n*)\s*?\r?\n[#]{3})/g,/(\s|^)([#]{1}[^#^\r^\n]{2,}?(\r?\n|$))/g],keyword:/\b(and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\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}); \ No newline at end of file +!function(a){var b=/#(?!\{).+/g,c={pattern:/#\{[^}]+\}/g,alias:"variable"};a.languages.coffeescript=a.languages.extend("javascript",{comment:b,string:[/'(?:\\?[\s\S])*?'/g,{pattern:/"(?:\\?[\s\S])*?"/g,inside:{interpolation:c}}],keyword:/\b(and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/g,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),a.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/g,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:b,interpolation:c}}}),a.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\?[\s\S])*?`/g,inside:{delimiter:{pattern:/^`|`$/g,alias:"punctuation"},rest:a.languages.javascript}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,alias:"string"},{pattern:/"""[\s\S]*?"""/,alias:"string",inside:{interpolation:c}}]}),a.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/g})}(Prism); \ No newline at end of file From fd9cd8d3becf60e094d62eb9a992e594aefd7e18 Mon Sep 17 00:00:00 2001 From: Golmote Date: Thu, 11 Dec 2014 23:13:15 +0100 Subject: [PATCH 015/137] Use spaces for alignments --- download.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/download.js b/download.js index b56b28bf09..ccbeb2319d 100644 --- a/download.js +++ b/download.js @@ -26,8 +26,8 @@ var qstr = window.location.search.match(/(?:languages|plugins)=[-+\w]+|themes=[- if (qstr) { qstr.forEach(function(str) { var kv = str.split('=', 2), - category = kv[0], - ids = kv[1].split('+'); + category = kv[0], + ids = kv[1].split('+'); if (category !== 'meta' && category !== 'core' && components[category]) { for (var id in components[category]) { if (components[category][id].option) { @@ -379,7 +379,7 @@ function generateCode(){ function buildCode(promises) { var i = 0, - l = promises.length; + l = promises.length; var code = {js: '', css: ''}; var f = function(resolve) { if(i < l) { From af315b7c3f2b1e8575f763a2c4b9ae99d0e0f362 Mon Sep 17 00:00:00 2001 From: Golmote Date: Thu, 11 Dec 2014 23:15:18 +0100 Subject: [PATCH 016/137] Use spaces for alignments --- components/prism-coffeescript.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/prism-coffeescript.js b/components/prism-coffeescript.js index 2611dc35ae..6cf2c7e31a 100644 --- a/components/prism-coffeescript.js +++ b/components/prism-coffeescript.js @@ -2,10 +2,10 @@ // Ignore comments starting with { to privilege string interpolation highlighting var comment = /#(?!\{).+/g, - interpolation = { - pattern: /#\{[^}]+\}/g, - alias: 'variable' - }; + interpolation = { + pattern: /#\{[^}]+\}/g, + alias: 'variable' + }; Prism.languages.coffeescript = Prism.languages.extend('javascript', { 'comment': comment, From 3ad0af570af1a2fdd8db4926b8b36617cb425921 Mon Sep 17 00:00:00 2001 From: Golmote Date: Fri, 12 Dec 2014 08:20:57 +0100 Subject: [PATCH 017/137] Reject promise if file does not exist --- download.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/download.js b/download.js index ccbeb2319d..44a7299e5d 100644 --- a/download.js +++ b/download.js @@ -238,12 +238,14 @@ function getFilesSizes() { getFilesSizes(); function getFileContents(filepath) { - return new Promise(function(resolve) { + return new Promise(function(resolve, reject) { $u.xhr({ url: filepath, callback: function(xhr) { if (xhr.status < 400) { resolve(xhr.responseText); + } else { + reject(); } } }); @@ -350,6 +352,7 @@ function generateCode(){ promises.push({ contentsPromise: cache[path].contentsPromise, + path: path, type: type }); } @@ -389,6 +392,11 @@ function buildCode(promises) { i++; f(resolve); }); + p.contentsPromise['catch'](function() { + code[p.type] += '/* Error downloading file '+p.path+' */' + '\n'; + i++; + f(resolve); + }); } else { resolve(code); } From 93530f853fed660f9e951c7c70c5f8d4c3db5009 Mon Sep 17 00:00:00 2001 From: Golmote Date: Fri, 12 Dec 2014 08:54:55 +0100 Subject: [PATCH 018/137] Undo changes in css, just fix css-extras instead --- components/prism-css-extras.js | 2 +- components/prism-css.js | 11 ----------- components/prism-css.min.js | 2 +- prism.js | 11 ----------- 4 files changed, 2 insertions(+), 24 deletions(-) diff --git a/components/prism-css-extras.js b/components/prism-css-extras.js index 0118287143..e12c5b8dd0 100644 --- a/components/prism-css-extras.js +++ b/components/prism-css-extras.js @@ -8,7 +8,7 @@ Prism.languages.css.selector = { } }; -Prism.languages.insertBefore('css', 'ignore', { +Prism.languages.insertBefore('css', 'function', { 'hexcode': /#[\da-f]{3,6}/gi, 'entity': /\\[\da-f]{1,8}/gi, 'number': /[\d%\.]+/g diff --git a/components/prism-css.js b/components/prism-css.js index 3c97be7a22..5b027ee12f 100644 --- a/components/prism-css.js +++ b/components/prism-css.js @@ -12,17 +12,6 @@ Prism.languages.css = { 'string': /("|')(\\?.)*?\1/g, 'important': /\B!important\b/gi, 'punctuation': /[\{\};:]/g, - 'color': [ - { - pattern: /#(?:[0-9a-f]{3}){1,2}/ig, - alias: 'builtin' - }, - { - pattern: /(?:rgb|hsl)a?\(\s*\d+\s*(?:,\s*(?:\d+(?:\.\d*)?|\.\d+)%?\s*)+\)/, - alias: 'builtin' - } - ], - 'number': /(?:\d+(?:\.\d*)?|\.\d+)(?:%|ch|cm|deg|dpcm|dpi|dppx|ex|grad|k?Hz|in|mm|m?s|pc|pt|px|rad|r?em|turn|vh|vw|vmin|vmax)?/g, 'function': /[-a-z0-9]+(?=\()/ig }; diff --git a/components/prism-css.min.js b/components/prism-css.min.js index 1f4cc28624..c07e428a94 100644 --- a/components/prism-css.min.js +++ b/components/prism-css.min.js @@ -1 +1 @@ -Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/gi,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,punctuation:/[\{\};:]/g,color:[{pattern:/#(?:[0-9a-f]{3}){1,2}/gi,alias:"builtin"},{pattern:/(?:rgb|hsl)a?\(\s*\d+\s*(?:,\s*(?:\d+(?:\.\d*)?|\.\d+)%?\s*)+\)/,alias:"builtin"}],number:/(?:\d+(?:\.\d*)?|\.\d+)(?:%|ch|cm|deg|dpcm|dpi|dppx|ex|grad|k?Hz|in|mm|m?s|pc|pt|px|rad|r?em|turn|vh|vw|vmin|vmax)?/g,"function":/[-a-z0-9]+(?=\()/gi},Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/[\w\W]*?<\/style>/gi,inside:{tag:{pattern:/|<\/style>/gi,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css},alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').+?\1/gi,inside:{"attr-name":{pattern:/^\s*style/gi,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/gi,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)); \ No newline at end of file +Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/gi,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,punctuation:/[\{\};:]/g,"function":/[-a-z0-9]+(?=\()/gi},Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/[\w\W]*?<\/style>/gi,inside:{tag:{pattern:/|<\/style>/gi,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css},alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').+?\1/gi,inside:{"attr-name":{pattern:/^\s*style/gi,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/gi,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)); \ No newline at end of file diff --git a/prism.js b/prism.js index edb75cff77..6e610df117 100644 --- a/prism.js +++ b/prism.js @@ -494,17 +494,6 @@ Prism.languages.css = { 'string': /("|')(\\?.)*?\1/g, 'important': /\B!important\b/gi, 'punctuation': /[\{\};:]/g, - 'color': [ - { - pattern: /#(?:[0-9a-f]{3}){1,2}/ig, - alias: 'builtin' - }, - { - pattern: /(?:rgb|hsl)a?\(\s*\d+\s*(?:,\s*(?:\d+(?:\.\d*)?|\.\d+)%?\s*)+\)/, - alias: 'builtin' - } - ], - 'number': /(?:\d+(?:\.\d*)?|\.\d+)(?:%|ch|cm|deg|dpcm|dpi|dppx|ex|grad|k?Hz|in|mm|m?s|pc|pt|px|rad|r?em|turn|vh|vw|vmin|vmax)?/g, 'function': /[-a-z0-9]+(?=\()/ig }; From 65de193f600919a2494593fe2bf7b014f5426e3c Mon Sep 17 00:00:00 2001 From: Golmote Date: Fri, 12 Dec 2014 20:23:27 +0100 Subject: [PATCH 019/137] Add MATLAB language --- components.js | 4 ++++ components/prism-matlab.js | 19 +++++++++++++++++++ components/prism-matlab.min.js | 1 + 3 files changed, 24 insertions(+) create mode 100644 components/prism-matlab.js create mode 100644 components/prism-matlab.min.js diff --git a/components.js b/components.js index 7bae5697d4..3c928feafd 100644 --- a/components.js +++ b/components.js @@ -206,6 +206,10 @@ var components = { "handlebars": { "title": "Handlebars", "owner": "Golmote" + }, + "matlab": { + "title": "MATLAB", + "owner": "Golmote" } }, "plugins": { diff --git a/components/prism-matlab.js b/components/prism-matlab.js new file mode 100644 index 0000000000..e7875c497b --- /dev/null +++ b/components/prism-matlab.js @@ -0,0 +1,19 @@ +Prism.languages.matlab = { + /* + We put string before comment, because of printf() patterns + that cause many highlighting issues. + Having two single quotes inside a comment is probably + less common. + */ + 'string': /'(?:''|[^'\n])*'/g, + 'comment': [ + /%.+/g, + /%\{[\s\S]*?\}%/ + ], + // FIXME We could handle imaginary numbers as a whole + 'number': /\b-?(?:\d*\.?\d+(?:[eE][+-]?\d+)?(?:[ij])?|[ij])\b/g, + 'keyword': /\b(?:break|case|catch|continue|else|elseif|end|for|function|if|inf|NaN|otherwise|parfor|pause|pi|return|switch|try|while)\b/, + 'function': /(?!\d)\w+(?=\s*\()/g, + 'operator': /\.?[*^\/\\']|[+\-:@]|[<>=~]=?|&&?|\|\|?/g, + 'punctuation': /\.{3}|[.,;\[\](){}!]/g +}; \ No newline at end of file diff --git a/components/prism-matlab.min.js b/components/prism-matlab.min.js new file mode 100644 index 0000000000..70b7fadb7a --- /dev/null +++ b/components/prism-matlab.min.js @@ -0,0 +1 @@ +Prism.languages.matlab={string:/'(?:''|[^'\n])*'/g,comment:[/%.+/g,/%\{[\s\S]*?\}%/],number:/\b-?(?:\d*\.?\d+(?:[eE][+-]?\d+)?(?:[ij])?|[ij])\b/g,keyword:/\b(?:break|case|catch|continue|else|elseif|end|for|function|if|inf|NaN|otherwise|parfor|pause|pi|return|switch|try|while)\b/,"function":/(?!\d)\w+(?=\s*\()/g,operator:/\.?[*^\/\\']|[+\-:]|[<>=~]=?|&&?|\|\|?/g,punctuation:/\.{3}|[.,;\[\](){}!@]/g}; \ No newline at end of file From e36045f87656e9a2675011d9ee23f87f037dbb77 Mon Sep 17 00:00:00 2001 From: Golmote Date: Fri, 12 Dec 2014 21:39:53 +0100 Subject: [PATCH 020/137] Improved string regexp to not mess with matrix transposition --- components/prism-matlab.js | 12 +++++------- components/prism-matlab.min.js | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/components/prism-matlab.js b/components/prism-matlab.js index e7875c497b..820b20598b 100644 --- a/components/prism-matlab.js +++ b/components/prism-matlab.js @@ -1,11 +1,9 @@ Prism.languages.matlab = { - /* - We put string before comment, because of printf() patterns - that cause many highlighting issues. - Having two single quotes inside a comment is probably - less common. - */ - 'string': /'(?:''|[^'\n])*'/g, + // We put string before comment, because of printf() patterns that contain "%" + 'string': { + pattern: /(^|\W)'(?:''|[^'\n])*'/g, + lookbehind: true + }, 'comment': [ /%.+/g, /%\{[\s\S]*?\}%/ diff --git a/components/prism-matlab.min.js b/components/prism-matlab.min.js index 70b7fadb7a..8029165d7f 100644 --- a/components/prism-matlab.min.js +++ b/components/prism-matlab.min.js @@ -1 +1 @@ -Prism.languages.matlab={string:/'(?:''|[^'\n])*'/g,comment:[/%.+/g,/%\{[\s\S]*?\}%/],number:/\b-?(?:\d*\.?\d+(?:[eE][+-]?\d+)?(?:[ij])?|[ij])\b/g,keyword:/\b(?:break|case|catch|continue|else|elseif|end|for|function|if|inf|NaN|otherwise|parfor|pause|pi|return|switch|try|while)\b/,"function":/(?!\d)\w+(?=\s*\()/g,operator:/\.?[*^\/\\']|[+\-:]|[<>=~]=?|&&?|\|\|?/g,punctuation:/\.{3}|[.,;\[\](){}!@]/g}; \ No newline at end of file +Prism.languages.matlab={string:{pattern:/(^|\W)'(?:''|[^'\n])*'/g,lookbehind:!0},comment:[/%.+/g,/%\{[\s\S]*?\}%/],number:/\b-?(?:\d*\.?\d+(?:[eE][+-]?\d+)?(?:[ij])?|[ij])\b/g,keyword:/\b(?:break|case|catch|continue|else|elseif|end|for|function|if|inf|NaN|otherwise|parfor|pause|pi|return|switch|try|while)\b/,"function":/(?!\d)\w+(?=\s*\()/g,operator:/\.?[*^\/\\']|[+\-:@]|[<>=~]=?|&&?|\|\|?/g,punctuation:/\.{3}|[.,;\[\](){}!]/g}; \ No newline at end of file From d63e397dcdcbdbd07c38fc7661dd77fcd3ef184f Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 13 Dec 2014 00:58:56 +0100 Subject: [PATCH 021/137] Fixed multiline comments --- components/prism-matlab.js | 4 ++-- components/prism-matlab.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/prism-matlab.js b/components/prism-matlab.js index 820b20598b..0adcd729c9 100644 --- a/components/prism-matlab.js +++ b/components/prism-matlab.js @@ -5,8 +5,8 @@ Prism.languages.matlab = { lookbehind: true }, 'comment': [ - /%.+/g, - /%\{[\s\S]*?\}%/ + /%\{[\s\S]*?\}%/g, + /%.+/g ], // FIXME We could handle imaginary numbers as a whole 'number': /\b-?(?:\d*\.?\d+(?:[eE][+-]?\d+)?(?:[ij])?|[ij])\b/g, diff --git a/components/prism-matlab.min.js b/components/prism-matlab.min.js index 8029165d7f..3e4267f054 100644 --- a/components/prism-matlab.min.js +++ b/components/prism-matlab.min.js @@ -1 +1 @@ -Prism.languages.matlab={string:{pattern:/(^|\W)'(?:''|[^'\n])*'/g,lookbehind:!0},comment:[/%.+/g,/%\{[\s\S]*?\}%/],number:/\b-?(?:\d*\.?\d+(?:[eE][+-]?\d+)?(?:[ij])?|[ij])\b/g,keyword:/\b(?:break|case|catch|continue|else|elseif|end|for|function|if|inf|NaN|otherwise|parfor|pause|pi|return|switch|try|while)\b/,"function":/(?!\d)\w+(?=\s*\()/g,operator:/\.?[*^\/\\']|[+\-:@]|[<>=~]=?|&&?|\|\|?/g,punctuation:/\.{3}|[.,;\[\](){}!]/g}; \ No newline at end of file +Prism.languages.matlab={string:{pattern:/(^|\W)'(?:''|[^'\n])*'/g,lookbehind:!0},comment:[/%\{[\s\S]*?\}%/g,/%.+/g],number:/\b-?(?:\d*\.?\d+(?:[eE][+-]?\d+)?(?:[ij])?|[ij])\b/g,keyword:/\b(?:break|case|catch|continue|else|elseif|end|for|function|if|inf|NaN|otherwise|parfor|pause|pi|return|switch|try|while)\b/,"function":/(?!\d)\w+(?=\s*\()/g,operator:/\.?[*^\/\\']|[+\-:@]|[<>=~]=?|&&?|\|\|?/g,punctuation:/\.{3}|[.,;\[\](){}!]/g}; \ No newline at end of file From 714b6a5a0c7f4389e782587e9ac81a1f15d18044 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 13 Dec 2014 09:43:24 +0100 Subject: [PATCH 022/137] Removed test code... --- components/prism-handlebars.js | 2 -- components/prism-handlebars.min.js | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/components/prism-handlebars.js b/components/prism-handlebars.js index 3d6cccf7a1..c9db2b5f1b 100644 --- a/components/prism-handlebars.js +++ b/components/prism-handlebars.js @@ -36,7 +36,6 @@ if (Prism.languages.markup) { // Tokenize all inline Handlebars expressions that are wrapped in {{ }} or {{{ }}} // This allows for easy Handlebars + markup highlighting Prism.hooks.add('before-highlight', function(env) { - console.log(env.language); if (env.language !== 'handlebars') { return; } @@ -45,7 +44,6 @@ if (Prism.languages.markup) { env.backupCode = env.code; env.code = env.code.replace(/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/ig, function(match) { - console.log(match); env.tokenStack.push(match); return '___HANDLEBARS' + env.tokenStack.length + '___'; diff --git a/components/prism-handlebars.min.js b/components/prism-handlebars.min.js index 4de5ee8049..903b2853ea 100644 --- a/components/prism-handlebars.min.js +++ b/components/prism-handlebars.min.js @@ -1 +1 @@ -Prism.languages.handlebars={expression:{pattern:/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g,inside:{comment:{pattern:/(\{\{)![\w\W]*(?=\}\})/g,lookbehind:!0},delimiter:{pattern:/^\{\{\{?|\}\}\}?$/gi,alias:"punctuation"},string:/(["'])(\\?.)+?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,"boolean":/\b(true|false)\b/g,block:{pattern:/^(\s*~?\s*)[#\/]\w+/gi,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/g,variable:/[\w\W]+/g}},punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g}}},Prism.languages.markup&&(Prism.hooks.add("before-highlight",function(a){console.log(a.language),"handlebars"===a.language&&(a.tokenStack=[],a.backupCode=a.code,a.code=a.code.replace(/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/gi,function(b){return console.log(b),a.tokenStack.push(b),"___HANDLEBARS"+a.tokenStack.length+"___"}))}),Prism.hooks.add("before-insert",function(a){"handlebars"===a.language&&(a.code=a.backupCode,delete a.backupCode)}),Prism.hooks.add("after-highlight",function(a){if("handlebars"===a.language){for(var c,b=0;c=a.tokenStack[b];b++)a.highlightedCode=a.highlightedCode.replace("___HANDLEBARS"+(b+1)+"___",Prism.highlight(c,a.grammar,"handlebars"));a.element.innerHTML=a.highlightedCode}}),Prism.hooks.add("wrap",function(a){"handlebars"===a.language&&"markup"===a.type&&(a.content=a.content.replace(/(___HANDLEBARS[0-9]+___)/g,'$1'))}),Prism.languages.insertBefore("handlebars","expression",{markup:{pattern:/<[^?]\/?(.*?)>/g,inside:Prism.languages.markup},handlebars:/___HANDLEBARS[0-9]+___/g})); \ No newline at end of file +Prism.languages.handlebars={expression:{pattern:/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g,inside:{comment:{pattern:/(\{\{)![\w\W]*(?=\}\})/g,lookbehind:!0},delimiter:{pattern:/^\{\{\{?|\}\}\}?$/gi,alias:"punctuation"},string:/(["'])(\\?.)+?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,"boolean":/\b(true|false)\b/g,block:{pattern:/^(\s*~?\s*)[#\/]\w+/gi,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/g,variable:/[\w\W]+/g}},punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g}}},Prism.languages.markup&&(Prism.hooks.add("before-highlight",function(a){"handlebars"===a.language&&(a.tokenStack=[],a.backupCode=a.code,a.code=a.code.replace(/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/gi,function(b){return a.tokenStack.push(b),"___HANDLEBARS"+a.tokenStack.length+"___"}))}),Prism.hooks.add("before-insert",function(a){"handlebars"===a.language&&(a.code=a.backupCode,delete a.backupCode)}),Prism.hooks.add("after-highlight",function(a){if("handlebars"===a.language){for(var c,b=0;c=a.tokenStack[b];b++)a.highlightedCode=a.highlightedCode.replace("___HANDLEBARS"+(b+1)+"___",Prism.highlight(c,a.grammar,"handlebars"));a.element.innerHTML=a.highlightedCode}}),Prism.hooks.add("wrap",function(a){"handlebars"===a.language&&"markup"===a.type&&(a.content=a.content.replace(/(___HANDLEBARS[0-9]+___)/g,'$1'))}),Prism.languages.insertBefore("handlebars","expression",{markup:{pattern:/<[^?]\/?(.*?)>/g,inside:Prism.languages.markup},handlebars:/___HANDLEBARS[0-9]+___/g})); \ No newline at end of file From ea170578845d7888caa43e5dcd3741ea4271031b Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 14 Dec 2014 18:42:43 +0100 Subject: [PATCH 023/137] Add Less language --- components.js | 4 +++ components/prism-less.js | 64 ++++++++++++++++++++++++++++++++++++ components/prism-less.min.js | 1 + 3 files changed, 69 insertions(+) create mode 100644 components/prism-less.js create mode 100644 components/prism-less.min.js diff --git a/components.js b/components.js index 7bae5697d4..4da07af499 100644 --- a/components.js +++ b/components.js @@ -206,6 +206,10 @@ var components = { "handlebars": { "title": "Handlebars", "owner": "Golmote" + }, + "less": { + "title": "Less", + "owner": "Golmote" } }, "plugins": { diff --git a/components/prism-less.js b/components/prism-less.js new file mode 100644 index 0000000000..7953b3960b --- /dev/null +++ b/components/prism-less.js @@ -0,0 +1,64 @@ +/* FIXME : + :extend() is not handled specifically : its highlighting is buggy. + Mixin usage must be inside a ruleset to be highlighted. + At-rules (e.g. import) containing interpolations are buggy. + Detached rulesets are highlighted as at-rules. + A comment before a mixin usage prevents the latter to be properly highlighted. + */ + +Prism.languages.less = Prism.languages.extend('css', { + 'comment': [ + /\/\*[\w\W]*?\*\//g, + { + pattern: /(^|[^\\])\/\/.+/g, + lookbehind: true + } + ], + 'atrule': { + pattern: /@[\w-]+?(?:\([^{}]+\)|[^(){};])*?(?=\s*\{)/gi, + inside: { + 'punctuation': /[:()]/g + } + }, + // selectors and mixins are considered the same + 'selector': { + //pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|[^{};@])*?(?:\([^)]*\))?(?=\s*\{)/g, + pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/g, + inside: { + // mixin parameters + 'variable': /@+[\w-]+/ + } + }, + + 'property': /(\b|\B)(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/ig, + 'punctuation': /[{}();:,]/g, + 'operator': /[+\-*\/]/ +}); + +// Invert function and punctuation positions +Prism.languages.insertBefore('less', 'punctuation', { + 'function': Prism.languages.less.function +}); + +Prism.languages.insertBefore('less', 'property', { + 'variable': [ + // declaration + { + pattern: /@[\w-]+\s*:/, + inside: { + "punctuation": /:/ + } + }, + + // usage + /@@?[\w-]+/ + ] +}); + +Prism.languages.insertBefore('less', 'property', { + 'mixin-usage': { + pattern: /([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/, + lookbehind: true, + alias: 'function' + } +}); \ No newline at end of file diff --git a/components/prism-less.min.js b/components/prism-less.min.js new file mode 100644 index 0000000000..8f4d2400e8 --- /dev/null +++ b/components/prism-less.min.js @@ -0,0 +1 @@ +Prism.languages.less=Prism.languages.extend("css",{comment:[/\/\*[\w\W]*?\*\//g,{pattern:/(^|[^\\])\/\/.+/g,lookbehind:!0}],atrule:{pattern:/@[\w-]+?(?:\([^{}]+\)|[^(){};])*?(?=\s*\{)/gi,inside:{punctuation:/[:()]/g}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/g,inside:{variable:/@+[\w-]+/}},property:/(\b|\B)(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/gi,punctuation:/[{}();:,]/g,operator:/[+\-*\/]/}),Prism.languages.insertBefore("less","punctuation",{"function":Prism.languages.less.function}),Prism.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/]}),Prism.languages.insertBefore("less","property",{"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/,lookbehind:!0,alias:"function"}}); \ No newline at end of file From 1bc55bdd10d8595a0d1c928b8fee55d0cc251b5f Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 14 Dec 2014 18:46:15 +0100 Subject: [PATCH 024/137] Removed useless comment and reformatted Less component --- components/prism-less.js | 10 +++------- components/prism-less.min.js | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/components/prism-less.js b/components/prism-less.js index 7953b3960b..995f3bee97 100644 --- a/components/prism-less.js +++ b/components/prism-less.js @@ -22,7 +22,6 @@ Prism.languages.less = Prism.languages.extend('css', { }, // selectors and mixins are considered the same 'selector': { - //pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|[^{};@])*?(?:\([^)]*\))?(?=\s*\{)/g, pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/g, inside: { // mixin parameters @@ -42,7 +41,7 @@ Prism.languages.insertBefore('less', 'punctuation', { Prism.languages.insertBefore('less', 'property', { 'variable': [ - // declaration + // Variable declaration (the colon must be consumed!) { pattern: /@[\w-]+\s*:/, inside: { @@ -50,12 +49,9 @@ Prism.languages.insertBefore('less', 'property', { } }, - // usage + // Variable usage /@@?[\w-]+/ - ] -}); - -Prism.languages.insertBefore('less', 'property', { + ], 'mixin-usage': { pattern: /([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/, lookbehind: true, diff --git a/components/prism-less.min.js b/components/prism-less.min.js index 8f4d2400e8..13d53f6213 100644 --- a/components/prism-less.min.js +++ b/components/prism-less.min.js @@ -1 +1 @@ -Prism.languages.less=Prism.languages.extend("css",{comment:[/\/\*[\w\W]*?\*\//g,{pattern:/(^|[^\\])\/\/.+/g,lookbehind:!0}],atrule:{pattern:/@[\w-]+?(?:\([^{}]+\)|[^(){};])*?(?=\s*\{)/gi,inside:{punctuation:/[:()]/g}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/g,inside:{variable:/@+[\w-]+/}},property:/(\b|\B)(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/gi,punctuation:/[{}();:,]/g,operator:/[+\-*\/]/}),Prism.languages.insertBefore("less","punctuation",{"function":Prism.languages.less.function}),Prism.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/]}),Prism.languages.insertBefore("less","property",{"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/,lookbehind:!0,alias:"function"}}); \ No newline at end of file +Prism.languages.less=Prism.languages.extend("css",{comment:[/\/\*[\w\W]*?\*\//g,{pattern:/(^|[^\\])\/\/.+/g,lookbehind:!0}],atrule:{pattern:/@[\w-]+?(?:\([^{}]+\)|[^(){};])*?(?=\s*\{)/gi,inside:{punctuation:/[:()]/g}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/g,inside:{variable:/@+[\w-]+/}},property:/(\b|\B)(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/gi,punctuation:/[{}();:,]/g,operator:/[+\-*\/]/}),Prism.languages.insertBefore("less","punctuation",{"function":Prism.languages.less.function}),Prism.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/,lookbehind:!0,alias:"function"}}); \ No newline at end of file From 4a81e9d3693d7e174075961a6e514223fb980896 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 14 Dec 2014 23:59:57 +0100 Subject: [PATCH 025/137] Rewrote Handlebars for better intergration with markup, css, js --- components/prism-handlebars.js | 89 +++++++++++++----------------- components/prism-handlebars.min.js | 2 +- 2 files changed, 39 insertions(+), 52 deletions(-) diff --git a/components/prism-handlebars.js b/components/prism-handlebars.js index c9db2b5f1b..8ce68089c2 100644 --- a/components/prism-handlebars.js +++ b/components/prism-handlebars.js @@ -1,37 +1,39 @@ -Prism.languages.handlebars = { - 'expression': { - pattern: /\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g, - inside: { - 'comment': { - pattern: /(\{\{)![\w\W]*(?=\}\})/g, - lookbehind: true - }, - 'delimiter': { - pattern: /^\{\{\{?|\}\}\}?$/ig, - alias: 'punctuation' - }, - 'string': /(["'])(\\?.)+?\1/g, - 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g, - 'boolean': /\b(true|false)\b/g, - 'block': { - pattern: /^(\s*~?\s*)[#\/]\w+/ig, - lookbehind: true, - alias: 'keyword' - }, - 'brackets': { - pattern: /\[[^\]]+\]/, - inside: { - punctuation: /\[|\]/g, - variable: /[\w\W]+/g - } - }, - 'punctuation': /[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g, - 'variable': /[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g - } - } -}; +(function(Prism) { + + Prism.languages.handlebars = Prism.languages.extend('markup', {}); -if (Prism.languages.markup) { + var grammar = { + 'handlebars': { + pattern: /\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g, + inside: { + 'comment': { + pattern: /(\{\{)![\w\W]*(?=\}\})/g, + lookbehind: true + }, + 'delimiter': { + pattern: /^\{\{\{?|\}\}\}?$/ig, + alias: 'punctuation' + }, + 'string': /(["'])(\\?.)+?\1/g, + 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g, + 'boolean': /\b(true|false)\b/g, + 'block': { + pattern: /^(\s*~?\s*)[#\/]\w+/ig, + lookbehind: true, + alias: 'keyword' + }, + 'brackets': { + pattern: /\[[^\]]+\]/, + inside: { + punctuation: /\[|\]/g, + variable: /[\w\W]+/g + } + }, + 'punctuation': /[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g, + 'variable': /[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g + } + } + }; // Tokenize all inline Handlebars expressions that are wrapped in {{ }} or {{{ }}} // This allows for easy Handlebars + markup highlighting @@ -59,32 +61,17 @@ if (Prism.languages.markup) { }); // Re-insert the tokens after highlighting + // and highlight them with defined grammar Prism.hooks.add('after-highlight', function(env) { if (env.language !== 'handlebars') { return; } for (var i = 0, t; t = env.tokenStack[i]; i++) { - env.highlightedCode = env.highlightedCode.replace('___HANDLEBARS' + (i + 1) + '___', Prism.highlight(t, env.grammar, 'handlebars')); + env.highlightedCode = env.highlightedCode.replace('___HANDLEBARS' + (i + 1) + '___', Prism.highlight(t, grammar, 'handlebars')); } env.element.innerHTML = env.highlightedCode; }); - // Wrap tokens in classes that are missing them - Prism.hooks.add('wrap', function(env) { - if (env.language === 'handlebars' && env.type === 'markup') { - env.content = env.content.replace(/(___HANDLEBARS[0-9]+___)/g, "$1"); - } - }); - - // Add the rules before all others - Prism.languages.insertBefore('handlebars', 'expression', { - 'markup': { - pattern: /<[^?]\/?(.*?)>/g, - inside: Prism.languages.markup - }, - 'handlebars': /___HANDLEBARS[0-9]+___/g - }); -} - +}(Prism)); \ No newline at end of file diff --git a/components/prism-handlebars.min.js b/components/prism-handlebars.min.js index 903b2853ea..a7e9cacb59 100644 --- a/components/prism-handlebars.min.js +++ b/components/prism-handlebars.min.js @@ -1 +1 @@ -Prism.languages.handlebars={expression:{pattern:/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g,inside:{comment:{pattern:/(\{\{)![\w\W]*(?=\}\})/g,lookbehind:!0},delimiter:{pattern:/^\{\{\{?|\}\}\}?$/gi,alias:"punctuation"},string:/(["'])(\\?.)+?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,"boolean":/\b(true|false)\b/g,block:{pattern:/^(\s*~?\s*)[#\/]\w+/gi,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/g,variable:/[\w\W]+/g}},punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g}}},Prism.languages.markup&&(Prism.hooks.add("before-highlight",function(a){"handlebars"===a.language&&(a.tokenStack=[],a.backupCode=a.code,a.code=a.code.replace(/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/gi,function(b){return a.tokenStack.push(b),"___HANDLEBARS"+a.tokenStack.length+"___"}))}),Prism.hooks.add("before-insert",function(a){"handlebars"===a.language&&(a.code=a.backupCode,delete a.backupCode)}),Prism.hooks.add("after-highlight",function(a){if("handlebars"===a.language){for(var c,b=0;c=a.tokenStack[b];b++)a.highlightedCode=a.highlightedCode.replace("___HANDLEBARS"+(b+1)+"___",Prism.highlight(c,a.grammar,"handlebars"));a.element.innerHTML=a.highlightedCode}}),Prism.hooks.add("wrap",function(a){"handlebars"===a.language&&"markup"===a.type&&(a.content=a.content.replace(/(___HANDLEBARS[0-9]+___)/g,'$1'))}),Prism.languages.insertBefore("handlebars","expression",{markup:{pattern:/<[^?]\/?(.*?)>/g,inside:Prism.languages.markup},handlebars:/___HANDLEBARS[0-9]+___/g})); \ No newline at end of file +!function(a){a.languages.handlebars=a.languages.extend("markup",{});var b={handlebars:{pattern:/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g,inside:{comment:{pattern:/(\{\{)![\w\W]*(?=\}\})/g,lookbehind:!0},delimiter:{pattern:/^\{\{\{?|\}\}\}?$/gi,alias:"punctuation"},string:/(["'])(\\?.)+?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,"boolean":/\b(true|false)\b/g,block:{pattern:/^(\s*~?\s*)[#\/]\w+/gi,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/g,variable:/[\w\W]+/g}},punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g}}};a.hooks.add("before-highlight",function(a){"handlebars"===a.language&&(a.tokenStack=[],a.backupCode=a.code,a.code=a.code.replace(/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/gi,function(b){return a.tokenStack.push(b),"___HANDLEBARS"+a.tokenStack.length+"___"}))}),a.hooks.add("before-insert",function(a){"handlebars"===a.language&&(a.code=a.backupCode,delete a.backupCode)}),a.hooks.add("after-highlight",function(c){if("handlebars"===c.language){for(var e,d=0;e=c.tokenStack[d];d++)c.highlightedCode=c.highlightedCode.replace("___HANDLEBARS"+(d+1)+"___",a.highlight(e,b,"handlebars"));c.element.innerHTML=c.highlightedCode}})}(Prism); \ No newline at end of file From c98b3c043cfa3009be0da77a2923e8ca598d98f5 Mon Sep 17 00:00:00 2001 From: Golmote Date: Mon, 15 Dec 2014 00:10:11 +0100 Subject: [PATCH 026/137] Keep grammar accessible and be a bit more DRY --- components/prism-handlebars.js | 14 +++++++------- components/prism-handlebars.min.js | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/components/prism-handlebars.js b/components/prism-handlebars.js index 8ce68089c2..2142586ba3 100644 --- a/components/prism-handlebars.js +++ b/components/prism-handlebars.js @@ -1,10 +1,10 @@ (function(Prism) { - Prism.languages.handlebars = Prism.languages.extend('markup', {}); - - var grammar = { + var handlebars_pattern = /\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g; + + Prism.languages.handlebars = Prism.languages.extend('markup', { 'handlebars': { - pattern: /\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g, + pattern: handlebars_pattern, inside: { 'comment': { pattern: /(\{\{)![\w\W]*(?=\}\})/g, @@ -33,7 +33,7 @@ 'variable': /[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g } } - }; + }); // Tokenize all inline Handlebars expressions that are wrapped in {{ }} or {{{ }}} // This allows for easy Handlebars + markup highlighting @@ -45,7 +45,7 @@ env.tokenStack = []; env.backupCode = env.code; - env.code = env.code.replace(/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/ig, function(match) { + env.code = env.code.replace(handlebars_pattern, function(match) { env.tokenStack.push(match); return '___HANDLEBARS' + env.tokenStack.length + '___'; @@ -68,7 +68,7 @@ } for (var i = 0, t; t = env.tokenStack[i]; i++) { - env.highlightedCode = env.highlightedCode.replace('___HANDLEBARS' + (i + 1) + '___', Prism.highlight(t, grammar, 'handlebars')); + env.highlightedCode = env.highlightedCode.replace('___HANDLEBARS' + (i + 1) + '___', Prism.highlight(t, env.grammar, 'handlebars')); } env.element.innerHTML = env.highlightedCode; diff --git a/components/prism-handlebars.min.js b/components/prism-handlebars.min.js index a7e9cacb59..8f32ed6b07 100644 --- a/components/prism-handlebars.min.js +++ b/components/prism-handlebars.min.js @@ -1 +1 @@ -!function(a){a.languages.handlebars=a.languages.extend("markup",{});var b={handlebars:{pattern:/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g,inside:{comment:{pattern:/(\{\{)![\w\W]*(?=\}\})/g,lookbehind:!0},delimiter:{pattern:/^\{\{\{?|\}\}\}?$/gi,alias:"punctuation"},string:/(["'])(\\?.)+?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,"boolean":/\b(true|false)\b/g,block:{pattern:/^(\s*~?\s*)[#\/]\w+/gi,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/g,variable:/[\w\W]+/g}},punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g}}};a.hooks.add("before-highlight",function(a){"handlebars"===a.language&&(a.tokenStack=[],a.backupCode=a.code,a.code=a.code.replace(/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/gi,function(b){return a.tokenStack.push(b),"___HANDLEBARS"+a.tokenStack.length+"___"}))}),a.hooks.add("before-insert",function(a){"handlebars"===a.language&&(a.code=a.backupCode,delete a.backupCode)}),a.hooks.add("after-highlight",function(c){if("handlebars"===c.language){for(var e,d=0;e=c.tokenStack[d];d++)c.highlightedCode=c.highlightedCode.replace("___HANDLEBARS"+(d+1)+"___",a.highlight(e,b,"handlebars"));c.element.innerHTML=c.highlightedCode}})}(Prism); \ No newline at end of file +!function(a){var b=/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g;a.languages.handlebars=a.languages.extend("markup",{handlebars:{pattern:b,inside:{comment:{pattern:/(\{\{)![\w\W]*(?=\}\})/g,lookbehind:!0},delimiter:{pattern:/^\{\{\{?|\}\}\}?$/gi,alias:"punctuation"},string:/(["'])(\\?.)+?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,"boolean":/\b(true|false)\b/g,block:{pattern:/^(\s*~?\s*)[#\/]\w+/gi,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/g,variable:/[\w\W]+/g}},punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g}}}),a.hooks.add("before-highlight",function(a){"handlebars"===a.language&&(a.tokenStack=[],a.backupCode=a.code,a.code=a.code.replace(b,function(b){return a.tokenStack.push(b),"___HANDLEBARS"+a.tokenStack.length+"___"}))}),a.hooks.add("before-insert",function(a){"handlebars"===a.language&&(a.code=a.backupCode,delete a.backupCode)}),a.hooks.add("after-highlight",function(b){if("handlebars"===b.language){for(var d,c=0;d=b.tokenStack[c];c++)b.highlightedCode=b.highlightedCode.replace("___HANDLEBARS"+(c+1)+"___",a.highlight(d,b.grammar,"handlebars"));b.element.innerHTML=b.highlightedCode}})}(Prism); \ No newline at end of file From ecedf4a71638c39782c69b540953555e52a9fef1 Mon Sep 17 00:00:00 2001 From: Golmote Date: Mon, 15 Dec 2014 00:55:58 +0100 Subject: [PATCH 027/137] Update components to add dependency --- components.js | 1 + 1 file changed, 1 insertion(+) diff --git a/components.js b/components.js index 7bae5697d4..9e007a176f 100644 --- a/components.js +++ b/components.js @@ -205,6 +205,7 @@ var components = { }, "handlebars": { "title": "Handlebars", + "require": "markup", "owner": "Golmote" } }, From 0f9da40b418fa7bdb53e874a954f040446a4b6cf Mon Sep 17 00:00:00 2001 From: Golmote Date: Mon, 15 Dec 2014 20:03:39 +0100 Subject: [PATCH 028/137] Add Smarty language --- components.js | 4 ++ components/prism-smarty.js | 124 +++++++++++++++++++++++++++++++++ components/prism-smarty.min.js | 1 + 3 files changed, 129 insertions(+) create mode 100644 components/prism-smarty.js create mode 100644 components/prism-smarty.min.js diff --git a/components.js b/components.js index 7bae5697d4..81e4343dc8 100644 --- a/components.js +++ b/components.js @@ -206,6 +206,10 @@ var components = { "handlebars": { "title": "Handlebars", "owner": "Golmote" + }, + "smarty": { + "title": "Smarty", + "owner": "Golmote" } }, "plugins": { diff --git a/components/prism-smarty.js b/components/prism-smarty.js new file mode 100644 index 0000000000..4466b2e07b --- /dev/null +++ b/components/prism-smarty.js @@ -0,0 +1,124 @@ +/* TODO + Add support for variables inside double quoted strings + Add support for {php} +*/ + +(function(Prism) { + + var smarty_pattern = /\{\*[\w\W]+?\*\}|\{[\w\W]+?\}/g; + var smarty_litteral_start = '{literal}'; + var smarty_litteral_end = '{/literal}'; + var smarty_litteral_mode = false; + + Prism.languages.smarty = Prism.languages.extend('markup', { + 'smarty': { + pattern: smarty_pattern, + inside: { + 'delimiter': { + pattern: /^\{|\}$/ig, + alias: 'punctuation' + }, + 'string': /(["'])(\\?.)*?\1/g, + 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g, + 'variable': [ + /\$(?!\d)\w+/g, + /#(?!\d)\w+#/g, + { + pattern: /(\.|->)(?!\d)\w+/g, + lookbehind: true + }, + { + pattern: /(\[)(?!\d)\w+(?=\])/g, + lookbehind: true + } + ], + 'function': [ + { + pattern: /(\|\s*)@?(?!\d)\w+/, + lookbehind: true + }, + /^\/?(?!\d)\w+/g, + /(?!\d)\w+(?=\()/g + ], + 'attr-name': { + // Value is made optional because it may have already been tokenized + pattern: /\w+\s*=\s*(?:(?!\d)\w+)?/g, + inside: { + "variable": { + pattern: /(=\s*)(?!\d)\w+/g, + lookbehind: true + }, + "punctuation": /=/g + } + }, + 'punctuation': /[\[\]().,=\|:`]|\->/g, + 'operator': [ + /[+\-*\/%]|===?|[!<>]=?|&&|\|\|/g, + /\bis\s+(?:not\s+)?(?:div|even|odd)(?:\s+by)?\b/, + /\b(?:eq|neq?|gt|lt|gt?e|lt?e|not|mod|or|and)\b/g + ], + 'keyword': /\b(?:false|off|on|no|true|yes)\b/g, + } + } + }); + + // Comments are inserted at top so that they can + // surround markup + Prism.languages.insertBefore('smarty', 'tag', { + 'smarty-comment': { + pattern: /\{\*[\w\W]*?\*\}/g, + alias: ['smarty','comment'] + } + }); + + // Tokenize all inline Smarty expressions + Prism.hooks.add('before-highlight', function(env) { + if (env.language !== 'smarty') { + return; + } + + env.tokenStack = []; + + env.backupCode = env.code; + env.code = env.code.replace(smarty_pattern, function(match) { + + // Smarty tags inside {literal} block are ignored + if(match === smarty_litteral_end) { + smarty_litteral_mode = false; + } + + if(!smarty_litteral_mode) { + if(match === smarty_litteral_start) { + smarty_litteral_mode = true; + } + env.tokenStack.push(match); + + return '___SMARTY' + env.tokenStack.length + '___'; + } + return match; + }); + }); + + // Restore env.code for other plugins (e.g. line-numbers) + Prism.hooks.add('before-insert', function(env) { + if (env.language === 'smarty') { + env.code = env.backupCode; + delete env.backupCode; + } + }); + + // Re-insert the tokens after highlighting + // and highlight them with defined grammar + Prism.hooks.add('after-highlight', function(env) { + if (env.language !== 'smarty') { + return; + } + + for (var i = 0, t; t = env.tokenStack[i]; i++) { + env.highlightedCode = env.highlightedCode.replace('___SMARTY' + (i + 1) + '___', Prism.highlight(t, env.grammar, 'smarty')); + } + + env.element.innerHTML = env.highlightedCode; + }); + +}(Prism)); \ No newline at end of file diff --git a/components/prism-smarty.min.js b/components/prism-smarty.min.js new file mode 100644 index 0000000000..ce5f81b20f --- /dev/null +++ b/components/prism-smarty.min.js @@ -0,0 +1 @@ +!function(a){var b=/\{\*[\w\W]+?\*\}|\{[\w\W]+?\}/g,c="{literal}",d="{/literal}",e=!1;a.languages.smarty=a.languages.extend("markup",{smarty:{pattern:b,inside:{delimiter:{pattern:/^\{|\}$/gi,alias:"punctuation"},string:/(["'])(\\?.)*?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,variable:[/\$(?!\d)\w+/g,/#(?!\d)\w+#/g,{pattern:/(\.|->)(?!\d)\w+/g,lookbehind:!0},{pattern:/(\[)(?!\d)\w+(?=\])/g,lookbehind:!0}],"function":[{pattern:/(\|\s*)@?(?!\d)\w+/,lookbehind:!0},/^\/?(?!\d)\w+/g,/(?!\d)\w+(?=\()/g],"attr-name":{pattern:/\w+\s*=\s*(?:(?!\d)\w+)?/g,inside:{variable:{pattern:/(=\s*)(?!\d)\w+/g,lookbehind:!0},punctuation:/=/g}},punctuation:/[\[\]().,=\|:`]|\->/g,operator:[/[+\-*\/%]|===?|[!<>]=?|&&|\|\|/g,/\bis\s+(?:not\s+)?(?:div|even|odd)(?:\s+by)?\b/,/\b(?:eq|neq?|gt|lt|gt?e|lt?e|not|mod|or|and)\b/g],keyword:/\b(?:false|off|on|no|true|yes)\b/g}}}),a.languages.insertBefore("smarty","tag",{"smarty-comment":{pattern:/\{\*[\w\W]*?\*\}/g,alias:["smarty","comment"]}}),a.hooks.add("before-highlight",function(a){"smarty"===a.language&&(a.tokenStack=[],a.backupCode=a.code,a.code=a.code.replace(b,function(b){return b===d&&(e=!1),e?b:(b===c&&(e=!0),a.tokenStack.push(b),"___SMARTY"+a.tokenStack.length+"___")}))}),a.hooks.add("before-insert",function(a){"smarty"===a.language&&(a.code=a.backupCode,delete a.backupCode)}),a.hooks.add("after-highlight",function(b){if("smarty"===b.language){for(var d,c=0;d=b.tokenStack[c];c++)b.highlightedCode=b.highlightedCode.replace("___SMARTY"+(c+1)+"___",a.highlight(d,b.grammar,"smarty"));b.element.innerHTML=b.highlightedCode}})}(Prism); \ No newline at end of file From 74b15765d98694fc5a20a2e7bddbd548c3e6e4e9 Mon Sep 17 00:00:00 2001 From: Golmote Date: Mon, 15 Dec 2014 21:25:48 +0100 Subject: [PATCH 029/137] Move comments at the top of the grammar so they can surround markup --- components/prism-handlebars.js | 13 +++++++++---- components/prism-handlebars.min.js | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/components/prism-handlebars.js b/components/prism-handlebars.js index 2142586ba3..09717949b1 100644 --- a/components/prism-handlebars.js +++ b/components/prism-handlebars.js @@ -6,10 +6,6 @@ 'handlebars': { pattern: handlebars_pattern, inside: { - 'comment': { - pattern: /(\{\{)![\w\W]*(?=\}\})/g, - lookbehind: true - }, 'delimiter': { pattern: /^\{\{\{?|\}\}\}?$/ig, alias: 'punctuation' @@ -35,6 +31,15 @@ } }); + // Comments are inserted at top so that they can + // surround markup + Prism.languages.insertBefore('handlebars', 'tag', { + 'handlebars-comment': { + pattern: /\{\{![\w\W]*\}\}/g, + alias: ['handlebars','comment'] + } + }); + // Tokenize all inline Handlebars expressions that are wrapped in {{ }} or {{{ }}} // This allows for easy Handlebars + markup highlighting Prism.hooks.add('before-highlight', function(env) { diff --git a/components/prism-handlebars.min.js b/components/prism-handlebars.min.js index 8f32ed6b07..3c6fa34783 100644 --- a/components/prism-handlebars.min.js +++ b/components/prism-handlebars.min.js @@ -1 +1 @@ -!function(a){var b=/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g;a.languages.handlebars=a.languages.extend("markup",{handlebars:{pattern:b,inside:{comment:{pattern:/(\{\{)![\w\W]*(?=\}\})/g,lookbehind:!0},delimiter:{pattern:/^\{\{\{?|\}\}\}?$/gi,alias:"punctuation"},string:/(["'])(\\?.)+?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,"boolean":/\b(true|false)\b/g,block:{pattern:/^(\s*~?\s*)[#\/]\w+/gi,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/g,variable:/[\w\W]+/g}},punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g}}}),a.hooks.add("before-highlight",function(a){"handlebars"===a.language&&(a.tokenStack=[],a.backupCode=a.code,a.code=a.code.replace(b,function(b){return a.tokenStack.push(b),"___HANDLEBARS"+a.tokenStack.length+"___"}))}),a.hooks.add("before-insert",function(a){"handlebars"===a.language&&(a.code=a.backupCode,delete a.backupCode)}),a.hooks.add("after-highlight",function(b){if("handlebars"===b.language){for(var d,c=0;d=b.tokenStack[c];c++)b.highlightedCode=b.highlightedCode.replace("___HANDLEBARS"+(c+1)+"___",a.highlight(d,b.grammar,"handlebars"));b.element.innerHTML=b.highlightedCode}})}(Prism); \ No newline at end of file +!function(a){var b=/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g;a.languages.handlebars=a.languages.extend("markup",{handlebars:{pattern:b,inside:{delimiter:{pattern:/^\{\{\{?|\}\}\}?$/gi,alias:"punctuation"},string:/(["'])(\\?.)+?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,"boolean":/\b(true|false)\b/g,block:{pattern:/^(\s*~?\s*)[#\/]\w+/gi,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/g,variable:/[\w\W]+/g}},punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g}}}),a.languages.insertBefore("handlebars","tag",{"handlebars-comment":{pattern:/\{\{![\w\W]*\}\}/g,alias:["handlebars","comment"]}}),a.hooks.add("before-highlight",function(a){"handlebars"===a.language&&(a.tokenStack=[],a.backupCode=a.code,a.code=a.code.replace(b,function(b){return a.tokenStack.push(b),"___HANDLEBARS"+a.tokenStack.length+"___"}))}),a.hooks.add("before-insert",function(a){"handlebars"===a.language&&(a.code=a.backupCode,delete a.backupCode)}),a.hooks.add("after-highlight",function(b){if("handlebars"===b.language){for(var d,c=0;d=b.tokenStack[c];c++)b.highlightedCode=b.highlightedCode.replace("___HANDLEBARS"+(c+1)+"___",a.highlight(d,b.grammar,"handlebars"));b.element.innerHTML=b.highlightedCode}})}(Prism); \ No newline at end of file From cb3f1cbcf83f0f57733179c02295fa0da4312ba6 Mon Sep 17 00:00:00 2001 From: Golmote Date: Mon, 15 Dec 2014 23:53:37 +0100 Subject: [PATCH 030/137] Add Rust language --- components.js | 4 +++ components/prism-rust.js | 53 ++++++++++++++++++++++++++++++++++++ components/prism-rust.min.js | 1 + 3 files changed, 58 insertions(+) create mode 100644 components/prism-rust.js create mode 100644 components/prism-rust.min.js diff --git a/components.js b/components.js index 7bae5697d4..a315e11208 100644 --- a/components.js +++ b/components.js @@ -206,6 +206,10 @@ var components = { "handlebars": { "title": "Handlebars", "owner": "Golmote" + }, + "rust": { + "title": "Rust", + "owner": "Golmote" } }, "plugins": { diff --git a/components/prism-rust.js b/components/prism-rust.js new file mode 100644 index 0000000000..f8ebd31247 --- /dev/null +++ b/components/prism-rust.js @@ -0,0 +1,53 @@ +/* TODO + Add support for Markdown notation inside doc comments + Add support for nested block comments... + Match closure params even when not followed by dash or brace + Add better support for macro definition +*/ + +Prism.languages.rust = { + 'comment': [ + { + pattern: /(^|[^\\])\/\*[\w\W]*?\*\//g, + lookbehind: true + }, + { + pattern: /(^|[^\\:])\/\/.*?(\r?\n|$)/g, + lookbehind: true + } + ], + 'string': [ + /b?r(#*)"(?:\\?.)*?"\1/g, + /b?("|')(?:\\?.)*?\1/g + ], + 'keyword': /\b(?:abstract|alignof|as|be|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|match|mod|move|mut|offsetof|once|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\b/, + + 'attribute': { + pattern: /#!?\[.+?\]/, + alias: 'attr-name' + }, + + 'function': [ + /[a-z0-9_]+(?=\s*\()/ig, + // Macros can use parens or brackets + /[a-z0-9_]+!(?=\s*\(|\[)/ig + ], + 'macro-rules': { + pattern: /[a-z0-9_]+!/ig, + alias: 'function' + }, + + // Hex, oct, bin, dec numbers with visual separators and type suffix + 'number': /\b-?(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(\d(_?\d)*)?\.?\d(_?\d)*([Ee][+-]?\d+)?)(?:_?(?:[iu](?:8|16|32)?|f32|f64))?\b/g, + + // Closure params should not be confused with bitwise OR | + 'closure-params': { + pattern: /\|[^|]*\|(?=\s*[{-])/, + inside: { + 'punctuation': /[\|:,]/, + 'operator': /[&*]/ + } + }, + 'punctuation': /[{}[\];(),.:]|->/g, + 'operator': /[-+]{1,2}|!=?|<=?|>=?|={1,3}|&&?|\|\|?|\*|\/|\^|%|<<|>>@/g +}; \ No newline at end of file diff --git a/components/prism-rust.min.js b/components/prism-rust.min.js new file mode 100644 index 0000000000..86dbdb8e20 --- /dev/null +++ b/components/prism-rust.min.js @@ -0,0 +1 @@ +Prism.languages.rust={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//g,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*?(\r?\n|$)/g,lookbehind:!0}],string:[/b?r(#*)"(?:\\?.)*?"\1/g,/b?("|')(?:\\?.)*?\1/g],keyword:/\b(?:abstract|alignof|as|be|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|match|mod|move|mut|offsetof|once|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\b/,attribute:{pattern:/#!?\[.+?\]/,alias:"attr-name"},"function":[/[a-z0-9_]+(?=\s*\()/gi,/[a-z0-9_]+!(?=\s*\(|\[)/gi],"macro-rules":{pattern:/[a-z0-9_]+!/gi,alias:"function"},number:/\b-?(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(\d(_?\d)*)?\.?\d(_?\d)*([Ee][+-]?\d+)?)(?:_?(?:[iu](?:8|16|32)?|f32|f64))?\b/g,"closure-params":{pattern:/\|[^|]*\|(?=\s*[{-])/,inside:{punctuation:/[\|:,]/,operator:/[&*]/}},punctuation:/[{}[\];(),.:]|->/g,operator:/[-+]{1,2}|!=?|<=?|>=?|={1,3}|&&?|\|\|?|\*|\/|\^|%|<<|>>@/g}; \ No newline at end of file From 8440df9e5a4ad8a0a110abd0d6f5db1d850087af Mon Sep 17 00:00:00 2001 From: Golmote Date: Tue, 16 Dec 2014 00:29:17 +0100 Subject: [PATCH 031/137] Added missing dependency --- components.js | 1 + 1 file changed, 1 insertion(+) diff --git a/components.js b/components.js index 4da07af499..8a60d3c127 100644 --- a/components.js +++ b/components.js @@ -209,6 +209,7 @@ var components = { }, "less": { "title": "Less", + "require": "css", "owner": "Golmote" } }, From b075a0c07fc17488db93762e588bb6a956038c8e Mon Sep 17 00:00:00 2001 From: Golmote Date: Tue, 16 Dec 2014 00:30:19 +0100 Subject: [PATCH 032/137] Added missing dependency --- components.js | 1 + 1 file changed, 1 insertion(+) diff --git a/components.js b/components.js index c1156cd919..045b951e03 100644 --- a/components.js +++ b/components.js @@ -209,6 +209,7 @@ var components = { }, "markdown": { "title": "Markdown", + "require": "markup", "owner": "Golmote" } }, From 1bd4d064641370c3df8793a274bcaad48f45a98e Mon Sep 17 00:00:00 2001 From: Golmote Date: Tue, 16 Dec 2014 09:03:57 +0100 Subject: [PATCH 033/137] Add AppleScript language --- components.js | 4 +++ components/prism-applescript.js | 40 +++++++++++++++++++++++++++++ components/prism-applescript.min.js | 1 + 3 files changed, 45 insertions(+) create mode 100644 components/prism-applescript.js create mode 100644 components/prism-applescript.min.js diff --git a/components.js b/components.js index 7bae5697d4..79e8b51459 100644 --- a/components.js +++ b/components.js @@ -206,6 +206,10 @@ var components = { "handlebars": { "title": "Handlebars", "owner": "Golmote" + }, + "applescript": { + "title": "AppleScript", + "owner": "Golmote" } }, "plugins": { diff --git a/components/prism-applescript.js b/components/prism-applescript.js new file mode 100644 index 0000000000..f702c09f8e --- /dev/null +++ b/components/prism-applescript.js @@ -0,0 +1,40 @@ +/* TODO + Add support for nested block comments... +*/ + +// Identifiers are (?!\d)[A-Za-z0-9_]+ or |.+| + +Prism.languages.applescript = { + 'comment': [ + /\(\*[\w\W]*?\*\)/, + /--.+/, + /#.+/ + ], + 'string': /"(?:\\?.)*?"/, + 'operator': [ + /[&=≠≤≥*+\-\/÷^]|[<>]=?/, + + /\b(?:start|begin|end)s? with\b/, + /\b(?:(?:does not|doesn't) contain|contains?)\b/, + /\b(?:is|isn't|is not) (?:in|contained by)\b/, + /\b(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?\b/, + /\b(?:(?:does not|doesn't) come|comes) (?:before|after)\b/, + /\b(?:is|isn't|is not) equal(?: to)?\b/, + /\b(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)\b/, + /\b(?:a )?(?:ref(?: to)?|reference to)\b/, + /\b(?:and|or|div|mod|as|not)\b/ + ], + 'keyword': /\b(?:about|above|after|against|and|apart from|around|as|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|contain|contains|continue|copy|div|does|eighth|else|end|equal|equals|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|mod|my|ninth|not|of|on|onto|or|out of|over|prop|property|put|ref|reference|repeat|return|returning|script|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/g, + 'class': [ + { + pattern: /\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text)\b/, + alias: 'builtin' + }, + { + pattern: /\b(?:centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/, + alias: 'builtin' + } + ], + 'number': /\b-?\d*\.?\d+([Ee]-?\d+)?\b/, + 'punctuation': /[{}():,¬«»《》]/ +}; \ No newline at end of file diff --git a/components/prism-applescript.min.js b/components/prism-applescript.min.js new file mode 100644 index 0000000000..b6c01e425b --- /dev/null +++ b/components/prism-applescript.min.js @@ -0,0 +1 @@ +Prism.languages.applescript={comment:[/\(\*[\w\W]*?\*\)/,/--.+/,/#.+/],string:/"(?:\\?.)*?"/,operator:[/[&=\u2260\u2264\u2265*+\-\/\xf7^]|[<>]=?/,/\b(?:start|begin|end)s? with\b/,/\b(?:(?:does not|doesn't) contain|contains?)\b/,/\b(?:is|isn't|is not) (?:in|contained by)\b/,/\b(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?\b/,/\b(?:(?:does not|doesn't) come|comes) (?:before|after)\b/,/\b(?:is|isn't|is not) equal(?: to)?\b/,/\b(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)\b/,/\b(?:a )?(?:ref(?: to)?|reference to)\b/,/\b(?:and|or|div|mod|as|not)\b/],keyword:/\b(?:about|above|after|against|and|apart from|around|as|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|contain|contains|continue|copy|div|does|eighth|else|end|equal|equals|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|mod|my|ninth|not|of|on|onto|or|out of|over|prop|property|put|ref|reference|repeat|return|returning|script|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/g,"class":[{pattern:/\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text)\b/,alias:"builtin"},{pattern:/\b(?:centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/,alias:"builtin"}],number:/\b-?\d*\.?\d+([Ee]-?\d+)?\b/,punctuation:/[{}():,\xac\xab\xbb\u300a\u300b]/}; \ No newline at end of file From 1a9f09a3f585513d29d1d8130ba7b997ccf266a0 Mon Sep 17 00:00:00 2001 From: Golmote Date: Tue, 16 Dec 2014 09:10:06 +0100 Subject: [PATCH 034/137] Removed useless comment --- components/prism-applescript.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/components/prism-applescript.js b/components/prism-applescript.js index f702c09f8e..03b2389eaa 100644 --- a/components/prism-applescript.js +++ b/components/prism-applescript.js @@ -2,8 +2,6 @@ Add support for nested block comments... */ -// Identifiers are (?!\d)[A-Za-z0-9_]+ or |.+| - Prism.languages.applescript = { 'comment': [ /\(\*[\w\W]*?\*\)/, From 25c733f8b9d2c2c824f952141ba914ee40197a17 Mon Sep 17 00:00:00 2001 From: Golmote Date: Tue, 16 Dec 2014 21:27:24 +0100 Subject: [PATCH 035/137] Add ActionScript language --- components/prism-actionscript.js | 26 ++++++++++++++++++++++++++ components/prism-actionscript.min.js | 1 + 2 files changed, 27 insertions(+) create mode 100644 components/prism-actionscript.js create mode 100644 components/prism-actionscript.min.js diff --git a/components/prism-actionscript.js b/components/prism-actionscript.js new file mode 100644 index 0000000000..7134b8c861 --- /dev/null +++ b/components/prism-actionscript.js @@ -0,0 +1,26 @@ +/* TODO + Fix XML highlighting + */ + +Prism.languages.actionscript = Prism.languages.extend('javascript', { + 'keyword': [ + // Lexical keywords + // Intentionally ignore true and false that are already handled as booleans + /\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/, + // Syntactic keywords + /\b(?:each|dynamic|final|get|include|namespace|native|override|set|static)\b/ + ], + 'number': /\b-?(\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g, + 'operator': /(?:[+\-*\/%^]|&&?|\|\|?|<>?>?|[!=]=)=?|[=~?@]/, + 'function': /(?!\d)[a-z0-9_$]+(?=\()/ig +}); +Prism.languages.actionscript['class-name'].alias = 'function'; + +Prism.languages.insertBefore('actionscript', 'operator', { + 'xml': { + pattern: /(^|[^.])<[\s\S]*>(?=\s*($|[\r\n,.;\]})<]))/, + inside: { + rest: Prism.languages.markup + } + } +}); \ No newline at end of file diff --git a/components/prism-actionscript.min.js b/components/prism-actionscript.min.js new file mode 100644 index 0000000000..ed17f4a500 --- /dev/null +++ b/components/prism-actionscript.min.js @@ -0,0 +1 @@ +Prism.languages.actionscript=Prism.languages.extend("javascript",{keyword:[/\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/,/\b(?:each|dynamic|final|get|include|namespace|native|override|set|static)\b/],number:/\b-?(\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g,operator:/(?:[+\-*\/%^]|&&?|\|\|?|<>?>?|[!=]=)=?|[=~?@]/,"function":/(?!\d)[a-z0-9_$]+(?=\()/gi}),Prism.languages.actionscript["class-name"].alias="function",Prism.languages.insertBefore("actionscript","operator",{xml:{pattern:/(^|[^.])<[\s\S]*>(?=\s*($|[\r\n,.;\]})<]))/,inside:{rest:Prism.languages.markup}}}); \ No newline at end of file From 45f2b828278d90f79453e1e685b319d476f2da8e Mon Sep 17 00:00:00 2001 From: Golmote Date: Tue, 16 Dec 2014 21:28:20 +0100 Subject: [PATCH 036/137] Update components --- components.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components.js b/components.js index 7bae5697d4..120fd71aed 100644 --- a/components.js +++ b/components.js @@ -206,6 +206,10 @@ var components = { "handlebars": { "title": "Handlebars", "owner": "Golmote" + }, + "actionscript": { + "title": "ActionScript", + "owner": "Golmote" } }, "plugins": { From 9d85156402746c21cd30d111849a12e009388acb Mon Sep 17 00:00:00 2001 From: Golmote Date: Tue, 16 Dec 2014 21:29:46 +0100 Subject: [PATCH 037/137] Added missing dependency --- components.js | 1 + 1 file changed, 1 insertion(+) diff --git a/components.js b/components.js index 120fd71aed..63cfad369a 100644 --- a/components.js +++ b/components.js @@ -209,6 +209,7 @@ var components = { }, "actionscript": { "title": "ActionScript", + "require": "javascript", "owner": "Golmote" } }, From d9bdd1dbe798fd42416729a9180a6dce30601202 Mon Sep 17 00:00:00 2001 From: Golmote Date: Tue, 16 Dec 2014 23:37:10 +0100 Subject: [PATCH 038/137] Fix spacing --- components/prism-actionscript.js | 34 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/components/prism-actionscript.js b/components/prism-actionscript.js index 7134b8c861..be05c6b94a 100644 --- a/components/prism-actionscript.js +++ b/components/prism-actionscript.js @@ -1,26 +1,26 @@ /* TODO - Fix XML highlighting + Fix XML highlighting */ Prism.languages.actionscript = Prism.languages.extend('javascript', { - 'keyword': [ - // Lexical keywords - // Intentionally ignore true and false that are already handled as booleans - /\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/, - // Syntactic keywords - /\b(?:each|dynamic|final|get|include|namespace|native|override|set|static)\b/ - ], - 'number': /\b-?(\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g, - 'operator': /(?:[+\-*\/%^]|&&?|\|\|?|<>?>?|[!=]=)=?|[=~?@]/, - 'function': /(?!\d)[a-z0-9_$]+(?=\()/ig + 'keyword': [ + // Lexical keywords + // Intentionally ignore true and false that are already handled as booleans + /\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/, + // Syntactic keywords + /\b(?:each|dynamic|final|get|include|namespace|native|override|set|static)\b/ + ], + 'number': /\b-?(\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g, + 'operator': /(?:[+\-*\/%^]|&&?|\|\|?|<>?>?|[!=]=)=?|[=~?@]/, + 'function': /(?!\d)[a-z0-9_$]+(?=\()/ig }); Prism.languages.actionscript['class-name'].alias = 'function'; Prism.languages.insertBefore('actionscript', 'operator', { - 'xml': { - pattern: /(^|[^.])<[\s\S]*>(?=\s*($|[\r\n,.;\]})<]))/, - inside: { - rest: Prism.languages.markup - } - } + 'xml': { + pattern: /(^|[^.])<[\s\S]*>(?=\s*($|[\r\n,.;\]})<]))/, + inside: { + rest: Prism.languages.markup + } + } }); \ No newline at end of file From d16e98e94c4cd3199b5267474894e7557c842c98 Mon Sep 17 00:00:00 2001 From: Golmote Date: Tue, 16 Dec 2014 23:37:44 +0100 Subject: [PATCH 039/137] Fix spacing --- components/prism-applescript.js | 64 ++++++++++++++++----------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/components/prism-applescript.js b/components/prism-applescript.js index 03b2389eaa..61b7959f02 100644 --- a/components/prism-applescript.js +++ b/components/prism-applescript.js @@ -1,38 +1,38 @@ /* TODO - Add support for nested block comments... + Add support for nested block comments... */ Prism.languages.applescript = { - 'comment': [ - /\(\*[\w\W]*?\*\)/, - /--.+/, - /#.+/ - ], - 'string': /"(?:\\?.)*?"/, - 'operator': [ - /[&=≠≤≥*+\-\/÷^]|[<>]=?/, + 'comment': [ + /\(\*[\w\W]*?\*\)/, + /--.+/, + /#.+/ + ], + 'string': /"(?:\\?.)*?"/, + 'operator': [ + /[&=≠≤≥*+\-\/÷^]|[<>]=?/, - /\b(?:start|begin|end)s? with\b/, - /\b(?:(?:does not|doesn't) contain|contains?)\b/, - /\b(?:is|isn't|is not) (?:in|contained by)\b/, - /\b(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?\b/, - /\b(?:(?:does not|doesn't) come|comes) (?:before|after)\b/, - /\b(?:is|isn't|is not) equal(?: to)?\b/, - /\b(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)\b/, - /\b(?:a )?(?:ref(?: to)?|reference to)\b/, - /\b(?:and|or|div|mod|as|not)\b/ - ], - 'keyword': /\b(?:about|above|after|against|and|apart from|around|as|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|contain|contains|continue|copy|div|does|eighth|else|end|equal|equals|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|mod|my|ninth|not|of|on|onto|or|out of|over|prop|property|put|ref|reference|repeat|return|returning|script|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/g, - 'class': [ - { - pattern: /\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text)\b/, - alias: 'builtin' - }, - { - pattern: /\b(?:centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/, - alias: 'builtin' - } - ], - 'number': /\b-?\d*\.?\d+([Ee]-?\d+)?\b/, - 'punctuation': /[{}():,¬«»《》]/ + /\b(?:start|begin|end)s? with\b/, + /\b(?:(?:does not|doesn't) contain|contains?)\b/, + /\b(?:is|isn't|is not) (?:in|contained by)\b/, + /\b(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?\b/, + /\b(?:(?:does not|doesn't) come|comes) (?:before|after)\b/, + /\b(?:is|isn't|is not) equal(?: to)?\b/, + /\b(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)\b/, + /\b(?:a )?(?:ref(?: to)?|reference to)\b/, + /\b(?:and|or|div|mod|as|not)\b/ + ], + 'keyword': /\b(?:about|above|after|against|and|apart from|around|as|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|contain|contains|continue|copy|div|does|eighth|else|end|equal|equals|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|mod|my|ninth|not|of|on|onto|or|out of|over|prop|property|put|ref|reference|repeat|return|returning|script|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/g, + 'class': [ + { + pattern: /\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text)\b/, + alias: 'builtin' + }, + { + pattern: /\b(?:centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/, + alias: 'builtin' + } + ], + 'number': /\b-?\d*\.?\d+([Ee]-?\d+)?\b/, + 'punctuation': /[{}():,¬«»《》]/ }; \ No newline at end of file From fac57f13a8230fb42c6dd9827b613af0f5505714 Mon Sep 17 00:00:00 2001 From: Golmote Date: Wed, 17 Dec 2014 20:57:34 +0100 Subject: [PATCH 040/137] Add Jade language --- components.js | 4 + components/prism-jade.js | 195 +++++++++++++++++++++++++++++++++++ components/prism-jade.min.js | 1 + 3 files changed, 200 insertions(+) create mode 100644 components/prism-jade.js create mode 100644 components/prism-jade.min.js diff --git a/components.js b/components.js index 7bae5697d4..c0bc625415 100644 --- a/components.js +++ b/components.js @@ -206,6 +206,10 @@ var components = { "handlebars": { "title": "Handlebars", "owner": "Golmote" + }, + "jade": { + "title": "Jade", + "owner": "Golmote" } }, "plugins": { diff --git a/components/prism-jade.js b/components/prism-jade.js new file mode 100644 index 0000000000..99a9593f16 --- /dev/null +++ b/components/prism-jade.js @@ -0,0 +1,195 @@ +(function(Prism) { + Prism.languages.jade = { + + // Multiline stuff should appear before the rest + + 'multiline-comment': { + pattern: /((?:^|\n)([\t ]*))\/\/.*(\n\2[\t ]+.+)*/, + lookbehind: true, + alias: 'comment' + }, + + // All the tag-related part is in lookbehind + // so that it can be highlighted by the "tag" pattern + 'multiline-script': { + pattern: /((?:^|\n)([\t ]*)script\b.*\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/, + lookbehind: true, + inside: { + rest: Prism.languages.javascript + } + }, + + // See at the end of the file for known filters + 'filter': { + pattern: /((?:^|\n)([\t ]*)):.+(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/, + lookbehind: true, + inside: { + 'filter-name': { + pattern: /^:[\w-]+/, + alias: 'variable' + } + } + }, + + 'multiline-plain-text': { + pattern: /((?:^|\n)([\t ]*)[\w\-#.]+\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/, + lookbehind: true + }, + 'markup': { + pattern: /((?:^|\n)[\t ]*)<.+/, + lookbehind: true, + inside: { + rest: Prism.languages.markup + } + }, + 'comment': { + pattern: /((?:^|\n)[\t ]*)\/\/.+/, + lookbehind: true + }, + 'doctype': { + pattern: /((?:^|\n)[\t ]*)doctype(?: .+)?/, + lookbehind: true + }, + + // This handle all conditional and loop keywords + 'flow-control': { + pattern: /((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|each|while)(?: .+)?/, + lookbehind: true, + inside: { + 'each': { + pattern: /((?:^|\n)[\t ]*)each .+? in\b/, + lookbehind: true, + inside: { + 'keyword': /\b(?:each|in)\b/, + 'punctuation': /,/ + } + }, + 'branch': { + pattern: /((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|while)/, + lookbehind: true, + alias: 'keyword' + }, + rest: Prism.languages.javascript + } + }, + 'keyword': { + pattern: /((?:^|\n)[\t ]*)(?:block|extends|include|append|prepend)\b.+/, + lookbehind: true + }, + 'mixin': [ + // Declaration + { + pattern: /((?:^|\n)[\t ]*)mixin .+/, + lookbehind: true, + inside: { + 'keyword': /^mixin/, + 'function': /\w+(?=\s*\(|\s*$)/, + 'punctuation': /[(),.]/ + } + }, + // Usage + { + pattern: /((?:^|\n)[\t ]*)\+.+/, + lookbehind: true, + inside: { + 'name': { + pattern: /^\+\w+/, + alias: 'function' + }, + 'rest': Prism.languages.javascript + } + } + ], + 'script': { + pattern: /((?:^|\n)[\t ]*script(?:(?:&[^(]+)?\([^)]+\))*) .+/, + lookbehind: true, + inside: { + rest: Prism.languages.javascript + } + }, + + 'plain-text': { + pattern: /((?:^|\n)[\t ]*(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?[\t ]+).+/, + lookbehind: true + }, + 'tag': { + pattern: /((?:^|\n)[\t ]*)(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?:?/, + lookbehind: true, + inside: { + 'attributes': [ + { + pattern: /&[^(]+\([^)]+\)/, + inside: { + rest: Prism.languages.javascript + } + }, + { + pattern: /\([^)]+\)/, + inside: { + 'attr-value': { + pattern: /(=\s*)(?:\{[^}]*\}|[^,)\n]+)/, + lookbehind: true, + inside: { + rest: Prism.languages.javascript + } + }, + 'attr-name': /[\w-]+(?=\s*!?=|\s*[,)])/, + 'punctuation': /[!=(),]/ + } + } + ], + 'punctuation': /[:]/ + } + }, + 'code': [ + { + pattern: /((?:^|\n)[\t ]*(?:-|!?=)).+/, + lookbehind: true, + inside: { + rest: Prism.languages.javascript + } + } + ], + 'punctuation': /[.\-!=|]/ + }; + + var filter_pattern = '((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+'; + + // Non exhaustive list of available filters and associated languages + var filters = [ + {filter:'atpl',language:'twig'}, + {filter:'coffee',language:'coffeescript'}, + {filter:'ejs',language:'ejs'}, + {filter:'handlebars',language:'handlebars'}, + {filter:'hogan',language:'hogan'}, + {filter:'less',language:'less'}, + {filter:'livescript',language:'livescript'}, + {filter:'markdown',language:'markdown'}, + {filter:'mustache',language:'mustache'}, + {filter:'plates',language:'plates'}, + {filter:'sass',language:'scss'}, + {filter:'stylus',language:'stylus'}, + {filter:'swift',language:'swift'} + + ]; + var all_filters = {}; + for(var i=0,l=filters.length;ie;e++){var g=c[e];a.languages[g.language]&&(d["filter-"+g.filter]={pattern:new RegExp(b.replace("{{filter_name}}",g.filter)),lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"},rest:a.languages[g.language]}})}a.languages.insertBefore("jade","filter",d)}(Prism); \ No newline at end of file From cd963b88106513777aa58524a6b7809d2ef255b4 Mon Sep 17 00:00:00 2001 From: Golmote Date: Thu, 18 Dec 2014 08:10:38 +0100 Subject: [PATCH 041/137] Added missing dependency --- components.js | 1 + 1 file changed, 1 insertion(+) diff --git a/components.js b/components.js index c0bc625415..a60cec8af1 100644 --- a/components.js +++ b/components.js @@ -209,6 +209,7 @@ var components = { }, "jade": { "title": "Jade", + "require": "javascript", "owner": "Golmote" } }, From c743454aaa3463748aaa439744c92a32d8f9e420 Mon Sep 17 00:00:00 2001 From: Golmote Date: Thu, 18 Dec 2014 09:01:24 +0100 Subject: [PATCH 042/137] Add Haml language --- components.js | 5 ++ components/prism-haml.js | 160 +++++++++++++++++++++++++++++++++++ components/prism-haml.min.js | 1 + 3 files changed, 166 insertions(+) create mode 100644 components/prism-haml.js create mode 100644 components/prism-haml.min.js diff --git a/components.js b/components.js index 7bae5697d4..292bf0d769 100644 --- a/components.js +++ b/components.js @@ -206,6 +206,11 @@ var components = { "handlebars": { "title": "Handlebars", "owner": "Golmote" + }, + "haml": { + "title": "Haml", + "require": "ruby", + "owner": "Golmote" } }, "plugins": { diff --git a/components/prism-haml.js b/components/prism-haml.js new file mode 100644 index 0000000000..6910237ebb --- /dev/null +++ b/components/prism-haml.js @@ -0,0 +1,160 @@ +/* TODO + Handle multiline code after tag + %foo= some | + multiline | + code | +*/ + +(function(Prism) { + + Prism.languages.haml = { + // Multiline stuff should appear before the rest + + 'multiline-comment': [ + { + pattern: /((?:^|\n)([\t ]*))\/.*(\n\2[\t ]+.+)*/, + lookbehind: true, + alias: 'comment' + }, + { + pattern: /((?:^|\n)([\t ]*))-#.*(\n\2[\t ]+.+)*/, + lookbehind: true, + alias: 'comment' + } + ], + + 'multiline-code': [ + { + pattern: /((?:^|\n)([\t ]*)(?:[~-]|[&!]?=)).*,[\t ]*(\n\2[\t ]+.*,[\t ]*)*(\n\2[\t ]+.+)/, + lookbehind: true, + inside: { + rest: Prism.languages.ruby + } + }, + { + pattern: /((?:^|\n)([\t ]*)(?:[~-]|[&!]?=)).*\|[\t ]*(\n\2[\t ]+.*\|[\t ]*)*/, + lookbehind: true, + inside: { + rest: Prism.languages.ruby + } + } + ], + + // See at the end of the file for known filters + 'filter': { + pattern: /((?:^|\n)([\t ]*)):[\w-]+(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/, + lookbehind: true, + inside: { + 'filter-name': { + pattern: /^:[\w-]+/, + alias: 'variable' + } + } + }, + + 'markup': { + pattern: /((?:^|\n)[\t ]*)<.+/, + lookbehind: true, + inside: { + rest: Prism.languages.markup + } + }, + 'doctype': { + pattern: /((?:^|\n)[\t ]*)!!!(?: .+)?/, + lookbehind: true + }, + 'tag': { + // Allows for one nested group of braces + pattern: /((?:^|\n)[\t ]*)[%.#][\w\-#.]*[\w\-](?:\([^)]+\)|\{(?:\{[^}]+\}|[^}])+\}|\[[^\]]+\])*[\/<>]*/, + lookbehind: true, + inside: { + 'attributes': [ + { + // Lookbehind tries to prevent interpolations for breaking it all + // Allows for one nested group of braces + pattern: /(^|[^#])\{(?:\{[^}]+\}|[^}])+\}/, + lookbehind: true, + inside: { + rest: Prism.languages.ruby + } + }, + { + pattern: /\([^)]+\)/, + inside: { + 'attr-value': { + pattern: /(=\s*)(?:"(?:\\?.)*?"|[^)\s]+)/, + lookbehind: true + }, + 'attr-name': /[\w:-]+(?=\s*!?=|\s*[,)])/, + 'punctuation': /[=(),]/ + } + }, + { + pattern: /\[[^\]]+\]/, + inside: { + rest: Prism.languages.ruby + } + } + ], + 'punctuation': /[<>]/ + } + }, + 'code': { + pattern: /((?:^|\n)[\t ]*(?:[~-]|[&!]?=)).+/, + lookbehind: true, + inside: { + rest: Prism.languages.ruby + } + }, + // Interpolations in plain text + 'interpolation': { + pattern: /#\{[^}]+\}/, + inside: { + 'delimiter': { + pattern: /^#\{|\}$/, + alias: 'punctuation' + }, + rest: Prism.languages.ruby + } + }, + 'punctuation': { + pattern: /((?:^|\n)[\t ]*)[~=\-&!]/, + lookbehind: true + } + }; + + var filter_pattern = '((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+'; + + // Non exhaustive list of available filters and associated languages + var filters = [ + {filter:'css',language:'css'}, + {filter:'coffee',language:'coffeescript'}, + {filter:'erb',language:'erb'}, + {filter:'javascript',language:'javascript'}, + {filter:'less',language:'less'}, + {filter:'markdown',language:'markdown'}, + {filter:'ruby',language:'ruby'}, + {filter:'scss',language:'scss'}, + {filter:'textile',language:'textile'} + ]; + var all_filters = {}; + for(var i=0,l=filters.length;i]*/,lookbehind:!0,inside:{attributes:[{pattern:/(^|[^#])\{(?:\{[^}]+\}|[^}])+\}/,lookbehind:!0,inside:{rest:a.languages.ruby}},{pattern:/\([^)]+\)/,inside:{"attr-value":{pattern:/(=\s*)(?:"(?:\\?.)*?"|[^)\s]+)/,lookbehind:!0},"attr-name":/[\w:-]+(?=\s*!?=|\s*[,)])/,punctuation:/[=(),]/}},{pattern:/\[[^\]]+\]/,inside:{rest:a.languages.ruby}}],punctuation:/[<>]/}},code:{pattern:/((?:^|\n)[\t ]*(?:[~-]|[&!]?=)).+/,lookbehind:!0,inside:{rest:a.languages.ruby}},interpolation:{pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"},rest:a.languages.ruby}},punctuation:{pattern:/((?:^|\n)[\t ]*)[~=\-&!]/,lookbehind:!0}};for(var b="((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+",c=[{filter:"css",language:"css"},{filter:"coffee",language:"coffeescript"},{filter:"erb",language:"erb"},{filter:"javascript",language:"javascript"},{filter:"less",language:"less"},{filter:"markdown",language:"markdown"},{filter:"ruby",language:"ruby"},{filter:"scss",language:"scss"},{filter:"textile",language:"textile"}],d={},e=0,f=c.length;f>e;e++){var g=c[e];a.languages[g.language]&&(d["filter-"+g.filter]={pattern:new RegExp(b.replace("{{filter_name}}",g.filter)),lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"},rest:a.languages[g.language]}})}a.languages.insertBefore("haml","filter",d)}(Prism); \ No newline at end of file From 0e24ff95ae83ae3cfb16742cea2b31c344905c44 Mon Sep 17 00:00:00 2001 From: Golmote Date: Thu, 18 Dec 2014 09:06:42 +0100 Subject: [PATCH 043/137] Fixed typo in swig filter --- components/prism-jade.js | 2 +- components/prism-jade.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/prism-jade.js b/components/prism-jade.js index 99a9593f16..0a0d2611ae 100644 --- a/components/prism-jade.js +++ b/components/prism-jade.js @@ -169,7 +169,7 @@ {filter:'plates',language:'plates'}, {filter:'sass',language:'scss'}, {filter:'stylus',language:'stylus'}, - {filter:'swift',language:'swift'} + {filter:'swig',language:'swig'} ]; var all_filters = {}; diff --git a/components/prism-jade.min.js b/components/prism-jade.min.js index d96d27b28e..e937d22ec5 100644 --- a/components/prism-jade.min.js +++ b/components/prism-jade.min.js @@ -1 +1 @@ -!function(a){a.languages.jade={"multiline-comment":{pattern:/((?:^|\n)([\t ]*))\/\/.*(\n\2[\t ]+.+)*/,lookbehind:!0,alias:"comment"},"multiline-script":{pattern:/((?:^|\n)([\t ]*)script\b.*\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{rest:a.languages.javascript}},filter:{pattern:/((?:^|\n)([\t ]*)):.+(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"}}},"multiline-plain-text":{pattern:/((?:^|\n)([\t ]*)[\w\-#.]+\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0},markup:{pattern:/((?:^|\n)[\t ]*)<.+/,lookbehind:!0,inside:{rest:a.languages.markup}},comment:{pattern:/((?:^|\n)[\t ]*)\/\/.+/,lookbehind:!0},doctype:{pattern:/((?:^|\n)[\t ]*)doctype(?: .+)?/,lookbehind:!0},"flow-control":{pattern:/((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|each|while)(?: .+)?/,lookbehind:!0,inside:{each:{pattern:/((?:^|\n)[\t ]*)each .+? in\b/,lookbehind:!0,inside:{keyword:/\b(?:each|in)\b/,punctuation:/,/}},branch:{pattern:/((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|while)/,lookbehind:!0,alias:"keyword"},rest:a.languages.javascript}},keyword:{pattern:/((?:^|\n)[\t ]*)(?:block|extends|include|append|prepend)\b.+/,lookbehind:!0},mixin:[{pattern:/((?:^|\n)[\t ]*)mixin .+/,lookbehind:!0,inside:{keyword:/^mixin/,"function":/\w+(?=\s*\(|\s*$)/,punctuation:/[(),.]/}},{pattern:/((?:^|\n)[\t ]*)\+.+/,lookbehind:!0,inside:{name:{pattern:/^\+\w+/,alias:"function"},rest:a.languages.javascript}}],script:{pattern:/((?:^|\n)[\t ]*script(?:(?:&[^(]+)?\([^)]+\))*) .+/,lookbehind:!0,inside:{rest:a.languages.javascript}},"plain-text":{pattern:/((?:^|\n)[\t ]*(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?[\t ]+).+/,lookbehind:!0},tag:{pattern:/((?:^|\n)[\t ]*)(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?:?/,lookbehind:!0,inside:{attributes:[{pattern:/&[^(]+\([^)]+\)/,inside:{rest:a.languages.javascript}},{pattern:/\([^)]+\)/,inside:{"attr-value":{pattern:/(=\s*)(?:\{[^}]*\}|[^,)\n]+)/,lookbehind:!0,inside:{rest:a.languages.javascript}},"attr-name":/[\w-]+(?=\s*!?=|\s*[,)])/,punctuation:/[!=(),]/}}],punctuation:/[:]/}},code:[{pattern:/((?:^|\n)[\t ]*(?:-|!?=)).+/,lookbehind:!0,inside:{rest:a.languages.javascript}}],punctuation:/[.\-!=|]/};for(var b="((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+",c=[{filter:"atpl",language:"twig"},{filter:"coffee",language:"coffeescript"},{filter:"ejs",language:"ejs"},{filter:"handlebars",language:"handlebars"},{filter:"hogan",language:"hogan"},{filter:"less",language:"less"},{filter:"livescript",language:"livescript"},{filter:"markdown",language:"markdown"},{filter:"mustache",language:"mustache"},{filter:"plates",language:"plates"},{filter:"sass",language:"scss"},{filter:"stylus",language:"stylus"},{filter:"swift",language:"swift"}],d={},e=0,f=c.length;f>e;e++){var g=c[e];a.languages[g.language]&&(d["filter-"+g.filter]={pattern:new RegExp(b.replace("{{filter_name}}",g.filter)),lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"},rest:a.languages[g.language]}})}a.languages.insertBefore("jade","filter",d)}(Prism); \ No newline at end of file +!function(a){a.languages.jade={"multiline-comment":{pattern:/((?:^|\n)([\t ]*))\/\/.*(\n\2[\t ]+.+)*/,lookbehind:!0,alias:"comment"},"multiline-script":{pattern:/((?:^|\n)([\t ]*)script\b.*\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{rest:a.languages.javascript}},filter:{pattern:/((?:^|\n)([\t ]*)):.+(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"}}},"multiline-plain-text":{pattern:/((?:^|\n)([\t ]*)[\w\-#.]+\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0},markup:{pattern:/((?:^|\n)[\t ]*)<.+/,lookbehind:!0,inside:{rest:a.languages.markup}},comment:{pattern:/((?:^|\n)[\t ]*)\/\/.+/,lookbehind:!0},doctype:{pattern:/((?:^|\n)[\t ]*)doctype(?: .+)?/,lookbehind:!0},"flow-control":{pattern:/((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|each|while)(?: .+)?/,lookbehind:!0,inside:{each:{pattern:/((?:^|\n)[\t ]*)each .+? in\b/,lookbehind:!0,inside:{keyword:/\b(?:each|in)\b/,punctuation:/,/}},branch:{pattern:/((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|while)/,lookbehind:!0,alias:"keyword"},rest:a.languages.javascript}},keyword:{pattern:/((?:^|\n)[\t ]*)(?:block|extends|include|append|prepend)\b.+/,lookbehind:!0},mixin:[{pattern:/((?:^|\n)[\t ]*)mixin .+/,lookbehind:!0,inside:{keyword:/^mixin/,"function":/\w+(?=\s*\(|\s*$)/,punctuation:/[(),.]/}},{pattern:/((?:^|\n)[\t ]*)\+.+/,lookbehind:!0,inside:{name:{pattern:/^\+\w+/,alias:"function"},rest:a.languages.javascript}}],script:{pattern:/((?:^|\n)[\t ]*script(?:(?:&[^(]+)?\([^)]+\))*) .+/,lookbehind:!0,inside:{rest:a.languages.javascript}},"plain-text":{pattern:/((?:^|\n)[\t ]*(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?[\t ]+).+/,lookbehind:!0},tag:{pattern:/((?:^|\n)[\t ]*)(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?:?/,lookbehind:!0,inside:{attributes:[{pattern:/&[^(]+\([^)]+\)/,inside:{rest:a.languages.javascript}},{pattern:/\([^)]+\)/,inside:{"attr-value":{pattern:/(=\s*)(?:\{[^}]*\}|[^,)\n]+)/,lookbehind:!0,inside:{rest:a.languages.javascript}},"attr-name":/[\w-]+(?=\s*!?=|\s*[,)])/,punctuation:/[!=(),]/}}],punctuation:/[:]/}},code:[{pattern:/((?:^|\n)[\t ]*(?:-|!?=)).+/,lookbehind:!0,inside:{rest:a.languages.javascript}}],punctuation:/[.\-!=|]/};for(var b="((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+",c=[{filter:"atpl",language:"twig"},{filter:"coffee",language:"coffeescript"},{filter:"ejs",language:"ejs"},{filter:"handlebars",language:"handlebars"},{filter:"hogan",language:"hogan"},{filter:"less",language:"less"},{filter:"livescript",language:"livescript"},{filter:"markdown",language:"markdown"},{filter:"mustache",language:"mustache"},{filter:"plates",language:"plates"},{filter:"sass",language:"scss"},{filter:"stylus",language:"stylus"},{filter:"swig",language:"swig"}],d={},e=0,f=c.length;f>e;e++){var g=c[e];a.languages[g.language]&&(d["filter-"+g.filter]={pattern:new RegExp(b.replace("{{filter_name}}",g.filter)),lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"},rest:a.languages[g.language]}})}a.languages.insertBefore("jade","filter",d)}(Prism); \ No newline at end of file From f22c391161ba3828c52b34e0122fdebd1d8e3268 Mon Sep 17 00:00:00 2001 From: Golmote Date: Fri, 19 Dec 2014 09:14:54 +0100 Subject: [PATCH 044/137] Add Erlang language --- components.js | 4 ++++ components/prism-erlang.js | 34 ++++++++++++++++++++++++++++++++++ components/prism-erlang.min.js | 1 + 3 files changed, 39 insertions(+) create mode 100644 components/prism-erlang.js create mode 100644 components/prism-erlang.min.js diff --git a/components.js b/components.js index 7bae5697d4..41d77495c3 100644 --- a/components.js +++ b/components.js @@ -206,6 +206,10 @@ var components = { "handlebars": { "title": "Handlebars", "owner": "Golmote" + }, + "erlang": { + "title": "Erlang", + "owner": "Golmote" } }, "plugins": { diff --git a/components/prism-erlang.js b/components/prism-erlang.js new file mode 100644 index 0000000000..77adbd392d --- /dev/null +++ b/components/prism-erlang.js @@ -0,0 +1,34 @@ +Prism.languages.erlang = { + 'comment': /%.+/, + 'string': /"(?:\\?.)*?"/, + 'quoted-atom': { + pattern: /'[^']+'/, + alias: 'atom' + }, + 'boolean': /\b(?:true|false)\b/, + 'keyword': /\b(?:fun|when|case|of|end|if|receive|after|try|catch)\b/, + 'function': /(?:\b[a-z][\w@]*|'[^']+')(?=\()/, + 'variable': /(?:\b|\?)[A-Z_][\w@]*/, + 'atom': { + pattern: /(^|(?!\$).)\b[a-z][\w@]*/, + lookbehind: true + }, + 'number': [ + /\$\\?./, + /\d+#[a-z0-9]+/i, + /(?:\b|-)\d*\.?\d+([Ee][+-]?\d+)?\b/ + ], + 'operator': [ + /[=\/>:]=|>=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/, + { + pattern: /(^|(?!<).)<(?!<)/, + lookbehind: true + }, + { + pattern: /(^|(?!>).)>(?!>)/, + lookbehind: true + } + ], + 'punctuation': /[()[\]{}:;,.#|]|<<|>>/ + +}; \ No newline at end of file diff --git a/components/prism-erlang.min.js b/components/prism-erlang.min.js new file mode 100644 index 0000000000..85d3653be7 --- /dev/null +++ b/components/prism-erlang.min.js @@ -0,0 +1 @@ +Prism.languages.erlang={comment:/%.+/,string:/"(?:\\?.)*?"/,"quoted-atom":{pattern:/'[^']+'/,alias:"atom"},"boolean":/\b(?:true|false)\b/,keyword:/\b(?:fun|when|case|of|end|if|receive|after|try|catch)\b/,"function":/(?:\b[a-z][\w@]*|'[^']+')(?=\()/,variable:/(?:\b|\?)[A-Z_][\w@]*/,atom:{pattern:/(^|(?!\$).)\b[a-z][\w@]*/,lookbehind:!0},number:[/\$\\?./,/\d+#[a-z0-9]+/i,/(?:\b|-)\d*\.?\d+([Ee][+-]?\d+)?\b/],operator:[/[=\/>:]=|>=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/,{pattern:/(^|(?!<).)<(?!<)/,lookbehind:!0},{pattern:/(^|(?!>).)>(?!>)/,lookbehind:!0}],punctuation:/[()[\]{}:;,.#|]|<<|>>/}; \ No newline at end of file From 140db6bb49161879769efbf2db94cfbafbc9adf3 Mon Sep 17 00:00:00 2001 From: Golmote Date: Fri, 19 Dec 2014 21:13:03 +0100 Subject: [PATCH 045/137] Add Fortran language --- components.js | 4 ++++ components/prism-fortran.js | 34 +++++++++++++++++++++++++++++++++ components/prism-fortran.min.js | 1 + 3 files changed, 39 insertions(+) create mode 100644 components/prism-fortran.js create mode 100644 components/prism-fortran.min.js diff --git a/components.js b/components.js index 7bae5697d4..a5c2f0bc8a 100644 --- a/components.js +++ b/components.js @@ -206,6 +206,10 @@ var components = { "handlebars": { "title": "Handlebars", "owner": "Golmote" + }, + "fortran": { + "title": "Fortran", + "owner": "Golmote" } }, "plugins": { diff --git a/components/prism-fortran.js b/components/prism-fortran.js new file mode 100644 index 0000000000..9285c8baa9 --- /dev/null +++ b/components/prism-fortran.js @@ -0,0 +1,34 @@ +Prism.languages.fortran = { + 'string': { + pattern: /(?:\w+_)?(['"])(?:\1\1|&\n(?:\s*!.+\n)?|(?!\1).)*(?:\1|&)/, + inside: { + 'comment': /!.*/ + } + }, + 'comment': /!.*/, + 'boolean': /\.(?:TRUE|FALSE)\.(?:_\w+)?/i, + 'number': [ + /[BO](['"])\d+\1/i, + /Z(['"])[A-F0-9]+\1/i, + /(?:\b|[+-])(?:\d+(?:\.\d*)?|\.\d+)(?:[ED][+-]?\d+)?(?:_\w+)?/i + ], + 'keyword': [ + // Types + /\b(?:INTEGER|REAL|DOUBLE ?PRECISION|COMPLEX|CHARACTER|LOGICAL)\b/i, + // Statements + /\b(?:ALLOCATABLE|ALLOCATE|BACKSPACE|CALL|CASE|CLOSE|COMMON|CONTAINS|CONTINUE|CYCLE|DATA|DEALLOCATE|DIMENSION|DO|END|EQUIVALENCE|EXIT|EXTERNAL|FORMAT|GO ?TO|IMPLICIT(?: NONE)?|INQUIRE|INTENT|INTRINSIC|MODULE PROCEDURE|NAMELIST|NULLIFY|OPEN|OPTIONAL|PARAMETER|POINTER|PRINT|PRIVATE|PUBLIC|READ|RETURN|REWIND|SAVE|SELECT|STOP|TARGET|WHILE|WRITE)\b/i, + // END statements + /\b(?:END ?)?(?:BLOCK ?DATA|DO|FILE|FORALL|FUNCTION|IF|INTERFACE|MODULE|PROGRAM|SELECT|SUBROUTINE|TYPE|WHERE)\b/i, + // Others + /\b(?:ASSIGNMENT|DEFAULT|ELEMENTAL|ELSE|ELSEWHERE|ELSEIF|ENTRY|IN|INCLUDE|INOUT|KIND|NULL|ONLY|OPERATOR|OUT|PURE|RECURSIVE|RESULT|SEQUENCE|STAT|THEN|USE)\b/i + ], + 'operator': [ + /\*\*|\/\/|=>|[=\/]=|[<>]=?|::|[+\-*=%]|\.(?:EQ|NE|LT|LE|GT|GE|NOT|AND|OR|EQV|NEQV)\.|\.[A-Z]+\./i, + { + // Use lookbehind to prevent confusion with (/ /) + pattern: /(^|(?!\().)\/(?!\))/, + lookbehind: true + } + ], + 'punctuation': /\(\/|\/\)|[(),;:&]/ +}; \ No newline at end of file diff --git a/components/prism-fortran.min.js b/components/prism-fortran.min.js new file mode 100644 index 0000000000..b0932be3d5 --- /dev/null +++ b/components/prism-fortran.min.js @@ -0,0 +1 @@ +Prism.languages.fortran={string:{pattern:/(?:\w+_)?(['"])(?:\1\1|&\n(?:\s*!.+\n)?|(?!\1).)*(?:\1|&)/,inside:{comment:/!.*/}},comment:/!.*/,"boolean":/\.(?:TRUE|FALSE)\.(?:_\w+)?/i,number:[/[BO](['"])\d+\1/i,/Z(['"])[A-F0-9]+\1/i,/(?:\b|[+-])(?:\d+(?:\.\d*)?|\.\d+)(?:[ED][+-]?\d+)?(?:_\w+)?/i],keyword:[/\b(?:INTEGER|REAL|DOUBLE ?PRECISION|COMPLEX|CHARACTER|LOGICAL)\b/i,/\b(?:ALLOCATABLE|ALLOCATE|BACKSPACE|CALL|CASE|CLOSE|COMMON|CONTAINS|CONTINUE|CYCLE|DATA|DEALLOCATE|DIMENSION|DO|END|EQUIVALENCE|EXIT|EXTERNAL|FORMAT|GO ?TO|IMPLICIT(?: NONE)?|INQUIRE|INTENT|INTRINSIC|MODULE PROCEDURE|NAMELIST|NULLIFY|OPEN|OPTIONAL|PARAMETER|POINTER|PRINT|PRIVATE|PUBLIC|READ|RETURN|REWIND|SAVE|SELECT|STOP|TARGET|WHILE|WRITE)\b/i,/\b(?:END ?)?(?:BLOCK ?DATA|DO|FILE|FORALL|FUNCTION|IF|INTERFACE|MODULE|PROGRAM|SELECT|SUBROUTINE|TYPE|WHERE)\b/i,/\b(?:ASSIGNMENT|DEFAULT|ELEMENTAL|ELSE|ELSEWHERE|ELSEIF|ENTRY|IN|INCLUDE|INOUT|KIND|NULL|ONLY|OPERATOR|OUT|PURE|RECURSIVE|RESULT|SEQUENCE|STAT|THEN|USE)\b/i],operator:[/\*\*|\/\/|=>|[=\/]=|[<>]=?|::|[+\-*=%]|\.(?:EQ|NE|LT|LE|GT|GE|NOT|AND|OR|EQV|NEQV)\.|\.[A-Z]+\./i,{pattern:/(^|(?!\().)\/(?!\))/,lookbehind:!0}],punctuation:/\(\/|\/\)|[(),;:&]/}; \ No newline at end of file From 7dd1a6022d68eb49cea779fa7b3d193351df96ba Mon Sep 17 00:00:00 2001 From: Golmote Date: Fri, 19 Dec 2014 23:41:20 +0100 Subject: [PATCH 046/137] Add Pascal language --- components.js | 4 +++ components/prism-pascal.js | 60 ++++++++++++++++++++++++++++++++++ components/prism-pascal.min.js | 1 + 3 files changed, 65 insertions(+) create mode 100644 components/prism-pascal.js create mode 100644 components/prism-pascal.min.js diff --git a/components.js b/components.js index 7bae5697d4..f6ebab3145 100644 --- a/components.js +++ b/components.js @@ -206,6 +206,10 @@ var components = { "handlebars": { "title": "Handlebars", "owner": "Golmote" + }, + "pascal": { + "title": "Pascal", + "owner": "Golmote" } }, "plugins": { diff --git a/components/prism-pascal.js b/components/prism-pascal.js new file mode 100644 index 0000000000..fa7123a900 --- /dev/null +++ b/components/prism-pascal.js @@ -0,0 +1,60 @@ +// Based on Free Pascal + +/* TODO + Support inline asm ? + Use accurate unsigned integer regexp for control string (#...) +*/ + +Prism.languages.pascal = { + 'comment': [ + /\(\*.+?\*\)/, + /\{.+?\}/, + /\/\/.*/ + ], + // The unsigned integer after the # is quite inaccurate... + 'string': [ + /(?:'(?:''|[^'\n])*'|#[&$%]?[a-f\d]+)+/i, + // Char + /\^[a-z]/i + ], + 'keyword': [ + { + // Turbo Pascal + pattern: /(^|(?!&).)\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i, + lookbehind: true + }, + { + // Free Pascal + pattern: /(^|(?!&).)\b(?:dispose|exit|false|new|true)\b/i, + lookbehind: true + }, + { + // Object Pascal + pattern: /(^|(?!&).)\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i, + lookbehind: true + }, + { + // Modifiers + pattern: /(^|(?!&).)\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i, + lookbehind: true + } + ], + 'number': [ + // Hexadecimal + /[+-]?\$[a-f\d]+/i, + // Octal + /[+-]?&[0-7]+/, + // Binary + /[+-]?%[01]+/, + // Decimal + /([+-]|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?/i + ], + 'operator': [ + /\.\.|\*\*|:=|[<>]{2}|[<>+\-*\/]=?|[@^=]/i, + { + pattern: /(^|(?!&).)\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/, + lookbehind: true + } + ], + 'punctuation': /\(\.|\.\)|[()\[\]:;,.]/ +}; \ No newline at end of file diff --git a/components/prism-pascal.min.js b/components/prism-pascal.min.js new file mode 100644 index 0000000000..07846a1543 --- /dev/null +++ b/components/prism-pascal.min.js @@ -0,0 +1 @@ +Prism.languages.pascal={comment:[/\(\*.+?\*\)/,/\{.+?\}/,/\/\/.*/],string:[/(?:'(?:''|[^'\n])*'|#[&$%]?[a-f\d]+)+/i,/\^[a-z]/i],keyword:[{pattern:/(^|(?!&).)\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i,lookbehind:!0},{pattern:/(^|(?!&).)\b(?:dispose|exit|false|new|true)\b/i,lookbehind:!0},{pattern:/(^|(?!&).)\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i,lookbehind:!0},{pattern:/(^|(?!&).)\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i,lookbehind:!0}],number:[/[+-]?\$[a-f\d]+/i,/[+-]?&[0-7]+/,/[+-]?%[01]+/,/([+-]|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?/i],operator:[/\.\.|\*\*|:=|[<>]{2}|[<>+\-*\/]=?|[@^=]/i,{pattern:/(^|(?!&).)\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/,lookbehind:!0}],punctuation:/\(\.|\.\)|[()\[\]:;,.]/}; \ No newline at end of file From dabc5d0532fbe4f98b69df01ff388cd97fbccd70 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 09:33:00 +0100 Subject: [PATCH 047/137] Add LOLCODE language --- components.js | 4 +++ components/prism-lolcode.js | 54 +++++++++++++++++++++++++++++++++ components/prism-lolcode.min.js | 1 + 3 files changed, 59 insertions(+) create mode 100644 components/prism-lolcode.js create mode 100644 components/prism-lolcode.min.js diff --git a/components.js b/components.js index 7bae5697d4..c9b3287bef 100644 --- a/components.js +++ b/components.js @@ -206,6 +206,10 @@ var components = { "handlebars": { "title": "Handlebars", "owner": "Golmote" + }, + "lolcode": { + "title": "LOLCODE", + "owner": "Golmote" } }, "plugins": { diff --git a/components/prism-lolcode.js b/components/prism-lolcode.js new file mode 100644 index 0000000000..46cabe16d5 --- /dev/null +++ b/components/prism-lolcode.js @@ -0,0 +1,54 @@ +Prism.languages.lolcode = { + 'comment': [ + /\bOBTW\s+[\s\S]*?\s+TLDR\b/, + /\bBTW.+/ + ], + 'string': { + pattern: /"(?::.|[^"])*"/, + inside: { + 'variable': /:\{[^}+]\}/, + 'symbol': [ + /:\([a-f\d]+\)/i, + /:\[[^\]]\]/, + /:[)>o":]/ + ] + } + }, + 'number': /(-|\b)\d*\.?\d+/, + 'symbol': { + pattern: /(^|\s)(?:A )?(?:YARN|NUMBR|NUMBAR|TROOF|BUKKIT|NOOB)(?=\s|,|$)/, + lookbehind: true, + inside: { + 'keyword': /A(?=\s)/ + } + }, + 'label': { + pattern: /((?:^|\s)(?:IM IN YR|IM OUTTA YR) )[a-zA-Z]\w*/, + lookbehind: true, + alias: 'string' + }, + 'function': { + pattern: /((?:^|\s)(?:I IZ|HOW IZ I|IZ) )[a-zA-Z]\w*/, + lookbehind: true + }, + 'keyword': [ + { + pattern: /(^|\s)(?:O HAI IM|KTHX|HAI|KTHXBYE|I HAS A|ITZ(?: A)?|R|AN|MKAY|SMOOSH|MAEK|IS NOW(?: A)?|VISIBLE|GIMMEH|O RLY\?|YA RLY|NO WAI|OIC|MEBBE|WTF\?|OMG|OMGWTF|GTFO|IM IN YR|IM OUTTA YR|FOUND YR|YR|TIL|WILE|UPPIN|NERFIN|I IZ|HOW IZ I|IF U SAY SO|SRS|HAS A|LIEK(?: A)?|IZ)(?=\s|,|$)/, + lookbehind: true + }, + /'Z(?=\s|,|$)/ + ], + 'boolean': { + pattern: /(^|\s)(?:WIN|FAIL)(?=\s|,|$)/, + lookbehind: true + }, + 'variable': { + pattern: /(^|\s)(?:IT)(?=\s|,|$)/, + lookbehind: true + }, + 'operator': { + pattern: /(^|\s)(?:NOT|BOTH SAEM|DIFFRINT|(?:SUM|DIFF|PRODUKT|QUOSHUNT|MOD|BIGGR|SMALLR|BOTH|EITHER|WON|ALL|ANY) OF)(?=\s|,|$)/, + lookbehind: true + }, + 'punctuation': /\.{3}|\u2026|,|!/ +}; \ No newline at end of file diff --git a/components/prism-lolcode.min.js b/components/prism-lolcode.min.js new file mode 100644 index 0000000000..78e32d8b19 --- /dev/null +++ b/components/prism-lolcode.min.js @@ -0,0 +1 @@ +Prism.languages.lolcode={comment:[/\bOBTW\s+[\s\S]*?\s+TLDR\b/,/\bBTW.+/],string:{pattern:/"(?::.|[^"])*"/,inside:{variable:/:\{[^}+]\}/,symbol:[/:\([a-f\d]+\)/i,/:\[[^\]]\]/,/:[)>o":]/]}},number:/(-|\b)\d*\.?\d+/,symbol:{pattern:/(^|\s)(?:A )?(?:YARN|NUMBR|NUMBAR|TROOF|BUKKIT|NOOB)(?=\s|,|$)/,lookbehind:!0,inside:{keyword:/A(?=\s)/}},label:{pattern:/((?:^|\s)(?:IM IN YR|IM OUTTA YR) )[a-zA-Z]\w*/,lookbehind:!0,alias:"string"},"function":{pattern:/((?:^|\s)(?:I IZ|HOW IZ I|IZ) )[a-zA-Z]\w*/,lookbehind:!0},keyword:[{pattern:/(^|\s)(?:O HAI IM|KTHX|HAI|KTHXBYE|I HAS A|ITZ(?: A)?|R|AN|MKAY|SMOOSH|MAEK|IS NOW(?: A)?|VISIBLE|GIMMEH|O RLY\?|YA RLY|NO WAI|OIC|MEBBE|WTF\?|OMG|OMGWTF|GTFO|IM IN YR|IM OUTTA YR|FOUND YR|YR|TIL|WILE|UPPIN|NERFIN|I IZ|HOW IZ I|IF U SAY SO|SRS|HAS A|LIEK(?: A)?|IZ)(?=\s|,|$)/,lookbehind:!0},/'Z(?=\s|,|$)/],"boolean":{pattern:/(^|\s)(?:WIN|FAIL)(?=\s|,|$)/,lookbehind:!0},variable:{pattern:/(^|\s)(?:IT)(?=\s|,|$)/,lookbehind:!0},operator:{pattern:/(^|\s)(?:NOT|BOTH SAEM|DIFFRINT|(?:SUM|DIFF|PRODUKT|QUOSHUNT|MOD|BIGGR|SMALLR|BOTH|EITHER|WON|ALL|ANY) OF)(?=\s|,|$)/,lookbehind:!0},punctuation:/\.{3}|\u2026|,|!/}; \ No newline at end of file From 6711ff05d21f40506b45c85d9493c6ee76caa51e Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 10:34:18 +0100 Subject: [PATCH 048/137] Add R language --- components.js | 4 ++++ components/prism-r.js | 19 +++++++++++++++++++ components/prism-r.min.js | 1 + 3 files changed, 24 insertions(+) create mode 100644 components/prism-r.js create mode 100644 components/prism-r.min.js diff --git a/components.js b/components.js index 7bae5697d4..ee6a2b5bc5 100644 --- a/components.js +++ b/components.js @@ -206,6 +206,10 @@ var components = { "handlebars": { "title": "Handlebars", "owner": "Golmote" + }, + "r": { + "title": "R", + "owner": "Golmote" } }, "plugins": { diff --git a/components/prism-r.js b/components/prism-r.js new file mode 100644 index 0000000000..f6d9e20e66 --- /dev/null +++ b/components/prism-r.js @@ -0,0 +1,19 @@ +Prism.languages.r = { + 'comment': /#.+/, + 'string': /(['"])(?:\\?.)*?\1/, + 'percent-operator': { + // Includes user-defined operators + // and %%, %*%, %/%, %in%, %o%, %x% + pattern: /%[^%]*?%/, + alias: 'operator' + }, + 'boolean': /\b(?:TRUE|FALSE)\b/, + 'ellipsis': /\.\.(?:\.|\d+)/, + 'number': [ + /\b(?:NaN|Inf)\b/, + /\b(?:0x[\dA-Fa-f]+(?:\.\d*)?|\d*\.?\d+)(?:[EePp][+-]??\d+)?[iL]?\b/ + ], + 'keyword': /\b(?:if|else|repeat|while|function|for|in|next|break|NULL|NA|NA_integer_|NA_real_|NA_complex_|NA_character_)\b/, + 'operator': /->>?|!=]=?|::?|&&?|\|\|?|[+\-*\/^$@~]/, + 'punctuation': /[(){}\[\],;]/ +}; \ No newline at end of file diff --git a/components/prism-r.min.js b/components/prism-r.min.js new file mode 100644 index 0000000000..6784b40983 --- /dev/null +++ b/components/prism-r.min.js @@ -0,0 +1 @@ +Prism.languages.r={comment:/#.+/,string:/(['"])(?:\\?.)*?\1/,"percent-operator":{pattern:/%[^%]*?%/,alias:"operator"},"boolean":/\b(?:TRUE|FALSE)\b/,ellipsis:/\.\.(?:\.|\d+)/,number:[/\b(?:NaN|Inf)\b/,/\b(?:0x[\dA-Fa-f]+(?:\.\d*)?|\d*\.?\d+)(?:[EePp][+-]??\d+)?[iL]?\b/],keyword:/\b(?:if|else|repeat|while|function|for|in|next|break|NULL|NA|NA_integer_|NA_real_|NA_complex_|NA_character_)\b/,operator:/->>?|!=]=?|::?|&&?|\|\|?|[+\-*\/^$@~]/,punctuation:/[(){}\[\],;]/}; \ No newline at end of file From dee0e7936421d5e885b4cd499d2aa86949aa8495 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 11:48:24 +0100 Subject: [PATCH 049/137] Add Dart language --- components.js | 5 +++++ components/prism-dart.js | 18 ++++++++++++++++++ components/prism-dart.min.js | 1 + 3 files changed, 24 insertions(+) create mode 100644 components/prism-dart.js create mode 100644 components/prism-dart.min.js diff --git a/components.js b/components.js index 7bae5697d4..e560b42538 100644 --- a/components.js +++ b/components.js @@ -206,6 +206,11 @@ var components = { "handlebars": { "title": "Handlebars", "owner": "Golmote" + }, + "dart": { + "title": "Dart", + "require": "clike", + "owner": "Golmote" } }, "plugins": { diff --git a/components/prism-dart.js b/components/prism-dart.js new file mode 100644 index 0000000000..5a6e68a8d9 --- /dev/null +++ b/components/prism-dart.js @@ -0,0 +1,18 @@ +Prism.languages.dart = Prism.languages.extend('clike', { + 'string': [ + /r?("""|''')[\s\S]*?\1/, + /r?("|')(\\?.)*?\1/ + ], + 'keyword': [ + /\b(?:async|sync|yield)\*/, + /\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|default|deferred|do|dynamic|else|enum|export|external|extends|factory|final|finally|for|get|if|implements|import|in|library|new|null|operator|part|rethrow|return|set|static|super|switch|this|throw|try|typedef|var|void|while|with|yield)\b/ + ], + 'operator': /\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/ +}); + +Prism.languages.insertBefore('dart','function',{ + 'metadata': { + pattern: /@\w+/, + alias: 'symbol' + } +}); \ No newline at end of file diff --git a/components/prism-dart.min.js b/components/prism-dart.min.js new file mode 100644 index 0000000000..78dda7faa5 --- /dev/null +++ b/components/prism-dart.min.js @@ -0,0 +1 @@ +Prism.languages.dart=Prism.languages.extend("clike",{string:[/r?("""|''')[\s\S]*?\1/,/r?("|')(\\?.)*?\1/],keyword:[/\b(?:async|sync|yield)\*/,/\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|default|deferred|do|dynamic|else|enum|export|external|extends|factory|final|finally|for|get|if|implements|import|in|library|new|null|operator|part|rethrow|return|set|static|super|switch|this|throw|try|typedef|var|void|while|with|yield)\b/],operator:/\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/}),Prism.languages.insertBefore("dart","function",{metadata:{pattern:/@\w+/,alias:"symbol"}}); \ No newline at end of file From 07067006adfecae09bea8c9e3575068088aa0637 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 11:48:24 +0100 Subject: [PATCH 050/137] Add Dart language --- components.js | 5 +++++ components/prism-dart.js | 18 ++++++++++++++++++ components/prism-dart.min.js | 1 + 3 files changed, 24 insertions(+) create mode 100644 components/prism-dart.js create mode 100644 components/prism-dart.min.js diff --git a/components.js b/components.js index 3c928feafd..5b2ab130a8 100644 --- a/components.js +++ b/components.js @@ -210,6 +210,11 @@ var components = { "matlab": { "title": "MATLAB", "owner": "Golmote" + }, + "dart": { + "title": "Dart", + "require": "clike", + "owner": "Golmote" } }, "plugins": { diff --git a/components/prism-dart.js b/components/prism-dart.js new file mode 100644 index 0000000000..5a6e68a8d9 --- /dev/null +++ b/components/prism-dart.js @@ -0,0 +1,18 @@ +Prism.languages.dart = Prism.languages.extend('clike', { + 'string': [ + /r?("""|''')[\s\S]*?\1/, + /r?("|')(\\?.)*?\1/ + ], + 'keyword': [ + /\b(?:async|sync|yield)\*/, + /\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|default|deferred|do|dynamic|else|enum|export|external|extends|factory|final|finally|for|get|if|implements|import|in|library|new|null|operator|part|rethrow|return|set|static|super|switch|this|throw|try|typedef|var|void|while|with|yield)\b/ + ], + 'operator': /\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/ +}); + +Prism.languages.insertBefore('dart','function',{ + 'metadata': { + pattern: /@\w+/, + alias: 'symbol' + } +}); \ No newline at end of file diff --git a/components/prism-dart.min.js b/components/prism-dart.min.js new file mode 100644 index 0000000000..78dda7faa5 --- /dev/null +++ b/components/prism-dart.min.js @@ -0,0 +1 @@ +Prism.languages.dart=Prism.languages.extend("clike",{string:[/r?("""|''')[\s\S]*?\1/,/r?("|')(\\?.)*?\1/],keyword:[/\b(?:async|sync|yield)\*/,/\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|default|deferred|do|dynamic|else|enum|export|external|extends|factory|final|finally|for|get|if|implements|import|in|library|new|null|operator|part|rethrow|return|set|static|super|switch|this|throw|try|typedef|var|void|while|with|yield)\b/],operator:/\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/}),Prism.languages.insertBefore("dart","function",{metadata:{pattern:/@\w+/,alias:"symbol"}}); \ No newline at end of file From 1aed42eb69e15b191c5464a58fe7efb06c51ce1c Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 14 Dec 2014 18:42:43 +0100 Subject: [PATCH 051/137] Add Less language --- components.js | 5 +++ components/prism-less.js | 64 ++++++++++++++++++++++++++++++++++++ components/prism-less.min.js | 1 + 3 files changed, 70 insertions(+) create mode 100644 components/prism-less.js create mode 100644 components/prism-less.min.js diff --git a/components.js b/components.js index 3c928feafd..118b762368 100644 --- a/components.js +++ b/components.js @@ -210,6 +210,11 @@ var components = { "matlab": { "title": "MATLAB", "owner": "Golmote" + }, + "less": { + "title": "Less", + "require": "css", + "owner": "Golmote" } }, "plugins": { diff --git a/components/prism-less.js b/components/prism-less.js new file mode 100644 index 0000000000..7953b3960b --- /dev/null +++ b/components/prism-less.js @@ -0,0 +1,64 @@ +/* FIXME : + :extend() is not handled specifically : its highlighting is buggy. + Mixin usage must be inside a ruleset to be highlighted. + At-rules (e.g. import) containing interpolations are buggy. + Detached rulesets are highlighted as at-rules. + A comment before a mixin usage prevents the latter to be properly highlighted. + */ + +Prism.languages.less = Prism.languages.extend('css', { + 'comment': [ + /\/\*[\w\W]*?\*\//g, + { + pattern: /(^|[^\\])\/\/.+/g, + lookbehind: true + } + ], + 'atrule': { + pattern: /@[\w-]+?(?:\([^{}]+\)|[^(){};])*?(?=\s*\{)/gi, + inside: { + 'punctuation': /[:()]/g + } + }, + // selectors and mixins are considered the same + 'selector': { + //pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|[^{};@])*?(?:\([^)]*\))?(?=\s*\{)/g, + pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/g, + inside: { + // mixin parameters + 'variable': /@+[\w-]+/ + } + }, + + 'property': /(\b|\B)(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/ig, + 'punctuation': /[{}();:,]/g, + 'operator': /[+\-*\/]/ +}); + +// Invert function and punctuation positions +Prism.languages.insertBefore('less', 'punctuation', { + 'function': Prism.languages.less.function +}); + +Prism.languages.insertBefore('less', 'property', { + 'variable': [ + // declaration + { + pattern: /@[\w-]+\s*:/, + inside: { + "punctuation": /:/ + } + }, + + // usage + /@@?[\w-]+/ + ] +}); + +Prism.languages.insertBefore('less', 'property', { + 'mixin-usage': { + pattern: /([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/, + lookbehind: true, + alias: 'function' + } +}); \ No newline at end of file diff --git a/components/prism-less.min.js b/components/prism-less.min.js new file mode 100644 index 0000000000..8f4d2400e8 --- /dev/null +++ b/components/prism-less.min.js @@ -0,0 +1 @@ +Prism.languages.less=Prism.languages.extend("css",{comment:[/\/\*[\w\W]*?\*\//g,{pattern:/(^|[^\\])\/\/.+/g,lookbehind:!0}],atrule:{pattern:/@[\w-]+?(?:\([^{}]+\)|[^(){};])*?(?=\s*\{)/gi,inside:{punctuation:/[:()]/g}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/g,inside:{variable:/@+[\w-]+/}},property:/(\b|\B)(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/gi,punctuation:/[{}();:,]/g,operator:/[+\-*\/]/}),Prism.languages.insertBefore("less","punctuation",{"function":Prism.languages.less.function}),Prism.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/]}),Prism.languages.insertBefore("less","property",{"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/,lookbehind:!0,alias:"function"}}); \ No newline at end of file From 72c400313c9ce9f2b6e452ffa7280558d741c9d7 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 14 Dec 2014 18:46:15 +0100 Subject: [PATCH 052/137] Removed useless comment and reformatted Less component --- components/prism-less.js | 10 +++------- components/prism-less.min.js | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/components/prism-less.js b/components/prism-less.js index 7953b3960b..995f3bee97 100644 --- a/components/prism-less.js +++ b/components/prism-less.js @@ -22,7 +22,6 @@ Prism.languages.less = Prism.languages.extend('css', { }, // selectors and mixins are considered the same 'selector': { - //pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|[^{};@])*?(?:\([^)]*\))?(?=\s*\{)/g, pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/g, inside: { // mixin parameters @@ -42,7 +41,7 @@ Prism.languages.insertBefore('less', 'punctuation', { Prism.languages.insertBefore('less', 'property', { 'variable': [ - // declaration + // Variable declaration (the colon must be consumed!) { pattern: /@[\w-]+\s*:/, inside: { @@ -50,12 +49,9 @@ Prism.languages.insertBefore('less', 'property', { } }, - // usage + // Variable usage /@@?[\w-]+/ - ] -}); - -Prism.languages.insertBefore('less', 'property', { + ], 'mixin-usage': { pattern: /([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/, lookbehind: true, diff --git a/components/prism-less.min.js b/components/prism-less.min.js index 8f4d2400e8..13d53f6213 100644 --- a/components/prism-less.min.js +++ b/components/prism-less.min.js @@ -1 +1 @@ -Prism.languages.less=Prism.languages.extend("css",{comment:[/\/\*[\w\W]*?\*\//g,{pattern:/(^|[^\\])\/\/.+/g,lookbehind:!0}],atrule:{pattern:/@[\w-]+?(?:\([^{}]+\)|[^(){};])*?(?=\s*\{)/gi,inside:{punctuation:/[:()]/g}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/g,inside:{variable:/@+[\w-]+/}},property:/(\b|\B)(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/gi,punctuation:/[{}();:,]/g,operator:/[+\-*\/]/}),Prism.languages.insertBefore("less","punctuation",{"function":Prism.languages.less.function}),Prism.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/]}),Prism.languages.insertBefore("less","property",{"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/,lookbehind:!0,alias:"function"}}); \ No newline at end of file +Prism.languages.less=Prism.languages.extend("css",{comment:[/\/\*[\w\W]*?\*\//g,{pattern:/(^|[^\\])\/\/.+/g,lookbehind:!0}],atrule:{pattern:/@[\w-]+?(?:\([^{}]+\)|[^(){};])*?(?=\s*\{)/gi,inside:{punctuation:/[:()]/g}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/g,inside:{variable:/@+[\w-]+/}},property:/(\b|\B)(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/gi,punctuation:/[{}();:,]/g,operator:/[+\-*\/]/}),Prism.languages.insertBefore("less","punctuation",{"function":Prism.languages.less.function}),Prism.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/,lookbehind:!0,alias:"function"}}); \ No newline at end of file From aba1a72c3fa9f730a9f1e7f023f676349b38e0e6 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 12:23:55 +0100 Subject: [PATCH 053/137] Simplify hex, oct and bin number detection --- components/prism-pascal.js | 10 ++-------- components/prism-pascal.min.js | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/components/prism-pascal.js b/components/prism-pascal.js index fa7123a900..1ab946b96b 100644 --- a/components/prism-pascal.js +++ b/components/prism-pascal.js @@ -2,7 +2,6 @@ /* TODO Support inline asm ? - Use accurate unsigned integer regexp for control string (#...) */ Prism.languages.pascal = { @@ -11,7 +10,6 @@ Prism.languages.pascal = { /\{.+?\}/, /\/\/.*/ ], - // The unsigned integer after the # is quite inaccurate... 'string': [ /(?:'(?:''|[^'\n])*'|#[&$%]?[a-f\d]+)+/i, // Char @@ -40,12 +38,8 @@ Prism.languages.pascal = { } ], 'number': [ - // Hexadecimal - /[+-]?\$[a-f\d]+/i, - // Octal - /[+-]?&[0-7]+/, - // Binary - /[+-]?%[01]+/, + // Hexadecimal, octal and binary + /[+-]?[&$%][a-f\d]+/i, // Decimal /([+-]|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?/i ], diff --git a/components/prism-pascal.min.js b/components/prism-pascal.min.js index 07846a1543..536224831b 100644 --- a/components/prism-pascal.min.js +++ b/components/prism-pascal.min.js @@ -1 +1 @@ -Prism.languages.pascal={comment:[/\(\*.+?\*\)/,/\{.+?\}/,/\/\/.*/],string:[/(?:'(?:''|[^'\n])*'|#[&$%]?[a-f\d]+)+/i,/\^[a-z]/i],keyword:[{pattern:/(^|(?!&).)\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i,lookbehind:!0},{pattern:/(^|(?!&).)\b(?:dispose|exit|false|new|true)\b/i,lookbehind:!0},{pattern:/(^|(?!&).)\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i,lookbehind:!0},{pattern:/(^|(?!&).)\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i,lookbehind:!0}],number:[/[+-]?\$[a-f\d]+/i,/[+-]?&[0-7]+/,/[+-]?%[01]+/,/([+-]|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?/i],operator:[/\.\.|\*\*|:=|[<>]{2}|[<>+\-*\/]=?|[@^=]/i,{pattern:/(^|(?!&).)\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/,lookbehind:!0}],punctuation:/\(\.|\.\)|[()\[\]:;,.]/}; \ No newline at end of file +Prism.languages.pascal={comment:[/\(\*.+?\*\)/,/\{.+?\}/,/\/\/.*/],string:[/(?:'(?:''|[^'\n])*'|#[&$%]?[a-f\d]+)+/i,/\^[a-z]/i],keyword:[{pattern:/(^|(?!&).)\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i,lookbehind:!0},{pattern:/(^|(?!&).)\b(?:dispose|exit|false|new|true)\b/i,lookbehind:!0},{pattern:/(^|(?!&).)\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i,lookbehind:!0},{pattern:/(^|(?!&).)\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i,lookbehind:!0}],number:[/[+-]?[&$%][a-f\d]+/i,/([+-]|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?/i],operator:[/\.\.|\*\*|:=|[<>]{2}|[<>+\-*\/]=?|[@^=]/i,{pattern:/(^|(?!&).)\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/,lookbehind:!0}],punctuation:/\(\.|\.\)|[()\[\]:;,.]/}; \ No newline at end of file From f2d0be11a12f6295cb01aab08c25d38b54b164ec Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 12:55:15 +0100 Subject: [PATCH 054/137] Minor edits --- components/prism-haml.js | 25 +++++++++++++------------ components/prism-haml.min.js | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/components/prism-haml.js b/components/prism-haml.js index 6910237ebb..36da2b16df 100644 --- a/components/prism-haml.js +++ b/components/prism-haml.js @@ -127,22 +127,23 @@ // Non exhaustive list of available filters and associated languages var filters = [ - {filter:'css',language:'css'}, + 'css', {filter:'coffee',language:'coffeescript'}, - {filter:'erb',language:'erb'}, - {filter:'javascript',language:'javascript'}, - {filter:'less',language:'less'}, - {filter:'markdown',language:'markdown'}, - {filter:'ruby',language:'ruby'}, - {filter:'scss',language:'scss'}, - {filter:'textile',language:'textile'} + 'erb', + 'javascript', + 'less', + 'markdown', + 'ruby', + 'scss', + 'textile' ]; var all_filters = {}; - for(var i=0,l=filters.length;i]*/,lookbehind:!0,inside:{attributes:[{pattern:/(^|[^#])\{(?:\{[^}]+\}|[^}])+\}/,lookbehind:!0,inside:{rest:a.languages.ruby}},{pattern:/\([^)]+\)/,inside:{"attr-value":{pattern:/(=\s*)(?:"(?:\\?.)*?"|[^)\s]+)/,lookbehind:!0},"attr-name":/[\w:-]+(?=\s*!?=|\s*[,)])/,punctuation:/[=(),]/}},{pattern:/\[[^\]]+\]/,inside:{rest:a.languages.ruby}}],punctuation:/[<>]/}},code:{pattern:/((?:^|\n)[\t ]*(?:[~-]|[&!]?=)).+/,lookbehind:!0,inside:{rest:a.languages.ruby}},interpolation:{pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"},rest:a.languages.ruby}},punctuation:{pattern:/((?:^|\n)[\t ]*)[~=\-&!]/,lookbehind:!0}};for(var b="((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+",c=[{filter:"css",language:"css"},{filter:"coffee",language:"coffeescript"},{filter:"erb",language:"erb"},{filter:"javascript",language:"javascript"},{filter:"less",language:"less"},{filter:"markdown",language:"markdown"},{filter:"ruby",language:"ruby"},{filter:"scss",language:"scss"},{filter:"textile",language:"textile"}],d={},e=0,f=c.length;f>e;e++){var g=c[e];a.languages[g.language]&&(d["filter-"+g.filter]={pattern:new RegExp(b.replace("{{filter_name}}",g.filter)),lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"},rest:a.languages[g.language]}})}a.languages.insertBefore("haml","filter",d)}(Prism); \ No newline at end of file +!function(a){a.languages.haml={"multiline-comment":[{pattern:/((?:^|\n)([\t ]*))\/.*(\n\2[\t ]+.+)*/,lookbehind:!0,alias:"comment"},{pattern:/((?:^|\n)([\t ]*))-#.*(\n\2[\t ]+.+)*/,lookbehind:!0,alias:"comment"}],"multiline-code":[{pattern:/((?:^|\n)([\t ]*)(?:[~-]|[&!]?=)).*,[\t ]*(\n\2[\t ]+.*,[\t ]*)*(\n\2[\t ]+.+)/,lookbehind:!0,inside:{rest:a.languages.ruby}},{pattern:/((?:^|\n)([\t ]*)(?:[~-]|[&!]?=)).*\|[\t ]*(\n\2[\t ]+.*\|[\t ]*)*/,lookbehind:!0,inside:{rest:a.languages.ruby}}],filter:{pattern:/((?:^|\n)([\t ]*)):[\w-]+(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"}}},markup:{pattern:/((?:^|\n)[\t ]*)<.+/,lookbehind:!0,inside:{rest:a.languages.markup}},doctype:{pattern:/((?:^|\n)[\t ]*)!!!(?: .+)?/,lookbehind:!0},tag:{pattern:/((?:^|\n)[\t ]*)[%.#][\w\-#.]*[\w\-](?:\([^)]+\)|\{(?:\{[^}]+\}|[^}])+\}|\[[^\]]+\])*[\/<>]*/,lookbehind:!0,inside:{attributes:[{pattern:/(^|[^#])\{(?:\{[^}]+\}|[^}])+\}/,lookbehind:!0,inside:{rest:a.languages.ruby}},{pattern:/\([^)]+\)/,inside:{"attr-value":{pattern:/(=\s*)(?:"(?:\\?.)*?"|[^)\s]+)/,lookbehind:!0},"attr-name":/[\w:-]+(?=\s*!?=|\s*[,)])/,punctuation:/[=(),]/}},{pattern:/\[[^\]]+\]/,inside:{rest:a.languages.ruby}}],punctuation:/[<>]/}},code:{pattern:/((?:^|\n)[\t ]*(?:[~-]|[&!]?=)).+/,lookbehind:!0,inside:{rest:a.languages.ruby}},interpolation:{pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"},rest:a.languages.ruby}},punctuation:{pattern:/((?:^|\n)[\t ]*)[~=\-&!]/,lookbehind:!0}};for(var b="((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+",c=["css",{filter:"coffee",language:"coffeescript"},"erb","javascript","less","markdown","ruby","scss","textile"],d={},e=0,f=c.length;f>e;e++){var g=c[e];g="filter"in g?g:{filter:g,language:g},a.languages[g.language]&&(d["filter-"+g.filter]={pattern:RegExp(b.replace("{{filter_name}}",g.filter)),lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"},rest:a.languages[g.language]}})}a.languages.insertBefore("haml","filter",d)}(Prism); \ No newline at end of file From 61bf0eaec6bfea3d82ee5523abf36a5b2601e519 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 13:04:34 +0100 Subject: [PATCH 055/137] Fixed broken ternary --- components/prism-haml.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-haml.js b/components/prism-haml.js index 36da2b16df..eb0b9a9138 100644 --- a/components/prism-haml.js +++ b/components/prism-haml.js @@ -140,7 +140,7 @@ var all_filters = {}; for (var i = 0, l = filters.length; i < l; i++) { var filter = filters[i]; - filter = 'filter' in filter ? filter : {filter: filter, language: filter}; + filter = typeof filter === 'string' ? {filter: filter, language: filter} : filter; if (Prism.languages[filter.language]) { all_filters['filter-' + filter.filter] = { pattern: RegExp(filter_pattern.replace('{{filter_name}}', filter.filter)), From 77848153f536e4a3e7df04a7eb8e52dd264eac25 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 13:12:45 +0100 Subject: [PATCH 056/137] Minor edits --- components/prism-jade.js | 29 +++++++++++++++-------------- components/prism-jade.min.js | 2 +- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/components/prism-jade.js b/components/prism-jade.js index 0a0d2611ae..e734706696 100644 --- a/components/prism-jade.js +++ b/components/prism-jade.js @@ -159,25 +159,26 @@ var filters = [ {filter:'atpl',language:'twig'}, {filter:'coffee',language:'coffeescript'}, - {filter:'ejs',language:'ejs'}, - {filter:'handlebars',language:'handlebars'}, - {filter:'hogan',language:'hogan'}, - {filter:'less',language:'less'}, - {filter:'livescript',language:'livescript'}, - {filter:'markdown',language:'markdown'}, - {filter:'mustache',language:'mustache'}, - {filter:'plates',language:'plates'}, + 'ejs', + 'handlebars', + 'hogan', + 'less', + 'livescript', + 'markdown', + 'mustache', + 'plates', {filter:'sass',language:'scss'}, - {filter:'stylus',language:'stylus'}, - {filter:'swig',language:'swig'} + 'stylus', + 'swig' ]; var all_filters = {}; - for(var i=0,l=filters.length;ie;e++){var g=c[e];a.languages[g.language]&&(d["filter-"+g.filter]={pattern:new RegExp(b.replace("{{filter_name}}",g.filter)),lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"},rest:a.languages[g.language]}})}a.languages.insertBefore("jade","filter",d)}(Prism); \ No newline at end of file +!function(a){a.languages.jade={"multiline-comment":{pattern:/((?:^|\n)([\t ]*))\/\/.*(\n\2[\t ]+.+)*/,lookbehind:!0,alias:"comment"},"multiline-script":{pattern:/((?:^|\n)([\t ]*)script\b.*\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{rest:a.languages.javascript}},filter:{pattern:/((?:^|\n)([\t ]*)):.+(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"}}},"multiline-plain-text":{pattern:/((?:^|\n)([\t ]*)[\w\-#.]+\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0},markup:{pattern:/((?:^|\n)[\t ]*)<.+/,lookbehind:!0,inside:{rest:a.languages.markup}},comment:{pattern:/((?:^|\n)[\t ]*)\/\/.+/,lookbehind:!0},doctype:{pattern:/((?:^|\n)[\t ]*)doctype(?: .+)?/,lookbehind:!0},"flow-control":{pattern:/((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|each|while)(?: .+)?/,lookbehind:!0,inside:{each:{pattern:/((?:^|\n)[\t ]*)each .+? in\b/,lookbehind:!0,inside:{keyword:/\b(?:each|in)\b/,punctuation:/,/}},branch:{pattern:/((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|while)/,lookbehind:!0,alias:"keyword"},rest:a.languages.javascript}},keyword:{pattern:/((?:^|\n)[\t ]*)(?:block|extends|include|append|prepend)\b.+/,lookbehind:!0},mixin:[{pattern:/((?:^|\n)[\t ]*)mixin .+/,lookbehind:!0,inside:{keyword:/^mixin/,"function":/\w+(?=\s*\(|\s*$)/,punctuation:/[(),.]/}},{pattern:/((?:^|\n)[\t ]*)\+.+/,lookbehind:!0,inside:{name:{pattern:/^\+\w+/,alias:"function"},rest:a.languages.javascript}}],script:{pattern:/((?:^|\n)[\t ]*script(?:(?:&[^(]+)?\([^)]+\))*) .+/,lookbehind:!0,inside:{rest:a.languages.javascript}},"plain-text":{pattern:/((?:^|\n)[\t ]*(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?[\t ]+).+/,lookbehind:!0},tag:{pattern:/((?:^|\n)[\t ]*)(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?:?/,lookbehind:!0,inside:{attributes:[{pattern:/&[^(]+\([^)]+\)/,inside:{rest:a.languages.javascript}},{pattern:/\([^)]+\)/,inside:{"attr-value":{pattern:/(=\s*)(?:\{[^}]*\}|[^,)\n]+)/,lookbehind:!0,inside:{rest:a.languages.javascript}},"attr-name":/[\w-]+(?=\s*!?=|\s*[,)])/,punctuation:/[!=(),]/}}],punctuation:/[:]/}},code:[{pattern:/((?:^|\n)[\t ]*(?:-|!?=)).+/,lookbehind:!0,inside:{rest:a.languages.javascript}}],punctuation:/[.\-!=|]/};for(var b="((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+",c=[{filter:"atpl",language:"twig"},{filter:"coffee",language:"coffeescript"},"ejs","handlebars","hogan","less","livescript","markdown","mustache","plates",{filter:"sass",language:"scss"},"stylus","swig"],d={},e=0,f=c.length;f>e;e++){var g=c[e];g="string"==typeof g?{filter:g,language:g}:g,a.languages[g.language]&&(d["filter-"+g.filter]={pattern:RegExp(b.replace("{{filter_name}}",g.filter)),lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"},rest:a.languages[g.language]}})}a.languages.insertBefore("jade","filter",d)}(Prism); \ No newline at end of file From 923e1998ab85fa69b5ffb6617657a47730aad8d4 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 13:32:46 +0100 Subject: [PATCH 057/137] Add condition around xml highlighting --- components/prism-actionscript.js | 16 +++++++++------- components/prism-actionscript.min.js | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/components/prism-actionscript.js b/components/prism-actionscript.js index be05c6b94a..501e4d6e6c 100644 --- a/components/prism-actionscript.js +++ b/components/prism-actionscript.js @@ -16,11 +16,13 @@ Prism.languages.actionscript = Prism.languages.extend('javascript', { }); Prism.languages.actionscript['class-name'].alias = 'function'; -Prism.languages.insertBefore('actionscript', 'operator', { - 'xml': { - pattern: /(^|[^.])<[\s\S]*>(?=\s*($|[\r\n,.;\]})<]))/, - inside: { - rest: Prism.languages.markup +if (Prism.languages.markup) { + Prism.languages.insertBefore('actionscript', 'operator', { + 'xml': { + pattern: /(^|[^.])<[\s\S]*>(?=\s*($|[\r\n,.;\]})<]))/, + inside: { + rest: Prism.languages.markup + } } - } -}); \ No newline at end of file + }); +} \ No newline at end of file diff --git a/components/prism-actionscript.min.js b/components/prism-actionscript.min.js index ed17f4a500..bec097d2e0 100644 --- a/components/prism-actionscript.min.js +++ b/components/prism-actionscript.min.js @@ -1 +1 @@ -Prism.languages.actionscript=Prism.languages.extend("javascript",{keyword:[/\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/,/\b(?:each|dynamic|final|get|include|namespace|native|override|set|static)\b/],number:/\b-?(\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g,operator:/(?:[+\-*\/%^]|&&?|\|\|?|<>?>?|[!=]=)=?|[=~?@]/,"function":/(?!\d)[a-z0-9_$]+(?=\()/gi}),Prism.languages.actionscript["class-name"].alias="function",Prism.languages.insertBefore("actionscript","operator",{xml:{pattern:/(^|[^.])<[\s\S]*>(?=\s*($|[\r\n,.;\]})<]))/,inside:{rest:Prism.languages.markup}}}); \ No newline at end of file +Prism.languages.actionscript=Prism.languages.extend("javascript",{keyword:[/\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/,/\b(?:each|dynamic|final|get|include|namespace|native|override|set|static)\b/],number:/\b-?(\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g,operator:/(?:[+\-*\/%^]|&&?|\|\|?|<>?>?|[!=]=)=?|[=~?@]/,"function":/(?!\d)[a-z0-9_$]+(?=\()/gi}),Prism.languages.actionscript["class-name"].alias="function",Prism.languages.markup&&Prism.languages.insertBefore("actionscript","operator",{xml:{pattern:/(^|[^.])<[\s\S]*>(?=\s*($|[\r\n,.;\]})<]))/,inside:{rest:Prism.languages.markup}}}); \ No newline at end of file From 68858669570e0f3dd0415a02b3c5e2fef751269e Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 13:36:18 +0100 Subject: [PATCH 058/137] Merge all keywords in one regexp --- components/prism-actionscript.js | 8 +------- components/prism-actionscript.min.js | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/components/prism-actionscript.js b/components/prism-actionscript.js index 501e4d6e6c..d116c7c252 100644 --- a/components/prism-actionscript.js +++ b/components/prism-actionscript.js @@ -3,13 +3,7 @@ */ Prism.languages.actionscript = Prism.languages.extend('javascript', { - 'keyword': [ - // Lexical keywords - // Intentionally ignore true and false that are already handled as booleans - /\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/, - // Syntactic keywords - /\b(?:each|dynamic|final|get|include|namespace|native|override|set|static)\b/ - ], + 'keyword': /\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with|dynamic|each|final|get|include|namespace|native|override|set|static)\b/, 'number': /\b-?(\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g, 'operator': /(?:[+\-*\/%^]|&&?|\|\|?|<>?>?|[!=]=)=?|[=~?@]/, 'function': /(?!\d)[a-z0-9_$]+(?=\()/ig diff --git a/components/prism-actionscript.min.js b/components/prism-actionscript.min.js index bec097d2e0..a53c76fa8e 100644 --- a/components/prism-actionscript.min.js +++ b/components/prism-actionscript.min.js @@ -1 +1 @@ -Prism.languages.actionscript=Prism.languages.extend("javascript",{keyword:[/\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/,/\b(?:each|dynamic|final|get|include|namespace|native|override|set|static)\b/],number:/\b-?(\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g,operator:/(?:[+\-*\/%^]|&&?|\|\|?|<>?>?|[!=]=)=?|[=~?@]/,"function":/(?!\d)[a-z0-9_$]+(?=\()/gi}),Prism.languages.actionscript["class-name"].alias="function",Prism.languages.markup&&Prism.languages.insertBefore("actionscript","operator",{xml:{pattern:/(^|[^.])<[\s\S]*>(?=\s*($|[\r\n,.;\]})<]))/,inside:{rest:Prism.languages.markup}}}); \ No newline at end of file +Prism.languages.actionscript=Prism.languages.extend("javascript",{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with|dynamic|each|final|get|include|namespace|native|override|set|static)\b/,number:/\b-?(\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g,operator:/(?:[+\-*\/%^]|&&?|\|\|?|<>?>?|[!=]=)=?|[=~?@]/,"function":/(?!\d)[a-z0-9_$]+(?=\()/gi}),Prism.languages.actionscript["class-name"].alias="function",Prism.languages.markup&&Prism.languages.insertBefore("actionscript","operator",{xml:{pattern:/(^|[^.])<[\s\S]*>(?=\s*($|[\r\n,.;\]})<]))/,inside:{rest:Prism.languages.markup}}}); \ No newline at end of file From 24659943b32597565afcff884c32bf1e2586bb0e Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 14:02:11 +0100 Subject: [PATCH 059/137] Merge all keywords in one regexp --- components/prism-applescript.js | 25 +++++-------------------- components/prism-applescript.min.js | 2 +- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/components/prism-applescript.js b/components/prism-applescript.js index 61b7959f02..9dd52bc26e 100644 --- a/components/prism-applescript.js +++ b/components/prism-applescript.js @@ -11,28 +11,13 @@ Prism.languages.applescript = { 'string': /"(?:\\?.)*?"/, 'operator': [ /[&=≠≤≥*+\-\/÷^]|[<>]=?/, - - /\b(?:start|begin|end)s? with\b/, - /\b(?:(?:does not|doesn't) contain|contains?)\b/, - /\b(?:is|isn't|is not) (?:in|contained by)\b/, - /\b(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?\b/, - /\b(?:(?:does not|doesn't) come|comes) (?:before|after)\b/, - /\b(?:is|isn't|is not) equal(?: to)?\b/, - /\b(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)\b/, - /\b(?:a )?(?:ref(?: to)?|reference to)\b/, - /\b(?:and|or|div|mod|as|not)\b/ + /\b(?:(?:start|begin|end)s? with|(?:(?:does not|doesn't) contain|contains?)|(?:is|isn't|is not) (?:in|contained by)|(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?|(?:(?:does not|doesn't) come|comes) (?:before|after)|(?:is|isn't|is not) equal(?: to)?|(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)|(?:a )?(?:ref(?: to)?|reference to)|(?:and|or|div|mod|as|not))\b/ ], 'keyword': /\b(?:about|above|after|against|and|apart from|around|as|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|contain|contains|continue|copy|div|does|eighth|else|end|equal|equals|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|mod|my|ninth|not|of|on|onto|or|out of|over|prop|property|put|ref|reference|repeat|return|returning|script|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/g, - 'class': [ - { - pattern: /\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text)\b/, - alias: 'builtin' - }, - { - pattern: /\b(?:centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/, - alias: 'builtin' - } - ], + 'class': { + pattern: /\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text|centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/, + alias: 'builtin' + }, 'number': /\b-?\d*\.?\d+([Ee]-?\d+)?\b/, 'punctuation': /[{}():,¬«»《》]/ }; \ No newline at end of file diff --git a/components/prism-applescript.min.js b/components/prism-applescript.min.js index b6c01e425b..4b52d13f36 100644 --- a/components/prism-applescript.min.js +++ b/components/prism-applescript.min.js @@ -1 +1 @@ -Prism.languages.applescript={comment:[/\(\*[\w\W]*?\*\)/,/--.+/,/#.+/],string:/"(?:\\?.)*?"/,operator:[/[&=\u2260\u2264\u2265*+\-\/\xf7^]|[<>]=?/,/\b(?:start|begin|end)s? with\b/,/\b(?:(?:does not|doesn't) contain|contains?)\b/,/\b(?:is|isn't|is not) (?:in|contained by)\b/,/\b(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?\b/,/\b(?:(?:does not|doesn't) come|comes) (?:before|after)\b/,/\b(?:is|isn't|is not) equal(?: to)?\b/,/\b(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)\b/,/\b(?:a )?(?:ref(?: to)?|reference to)\b/,/\b(?:and|or|div|mod|as|not)\b/],keyword:/\b(?:about|above|after|against|and|apart from|around|as|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|contain|contains|continue|copy|div|does|eighth|else|end|equal|equals|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|mod|my|ninth|not|of|on|onto|or|out of|over|prop|property|put|ref|reference|repeat|return|returning|script|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/g,"class":[{pattern:/\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text)\b/,alias:"builtin"},{pattern:/\b(?:centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/,alias:"builtin"}],number:/\b-?\d*\.?\d+([Ee]-?\d+)?\b/,punctuation:/[{}():,\xac\xab\xbb\u300a\u300b]/}; \ No newline at end of file +Prism.languages.applescript={comment:[/\(\*[\w\W]*?\*\)/,/--.+/,/#.+/],string:/"(?:\\?.)*?"/,operator:[/[&=\u2260\u2264\u2265*+\-\/\xf7^]|[<>]=?/,/\b(?:(?:start|begin|end)s? with|(?:(?:does not|doesn't) contain|contains?)|(?:is|isn't|is not) (?:in|contained by)|(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?|(?:(?:does not|doesn't) come|comes) (?:before|after)|(?:is|isn't|is not) equal(?: to)?|(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)|(?:a )?(?:ref(?: to)?|reference to)|(?:and|or|div|mod|as|not))\b/],keyword:/\b(?:about|above|after|against|and|apart from|around|as|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|contain|contains|continue|copy|div|does|eighth|else|end|equal|equals|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|mod|my|ninth|not|of|on|onto|or|out of|over|prop|property|put|ref|reference|repeat|return|returning|script|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/g,"class":{pattern:/\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text|centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/,alias:"builtin"},number:/\b-?\d*\.?\d+([Ee]-?\d+)?\b/,punctuation:/[{}():,\xac\xab\xbb\u300a\u300b]/}; \ No newline at end of file From 86b4d4df8d21d4048c48c317b595b9cb538e47b8 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 14:21:28 +0100 Subject: [PATCH 060/137] Run gulp tasks --- components/prism-applescript.min.js | 2 +- components/prism-coffeescript.min.js | 2 +- components/prism-core.min.js | 2 +- components/prism-git.min.js | 2 +- components/prism-haml.min.js | 2 +- components/prism-handlebars.min.js | 2 +- components/prism-http.min.js | 2 +- components/prism-jade.min.js | 2 +- components/prism-nasm.min.js | 2 +- components/prism-nsis.min.js | 6 +----- components/prism-scheme.min.js | 2 +- components/prism-sql.min.js | 2 +- plugins/autolinker/prism-autolinker.min.js | 2 +- plugins/file-highlight/prism-file-highlight.min.js | 2 +- 14 files changed, 14 insertions(+), 18 deletions(-) diff --git a/components/prism-applescript.min.js b/components/prism-applescript.min.js index 4b52d13f36..d93dd108d4 100644 --- a/components/prism-applescript.min.js +++ b/components/prism-applescript.min.js @@ -1 +1 @@ -Prism.languages.applescript={comment:[/\(\*[\w\W]*?\*\)/,/--.+/,/#.+/],string:/"(?:\\?.)*?"/,operator:[/[&=\u2260\u2264\u2265*+\-\/\xf7^]|[<>]=?/,/\b(?:(?:start|begin|end)s? with|(?:(?:does not|doesn't) contain|contains?)|(?:is|isn't|is not) (?:in|contained by)|(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?|(?:(?:does not|doesn't) come|comes) (?:before|after)|(?:is|isn't|is not) equal(?: to)?|(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)|(?:a )?(?:ref(?: to)?|reference to)|(?:and|or|div|mod|as|not))\b/],keyword:/\b(?:about|above|after|against|and|apart from|around|as|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|contain|contains|continue|copy|div|does|eighth|else|end|equal|equals|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|mod|my|ninth|not|of|on|onto|or|out of|over|prop|property|put|ref|reference|repeat|return|returning|script|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/g,"class":{pattern:/\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text|centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/,alias:"builtin"},number:/\b-?\d*\.?\d+([Ee]-?\d+)?\b/,punctuation:/[{}():,\xac\xab\xbb\u300a\u300b]/}; \ No newline at end of file +Prism.languages.applescript={comment:[/\(\*[\w\W]*?\*\)/,/--.+/,/#.+/],string:/"(?:\\?.)*?"/,operator:[/[&=≠≤≥*+\-\/÷^]|[<>]=?/,/\b(?:(?:start|begin|end)s? with|(?:(?:does not|doesn't) contain|contains?)|(?:is|isn't|is not) (?:in|contained by)|(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?|(?:(?:does not|doesn't) come|comes) (?:before|after)|(?:is|isn't|is not) equal(?: to)?|(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)|(?:a )?(?:ref(?: to)?|reference to)|(?:and|or|div|mod|as|not))\b/],keyword:/\b(?:about|above|after|against|and|apart from|around|as|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|contain|contains|continue|copy|div|does|eighth|else|end|equal|equals|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|mod|my|ninth|not|of|on|onto|or|out of|over|prop|property|put|ref|reference|repeat|return|returning|script|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/g,"class":{pattern:/\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text|centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/,alias:"builtin"},number:/\b-?\d*\.?\d+([Ee]-?\d+)?\b/,punctuation:/[{}():,¬«»《》]/}; \ No newline at end of file diff --git a/components/prism-coffeescript.min.js b/components/prism-coffeescript.min.js index 6f871fff72..3566857998 100644 --- a/components/prism-coffeescript.min.js +++ b/components/prism-coffeescript.min.js @@ -1 +1 @@ -!function(a){var b=/#(?!\{).+/g,c={pattern:/#\{[^}]+\}/g,alias:"variable"};a.languages.coffeescript=a.languages.extend("javascript",{comment:b,string:[/'(?:\\?[\s\S])*?'/g,{pattern:/"(?:\\?[\s\S])*?"/g,inside:{interpolation:c}}],keyword:/\b(and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/g,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),a.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/g,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:b,interpolation:c}}}),a.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\?[\s\S])*?`/g,inside:{delimiter:{pattern:/^`|`$/g,alias:"punctuation"},rest:a.languages.javascript}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,alias:"string"},{pattern:/"""[\s\S]*?"""/,alias:"string",inside:{interpolation:c}}]}),a.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/g})}(Prism); \ No newline at end of file +!function(e){var n=/#(?!\{).+/g,t={pattern:/#\{[^}]+\}/g,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:n,string:[/'(?:\\?[\s\S])*?'/g,{pattern:/"(?:\\?[\s\S])*?"/g,inside:{interpolation:t}}],keyword:/\b(and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/g,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/g,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:n,interpolation:t}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\?[\s\S])*?`/g,inside:{delimiter:{pattern:/^`|`$/g,alias:"punctuation"},rest:e.languages.javascript}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,alias:"string"},{pattern:/"""[\s\S]*?"""/,alias:"string",inside:{interpolation:t}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/g})}(Prism); \ No newline at end of file diff --git a/components/prism-core.min.js b/components/prism-core.min.js index 5602717f1a..8adebed4c3 100644 --- a/components/prism-core.min.js +++ b/components/prism-core.min.js @@ -1 +1 @@ -self=typeof window!="undefined"?window:typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope?self:{};var Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content),e.alias):t.util.type(e)==="Array"?e.map(t.util.encode):e.replace(/&/g,"&").replace(/e.length)break e;if(m instanceof i)continue;l.lastIndex=0;var g=l.exec(m);if(g){h&&(p=g[1].length);var y=g.index-1+p,g=g[0].slice(p),b=g.length,w=y+b,E=m.slice(0,y+1),S=m.slice(w+1),x=[v,1];E&&x.push(E);var T=new i(u,c?t.tokenize(g,c):g,d);x.push(T);S&&x.push(S);Array.prototype.splice.apply(s,x)}}}}return s},hooks:{all:{},add:function(e,n){var r=t.hooks.all;r[e]=r[e]||[];r[e].push(n)},run:function(e,n){var r=t.hooks.all[e];if(!r||!r.length)return;for(var i=0,s;s=r[i++];)s(n)}}},n=t.Token=function(e,t,n){this.type=e;this.content=t;this.alias=n};n.stringify=function(e,r,i){if(typeof e=="string")return e;if(Object.prototype.toString.call(e)=="[object Array]")return e.map(function(t){return n.stringify(t,r,e)}).join("");var s={type:e.type,content:n.stringify(e.content,r,i),tag:"span",classes:["token",e.type],attributes:{},language:r,parent:i};s.type=="comment"&&(s.attributes.spellcheck="true");if(e.alias){var o=t.util.type(e.alias)==="Array"?e.alias:[e.alias];Array.prototype.push.apply(s.classes,o)}t.hooks.run("wrap",s);var u="";for(var a in s.attributes)u+=a+'="'+(s.attributes[a]||"")+'"';return"<"+s.tag+' class="'+s.classes.join(" ")+'" '+u+">"+s.content+""};if(!self.document){if(!self.addEventListener)return self.Prism;self.addEventListener("message",function(e){var n=JSON.parse(e.data),r=n.language,i=n.code;self.postMessage(JSON.stringify(t.util.encode(t.tokenize(i,t.languages[r]))));self.close()},!1);return self.Prism}var r=document.getElementsByTagName("script");r=r[r.length-1];if(r){t.filename=r.src;document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)}return self.Prism}();typeof module!="undefined"&&module.exports&&(module.exports=Prism); \ No newline at end of file +self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{};var Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&").replace(/e.length)break e;if(!(d instanceof a)){g.lastIndex=0;var m=g.exec(d);if(m){c&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,k=y+v,b=d.slice(0,y+1),w=d.slice(k+1),O=[p,1];b&&O.push(b);var N=new a(l,u?t.tokenize(m,u):m,h);O.push(N),w&&O.push(w),Array.prototype.splice.apply(r,O)}}}}}return r},hooks:{all:{},add:function(e,n){var a=t.hooks.all;a[e]=a[e]||[],a[e].push(n)},run:function(e,n){var a=t.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(n)}}},n=t.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(n.stringify=function(e,a,r){if("string"==typeof e)return e;if("[object Array]"==Object.prototype.toString.call(e))return e.map(function(t){return n.stringify(t,a,e)}).join("");var i={type:e.type,content:n.stringify(e.content,a,r),tag:"span",classes:["token",e.type],attributes:{},language:a,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}t.hooks.run("wrap",i);var s="";for(var o in i.attributes)s+=o+'="'+(i.attributes[o]||"")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'" '+s+">"+i.content+""},!self.document)return self.addEventListener?(self.addEventListener("message",function(e){var n=JSON.parse(e.data),a=n.language,r=n.code;self.postMessage(JSON.stringify(t.util.encode(t.tokenize(r,t.languages[a])))),self.close()},!1),self.Prism):self.Prism;var a=document.getElementsByTagName("script");return a=a[a.length-1],a&&(t.filename=a.src,document.addEventListener&&!a.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)),self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism); \ No newline at end of file diff --git a/components/prism-git.min.js b/components/prism-git.min.js index 7ba2782e89..45570deedf 100644 --- a/components/prism-git.min.js +++ b/components/prism-git.min.js @@ -1 +1 @@ -Prism.languages.git={comment:/^#.*$/m,string:/("|')(\\?.)*?\1/gm,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s(--|-)\w+/m}},coord:/^@@.*@@$/m,deleted:/^-(?!-).+$/m,inserted:/^\+(?!\+).+$/m,commit_sha1:/^commit \w{40}$/m} +Prism.languages.git={comment:/^#.*$/m,string:/("|')(\\?.)*?\1/gm,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s(--|-)\w+/m}},coord:/^@@.*@@$/m,deleted:/^-(?!-).+$/m,inserted:/^\+(?!\+).+$/m,commit_sha1:/^commit \w{40}$/m}; \ No newline at end of file diff --git a/components/prism-haml.min.js b/components/prism-haml.min.js index 02e4a76a40..9af046e489 100644 --- a/components/prism-haml.min.js +++ b/components/prism-haml.min.js @@ -1 +1 @@ -!function(a){a.languages.haml={"multiline-comment":[{pattern:/((?:^|\n)([\t ]*))\/.*(\n\2[\t ]+.+)*/,lookbehind:!0,alias:"comment"},{pattern:/((?:^|\n)([\t ]*))-#.*(\n\2[\t ]+.+)*/,lookbehind:!0,alias:"comment"}],"multiline-code":[{pattern:/((?:^|\n)([\t ]*)(?:[~-]|[&!]?=)).*,[\t ]*(\n\2[\t ]+.*,[\t ]*)*(\n\2[\t ]+.+)/,lookbehind:!0,inside:{rest:a.languages.ruby}},{pattern:/((?:^|\n)([\t ]*)(?:[~-]|[&!]?=)).*\|[\t ]*(\n\2[\t ]+.*\|[\t ]*)*/,lookbehind:!0,inside:{rest:a.languages.ruby}}],filter:{pattern:/((?:^|\n)([\t ]*)):[\w-]+(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"}}},markup:{pattern:/((?:^|\n)[\t ]*)<.+/,lookbehind:!0,inside:{rest:a.languages.markup}},doctype:{pattern:/((?:^|\n)[\t ]*)!!!(?: .+)?/,lookbehind:!0},tag:{pattern:/((?:^|\n)[\t ]*)[%.#][\w\-#.]*[\w\-](?:\([^)]+\)|\{(?:\{[^}]+\}|[^}])+\}|\[[^\]]+\])*[\/<>]*/,lookbehind:!0,inside:{attributes:[{pattern:/(^|[^#])\{(?:\{[^}]+\}|[^}])+\}/,lookbehind:!0,inside:{rest:a.languages.ruby}},{pattern:/\([^)]+\)/,inside:{"attr-value":{pattern:/(=\s*)(?:"(?:\\?.)*?"|[^)\s]+)/,lookbehind:!0},"attr-name":/[\w:-]+(?=\s*!?=|\s*[,)])/,punctuation:/[=(),]/}},{pattern:/\[[^\]]+\]/,inside:{rest:a.languages.ruby}}],punctuation:/[<>]/}},code:{pattern:/((?:^|\n)[\t ]*(?:[~-]|[&!]?=)).+/,lookbehind:!0,inside:{rest:a.languages.ruby}},interpolation:{pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"},rest:a.languages.ruby}},punctuation:{pattern:/((?:^|\n)[\t ]*)[~=\-&!]/,lookbehind:!0}};for(var b="((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+",c=["css",{filter:"coffee",language:"coffeescript"},"erb","javascript","less","markdown","ruby","scss","textile"],d={},e=0,f=c.length;f>e;e++){var g=c[e];g="filter"in g?g:{filter:g,language:g},a.languages[g.language]&&(d["filter-"+g.filter]={pattern:RegExp(b.replace("{{filter_name}}",g.filter)),lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"},rest:a.languages[g.language]}})}a.languages.insertBefore("haml","filter",d)}(Prism); \ No newline at end of file +!function(e){e.languages.haml={"multiline-comment":[{pattern:/((?:^|\n)([\t ]*))\/.*(\n\2[\t ]+.+)*/,lookbehind:!0,alias:"comment"},{pattern:/((?:^|\n)([\t ]*))-#.*(\n\2[\t ]+.+)*/,lookbehind:!0,alias:"comment"}],"multiline-code":[{pattern:/((?:^|\n)([\t ]*)(?:[~-]|[&!]?=)).*,[\t ]*(\n\2[\t ]+.*,[\t ]*)*(\n\2[\t ]+.+)/,lookbehind:!0,inside:{rest:e.languages.ruby}},{pattern:/((?:^|\n)([\t ]*)(?:[~-]|[&!]?=)).*\|[\t ]*(\n\2[\t ]+.*\|[\t ]*)*/,lookbehind:!0,inside:{rest:e.languages.ruby}}],filter:{pattern:/((?:^|\n)([\t ]*)):[\w-]+(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"}}},markup:{pattern:/((?:^|\n)[\t ]*)<.+/,lookbehind:!0,inside:{rest:e.languages.markup}},doctype:{pattern:/((?:^|\n)[\t ]*)!!!(?: .+)?/,lookbehind:!0},tag:{pattern:/((?:^|\n)[\t ]*)[%.#][\w\-#.]*[\w\-](?:\([^)]+\)|\{(?:\{[^}]+\}|[^}])+\}|\[[^\]]+\])*[\/<>]*/,lookbehind:!0,inside:{attributes:[{pattern:/(^|[^#])\{(?:\{[^}]+\}|[^}])+\}/,lookbehind:!0,inside:{rest:e.languages.ruby}},{pattern:/\([^)]+\)/,inside:{"attr-value":{pattern:/(=\s*)(?:"(?:\\?.)*?"|[^)\s]+)/,lookbehind:!0},"attr-name":/[\w:-]+(?=\s*!?=|\s*[,)])/,punctuation:/[=(),]/}},{pattern:/\[[^\]]+\]/,inside:{rest:e.languages.ruby}}],punctuation:/[<>]/}},code:{pattern:/((?:^|\n)[\t ]*(?:[~-]|[&!]?=)).+/,lookbehind:!0,inside:{rest:e.languages.ruby}},interpolation:{pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"},rest:e.languages.ruby}},punctuation:{pattern:/((?:^|\n)[\t ]*)[~=\-&!]/,lookbehind:!0}};for(var t="((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+",n=["css",{filter:"coffee",language:"coffeescript"},"erb","javascript","less","markdown","ruby","scss","textile"],a={},i=0,r=n.length;r>i;i++){var l=n[i];l="string"==typeof l?{filter:l,language:l}:l,e.languages[l.language]&&(a["filter-"+l.filter]={pattern:RegExp(t.replace("{{filter_name}}",l.filter)),lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"},rest:e.languages[l.language]}})}e.languages.insertBefore("haml","filter",a)}(Prism); \ No newline at end of file diff --git a/components/prism-handlebars.min.js b/components/prism-handlebars.min.js index 206d085c4a..3ec93edc14 100644 --- a/components/prism-handlebars.min.js +++ b/components/prism-handlebars.min.js @@ -1 +1 @@ -Prism.languages.handlebars={expression:{pattern:/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g,inside:{comment:{pattern:/(\{\{)![\w\W]*(?=\}\})/g,lookbehind:!0},delimiter:{pattern:/\{\{\{?|\}\}\}?/gi,alias:"punctuation"},block:{pattern:/^(\s*~?\s*)[#\/]\w+/gi,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/g,variable:/[\w\W]+/g}},string:/(["'])(\\?.)+?\1/g,punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g}}},Prism.languages.markup&&(Prism.hooks.add("before-highlight",function(a){console.log(a.language),"handlebars"===a.language&&(a.tokenStack=[],a.backupCode=a.code,a.code=a.code.replace(/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/gi,function(b){return console.log(b),a.tokenStack.push(b),"___HANDLEBARS"+a.tokenStack.length+"___"}))}),Prism.hooks.add("before-insert",function(a){"handlebars"===a.language&&(a.code=a.backupCode,delete a.backupCode)}),Prism.hooks.add("after-highlight",function(a){if("handlebars"===a.language){for(var c,b=0;c=a.tokenStack[b];b++)a.highlightedCode=a.highlightedCode.replace("___HANDLEBARS"+(b+1)+"___",Prism.highlight(c,a.grammar,"handlebars"));a.element.innerHTML=a.highlightedCode}}),Prism.hooks.add("wrap",function(a){"handlebars"===a.language&&"markup"===a.type&&(a.content=a.content.replace(/(___HANDLEBARS[0-9]+___)/g,'$1'))}),Prism.languages.insertBefore("handlebars","expression",{markup:{pattern:/<[^?]\/?(.*?)>/g,inside:Prism.languages.markup},handlebars:/___HANDLEBARS[0-9]+___/g})); \ No newline at end of file +Prism.languages.handlebars={expression:{pattern:/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g,inside:{comment:{pattern:/(\{\{)![\w\W]*(?=\}\})/g,lookbehind:!0},delimiter:{pattern:/^\{\{\{?|\}\}\}?$/gi,alias:"punctuation"},string:/(["'])(\\?.)+?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,"boolean":/\b(true|false)\b/g,block:{pattern:/^(\s*~?\s*)[#\/]\w+/gi,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/g,variable:/[\w\W]+/g}},punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g}}},Prism.languages.markup&&(Prism.hooks.add("before-highlight",function(e){console.log(e.language),"handlebars"===e.language&&(e.tokenStack=[],e.backupCode=e.code,e.code=e.code.replace(/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/gi,function(a){return console.log(a),e.tokenStack.push(a),"___HANDLEBARS"+e.tokenStack.length+"___"}))}),Prism.hooks.add("before-insert",function(e){"handlebars"===e.language&&(e.code=e.backupCode,delete e.backupCode)}),Prism.hooks.add("after-highlight",function(e){if("handlebars"===e.language){for(var a,n=0;a=e.tokenStack[n];n++)e.highlightedCode=e.highlightedCode.replace("___HANDLEBARS"+(n+1)+"___",Prism.highlight(a,e.grammar,"handlebars"));e.element.innerHTML=e.highlightedCode}}),Prism.hooks.add("wrap",function(e){"handlebars"===e.language&&"markup"===e.type&&(e.content=e.content.replace(/(___HANDLEBARS[0-9]+___)/g,'$1'))}),Prism.languages.insertBefore("handlebars","expression",{markup:{pattern:/<[^?]\/?(.*?)>/g,inside:Prism.languages.markup},handlebars:/___HANDLEBARS[0-9]+___/g})); \ No newline at end of file diff --git a/components/prism-http.min.js b/components/prism-http.min.js index 916c049b8e..f6de48fc48 100644 --- a/components/prism-http.min.js +++ b/components/prism-http.min.js @@ -1 +1 @@ -Prism.languages.http={"request-line":{pattern:/^(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b\shttps?:\/\/\S+\sHTTP\/[0-9.]+/g,inside:{property:/^\b(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b/g,"attr-name":/:\w+/g}},"response-status":{pattern:/^HTTP\/1.[01] [0-9]+.*/g,inside:{property:/[0-9]+[A-Z\s-]+$/ig}},keyword:/^[\w-]+:(?=.+)/gm};var httpLanguages={"application/json":Prism.languages.javascript,"application/xml":Prism.languages.markup,"text/xml":Prism.languages.markup,"text/html":Prism.languages.markup};for(var contentType in httpLanguages)if(httpLanguages[contentType]){var options={};options[contentType]={pattern:new RegExp("(content-type:\\s*"+contentType+"[\\w\\W]*?)\\n\\n[\\w\\W]*","gi"),lookbehind:!0,inside:{rest:httpLanguages[contentType]}};Prism.languages.insertBefore("http","keyword",options)}; \ No newline at end of file +Prism.languages.http={"request-line":{pattern:/^(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b\shttps?:\/\/\S+\sHTTP\/[0-9.]+/g,inside:{property:/^\b(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b/g,"attr-name":/:\w+/g}},"response-status":{pattern:/^HTTP\/1.[01] [0-9]+.*/g,inside:{property:/[0-9]+[A-Z\s-]+$/gi}},keyword:/^[\w-]+:(?=.+)/gm};var httpLanguages={"application/json":Prism.languages.javascript,"application/xml":Prism.languages.markup,"text/xml":Prism.languages.markup,"text/html":Prism.languages.markup};for(var contentType in httpLanguages)if(httpLanguages[contentType]){var options={};options[contentType]={pattern:new RegExp("(content-type:\\s*"+contentType+"[\\w\\W]*?)\\n\\n[\\w\\W]*","gi"),lookbehind:!0,inside:{rest:httpLanguages[contentType]}},Prism.languages.insertBefore("http","keyword",options)} \ No newline at end of file diff --git a/components/prism-jade.min.js b/components/prism-jade.min.js index 5d3c8095a9..a2bbbfa3f6 100644 --- a/components/prism-jade.min.js +++ b/components/prism-jade.min.js @@ -1 +1 @@ -!function(a){a.languages.jade={"multiline-comment":{pattern:/((?:^|\n)([\t ]*))\/\/.*(\n\2[\t ]+.+)*/,lookbehind:!0,alias:"comment"},"multiline-script":{pattern:/((?:^|\n)([\t ]*)script\b.*\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{rest:a.languages.javascript}},filter:{pattern:/((?:^|\n)([\t ]*)):.+(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"}}},"multiline-plain-text":{pattern:/((?:^|\n)([\t ]*)[\w\-#.]+\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0},markup:{pattern:/((?:^|\n)[\t ]*)<.+/,lookbehind:!0,inside:{rest:a.languages.markup}},comment:{pattern:/((?:^|\n)[\t ]*)\/\/.+/,lookbehind:!0},doctype:{pattern:/((?:^|\n)[\t ]*)doctype(?: .+)?/,lookbehind:!0},"flow-control":{pattern:/((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|each|while)(?: .+)?/,lookbehind:!0,inside:{each:{pattern:/((?:^|\n)[\t ]*)each .+? in\b/,lookbehind:!0,inside:{keyword:/\b(?:each|in)\b/,punctuation:/,/}},branch:{pattern:/((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|while)/,lookbehind:!0,alias:"keyword"},rest:a.languages.javascript}},keyword:{pattern:/((?:^|\n)[\t ]*)(?:block|extends|include|append|prepend)\b.+/,lookbehind:!0},mixin:[{pattern:/((?:^|\n)[\t ]*)mixin .+/,lookbehind:!0,inside:{keyword:/^mixin/,"function":/\w+(?=\s*\(|\s*$)/,punctuation:/[(),.]/}},{pattern:/((?:^|\n)[\t ]*)\+.+/,lookbehind:!0,inside:{name:{pattern:/^\+\w+/,alias:"function"},rest:a.languages.javascript}}],script:{pattern:/((?:^|\n)[\t ]*script(?:(?:&[^(]+)?\([^)]+\))*) .+/,lookbehind:!0,inside:{rest:a.languages.javascript}},"plain-text":{pattern:/((?:^|\n)[\t ]*(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?[\t ]+).+/,lookbehind:!0},tag:{pattern:/((?:^|\n)[\t ]*)(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?:?/,lookbehind:!0,inside:{attributes:[{pattern:/&[^(]+\([^)]+\)/,inside:{rest:a.languages.javascript}},{pattern:/\([^)]+\)/,inside:{"attr-value":{pattern:/(=\s*)(?:\{[^}]*\}|[^,)\n]+)/,lookbehind:!0,inside:{rest:a.languages.javascript}},"attr-name":/[\w-]+(?=\s*!?=|\s*[,)])/,punctuation:/[!=(),]/}}],punctuation:/[:]/}},code:[{pattern:/((?:^|\n)[\t ]*(?:-|!?=)).+/,lookbehind:!0,inside:{rest:a.languages.javascript}}],punctuation:/[.\-!=|]/};for(var b="((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+",c=[{filter:"atpl",language:"twig"},{filter:"coffee",language:"coffeescript"},"ejs","handlebars","hogan","less","livescript","markdown","mustache","plates",{filter:"sass",language:"scss"},"stylus","swig"],d={},e=0,f=c.length;f>e;e++){var g=c[e];g="string"==typeof g?{filter:g,language:g}:g,a.languages[g.language]&&(d["filter-"+g.filter]={pattern:RegExp(b.replace("{{filter_name}}",g.filter)),lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"},rest:a.languages[g.language]}})}a.languages.insertBefore("jade","filter",d)}(Prism); \ No newline at end of file +!function(e){e.languages.jade={"multiline-comment":{pattern:/((?:^|\n)([\t ]*))\/\/.*(\n\2[\t ]+.+)*/,lookbehind:!0,alias:"comment"},"multiline-script":{pattern:/((?:^|\n)([\t ]*)script\b.*\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{rest:e.languages.javascript}},filter:{pattern:/((?:^|\n)([\t ]*)):.+(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"}}},"multiline-plain-text":{pattern:/((?:^|\n)([\t ]*)[\w\-#.]+\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0},markup:{pattern:/((?:^|\n)[\t ]*)<.+/,lookbehind:!0,inside:{rest:e.languages.markup}},comment:{pattern:/((?:^|\n)[\t ]*)\/\/.+/,lookbehind:!0},doctype:{pattern:/((?:^|\n)[\t ]*)doctype(?: .+)?/,lookbehind:!0},"flow-control":{pattern:/((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|each|while)(?: .+)?/,lookbehind:!0,inside:{each:{pattern:/((?:^|\n)[\t ]*)each .+? in\b/,lookbehind:!0,inside:{keyword:/\b(?:each|in)\b/,punctuation:/,/}},branch:{pattern:/((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|while)/,lookbehind:!0,alias:"keyword"},rest:e.languages.javascript}},keyword:{pattern:/((?:^|\n)[\t ]*)(?:block|extends|include|append|prepend)\b.+/,lookbehind:!0},mixin:[{pattern:/((?:^|\n)[\t ]*)mixin .+/,lookbehind:!0,inside:{keyword:/^mixin/,"function":/\w+(?=\s*\(|\s*$)/,punctuation:/[(),.]/}},{pattern:/((?:^|\n)[\t ]*)\+.+/,lookbehind:!0,inside:{name:{pattern:/^\+\w+/,alias:"function"},rest:e.languages.javascript}}],script:{pattern:/((?:^|\n)[\t ]*script(?:(?:&[^(]+)?\([^)]+\))*) .+/,lookbehind:!0,inside:{rest:e.languages.javascript}},"plain-text":{pattern:/((?:^|\n)[\t ]*(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?[\t ]+).+/,lookbehind:!0},tag:{pattern:/((?:^|\n)[\t ]*)(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?:?/,lookbehind:!0,inside:{attributes:[{pattern:/&[^(]+\([^)]+\)/,inside:{rest:e.languages.javascript}},{pattern:/\([^)]+\)/,inside:{"attr-value":{pattern:/(=\s*)(?:\{[^}]*\}|[^,)\n]+)/,lookbehind:!0,inside:{rest:e.languages.javascript}},"attr-name":/[\w-]+(?=\s*!?=|\s*[,)])/,punctuation:/[!=(),]/}}],punctuation:/[:]/}},code:[{pattern:/((?:^|\n)[\t ]*(?:-|!?=)).+/,lookbehind:!0,inside:{rest:e.languages.javascript}}],punctuation:/[.\-!=|]/};for(var t="((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+",n=[{filter:"atpl",language:"twig"},{filter:"coffee",language:"coffeescript"},"ejs","handlebars","hogan","less","livescript","markdown","mustache","plates",{filter:"sass",language:"scss"},"stylus","swig"],a={},i=0,s=n.length;s>i;i++){var l=n[i];l="string"==typeof l?{filter:l,language:l}:l,e.languages[l.language]&&(a["filter-"+l.filter]={pattern:RegExp(t.replace("{{filter_name}}",l.filter)),lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"},rest:e.languages[l.language]}})}e.languages.insertBefore("jade","filter",a)}(Prism); \ No newline at end of file diff --git a/components/prism-nasm.min.js b/components/prism-nasm.min.js index 66dcf2462d..6ad6587b58 100644 --- a/components/prism-nasm.min.js +++ b/components/prism-nasm.min.js @@ -1 +1 @@ -Prism.languages.nasm={comment:/;.*$/m,string:/("|'|`)(\\?.)*?\1/gm,label:{pattern:/^\s*[A-Za-z\._\?\$][\w\.\?\$@~#]*:/m,alias:"function"},keyword:[/\[?BITS (16|32|64)\]?/m,/^\s*section\s*[a-zA-Z\.]+:?/im,/(?:extern|global)[^;]*/im,/(?:CPU|FLOAT|DEFAULT).*$/m,],register:{pattern:/\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(bp|sp|si|di)|[cdefgs]s)\b/gi,alias:"variable"},number:/(\b|-|(?=\$))(0[hHxX][\dA-Fa-f]*\.?[\dA-Fa-f]+([pP][+-]?\d+)?|\d[\dA-Fa-f]+[hHxX]|\$\d[\dA-Fa-f]*|0[oOqQ][0-7]+|[0-7]+[oOqQ]|0[bByY][01]+|[01]+[bByY]|0[dDtT]\d+|\d+[dDtT]?|\d*\.?\d+([Ee][+-]?\d+)?)\b/g,operator:/[\[\]\*+\-\/%<>=&|\$!]/gm}; +Prism.languages.nasm={comment:/;.*$/m,string:/("|'|`)(\\?.)*?\1/gm,label:{pattern:/^\s*[A-Za-z\._\?\$][\w\.\?\$@~#]*:/m,alias:"function"},keyword:[/\[?BITS (16|32|64)\]?/m,/^\s*section\s*[a-zA-Z\.]+:?/im,/(?:extern|global)[^;]*/im,/(?:CPU|FLOAT|DEFAULT).*$/m],register:{pattern:/\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(bp|sp|si|di)|[cdefgs]s)\b/gi,alias:"variable"},number:/(\b|-|(?=\$))(0[hHxX][\dA-Fa-f]*\.?[\dA-Fa-f]+([pP][+-]?\d+)?|\d[\dA-Fa-f]+[hHxX]|\$\d[\dA-Fa-f]*|0[oOqQ][0-7]+|[0-7]+[oOqQ]|0[bByY][01]+|[01]+[bByY]|0[dDtT]\d+|\d+[dDtT]?|\d*\.?\d+([Ee][+-]?\d+)?)\b/g,operator:/[\[\]\*+\-\/%<>=&|\$!]/gm}; \ No newline at end of file diff --git a/components/prism-nsis.min.js b/components/prism-nsis.min.js index e38bcb131d..c9d5555c8e 100644 --- a/components/prism-nsis.min.js +++ b/components/prism-nsis.min.js @@ -1,5 +1 @@ -/** - * Original by Jan T. Sott (http://github.com/idleberg) - * - * Includes all commands and plug-ins shipped with NSIS 3.0a2 - */Prism.languages.nsis={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])(#|;).*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,keyword:/\b(Abort|Add(BrandingImage|Size)|AdvSplash|Allow(RootDirInstall|SkipFiles)|AutoCloseWindow|Banner|BG(Font|Gradient|Image)|BrandingText|BringToFront|Call(\b|InstDLL)|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|Create(Directory|Font|ShortCut)|Delete(\b|INISec|INIStr|RegKey|RegValue)|Detail(Print|sButtonText)|Dialer|Dir(Text|Var|Verify)|EnableWindow|Enum(RegKey|RegValue)|Exch|Exec(\b|Shell|Wait)|ExpandEnvStrings|File(\b|BufSize|Close|ErrorText|Open|Read|ReadByte|ReadUTF16LE|ReadWord|WriteUTF16LE|Seek|Write|WriteByte|WriteWord)|Find(Close|First|Next|Window)|FlushINI|Get(CurInstType|CurrentAddress|DlgItem|DLLVersion|DLLVersionLocal|ErrorLevel|FileTime|FileTimeLocal|FullPathName|Function(\b|Address|End)|InstDirError|LabelAddress|TempFileName)|Goto|HideWindow|Icon|If(Abort|Errors|FileExists|RebootFlag|Silent)|InitPluginsDir|Install(ButtonText|Colors|Dir|DirRegKey)|InstProgressFlags|Inst(Type|TypeGetText|TypeSetText)|Int(Cmp|CmpU|Fmt|Op)|IsWindow|Lang(DLL|String)|License(BkColor|Data|ForceSelection|LangString|Text)|LoadLanguageFile|LockWindow|Log(Set|Text)|Manifest(DPIAware|SupportedOS)|Math|MessageBox|MiscButtonText|Name|Nop|ns(Dialogs|Exec)|NSISdl|OutFile|Page(\b|Callbacks)|Pop|Push|Quit|Read(EnvStr|INIStr|RegDWORD|RegStr)|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|Section(\b|End|GetFlags|GetInstTypes|GetSize|GetText|Group|In|SetFlags|SetInstTypes|SetSize|SetText)|SendMessage|Set(AutoClose|BrandingImage|Compress|Compressor|CompressorDictSize|CtlColors|CurInstType|DatablockOptimize|DateSave|DetailsPrint|DetailsView|ErrorLevel|Errors|FileAttributes|Font|OutPath|Overwrite|PluginUnload|RebootFlag|RegView|ShellVarContext|Silent)|Show(InstDetails|UninstDetails|Window)|Silent(Install|UnInstall)|Sleep|SpaceTexts|Splash|StartMenu|Str(Cmp|CmpS|Cpy|Len)|SubCaption|System|Unicode|Uninstall(ButtonText|Caption|Icon|SubCaption|Text)|UninstPage|UnRegDLL|UserInfo|Var|VI(AddVersionKey|FileVersion|ProductVersion)|VPatch|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|Write(RegStr|Uninstaller)|XPStyle)\b/g,property:/\b(admin|all|auto|both|colored|false|force|hide|highest|lastused|leave|listonly|none|normal|notset|off|on|open|print|show|silent|silentlog|smooth|textonly|true|user|ARCHIVE|FILE_(ATTRIBUTE_ARCHIVE|ATTRIBUTE_NORMAL|ATTRIBUTE_OFFLINE|ATTRIBUTE_READONLY|ATTRIBUTE_SYSTEM|ATTRIBUTE_TEMPORARY)|HK(CR|CU|DD|LM|PD|U)|HKEY_(CLASSES_ROOT|CURRENT_CONFIG|CURRENT_USER|DYN_DATA|LOCAL_MACHINE|PERFORMANCE_DATA|USERS)|ID(ABORT|CANCEL|IGNORE|NO|OK|RETRY|YES)|MB_(ABORTRETRYIGNORE|DEFBUTTON1|DEFBUTTON2|DEFBUTTON3|DEFBUTTON4|ICONEXCLAMATION|ICONINFORMATION|ICONQUESTION|ICONSTOP|OK|OKCANCEL|RETRYCANCEL|RIGHT|RTLREADING|SETFOREGROUND|TOPMOST|USERICON|YESNO)|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SYSTEM|TEMPORARY)\b/g,variable:/(\$(\(|\{)?[-_\w]+)(\)|\})?/i,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|<=?|>=?|={1,3}|(&){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,punctuation:/[{}[\];(),.:]/g,important:/\!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|else|endif|error|execute|finalize|getdllversionsystem|ifdef|ifmacrodef|ifmacrondef|ifndef|if|include|insertmacro|macroend|macro|makensis|packhdr|searchparse|searchreplace|tempfile|undef|verbose|warning)\b/gi}; \ No newline at end of file +Prism.languages.nsis={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])(#|;).*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,keyword:/\b(Abort|Add(BrandingImage|Size)|AdvSplash|Allow(RootDirInstall|SkipFiles)|AutoCloseWindow|Banner|BG(Font|Gradient|Image)|BrandingText|BringToFront|Call(\b|InstDLL)|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|Create(Directory|Font|ShortCut)|Delete(\b|INISec|INIStr|RegKey|RegValue)|Detail(Print|sButtonText)|Dialer|Dir(Text|Var|Verify)|EnableWindow|Enum(RegKey|RegValue)|Exch|Exec(\b|Shell|Wait)|ExpandEnvStrings|File(\b|BufSize|Close|ErrorText|Open|Read|ReadByte|ReadUTF16LE|ReadWord|WriteUTF16LE|Seek|Write|WriteByte|WriteWord)|Find(Close|First|Next|Window)|FlushINI|Get(CurInstType|CurrentAddress|DlgItem|DLLVersion|DLLVersionLocal|ErrorLevel|FileTime|FileTimeLocal|FullPathName|Function(\b|Address|End)|InstDirError|LabelAddress|TempFileName)|Goto|HideWindow|Icon|If(Abort|Errors|FileExists|RebootFlag|Silent)|InitPluginsDir|Install(ButtonText|Colors|Dir|DirRegKey)|InstProgressFlags|Inst(Type|TypeGetText|TypeSetText)|Int(Cmp|CmpU|Fmt|Op)|IsWindow|Lang(DLL|String)|License(BkColor|Data|ForceSelection|LangString|Text)|LoadLanguageFile|LockWindow|Log(Set|Text)|Manifest(DPIAware|SupportedOS)|Math|MessageBox|MiscButtonText|Name|Nop|ns(Dialogs|Exec)|NSISdl|OutFile|Page(\b|Callbacks)|Pop|Push|Quit|Read(EnvStr|INIStr|RegDWORD|RegStr)|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|Section(\b|End|GetFlags|GetInstTypes|GetSize|GetText|Group|In|SetFlags|SetInstTypes|SetSize|SetText)|SendMessage|Set(AutoClose|BrandingImage|Compress|Compressor|CompressorDictSize|CtlColors|CurInstType|DatablockOptimize|DateSave|DetailsPrint|DetailsView|ErrorLevel|Errors|FileAttributes|Font|OutPath|Overwrite|PluginUnload|RebootFlag|RegView|ShellVarContext|Silent)|Show(InstDetails|UninstDetails|Window)|Silent(Install|UnInstall)|Sleep|SpaceTexts|Splash|StartMenu|Str(Cmp|CmpS|Cpy|Len)|SubCaption|System|Unicode|Uninstall(ButtonText|Caption|Icon|SubCaption|Text)|UninstPage|UnRegDLL|UserInfo|Var|VI(AddVersionKey|FileVersion|ProductVersion)|VPatch|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|Write(RegStr|Uninstaller)|XPStyle)\b/g,property:/\b(admin|all|auto|both|colored|false|force|hide|highest|lastused|leave|listonly|none|normal|notset|off|on|open|print|show|silent|silentlog|smooth|textonly|true|user|ARCHIVE|FILE_(ATTRIBUTE_ARCHIVE|ATTRIBUTE_NORMAL|ATTRIBUTE_OFFLINE|ATTRIBUTE_READONLY|ATTRIBUTE_SYSTEM|ATTRIBUTE_TEMPORARY)|HK(CR|CU|DD|LM|PD|U)|HKEY_(CLASSES_ROOT|CURRENT_CONFIG|CURRENT_USER|DYN_DATA|LOCAL_MACHINE|PERFORMANCE_DATA|USERS)|ID(ABORT|CANCEL|IGNORE|NO|OK|RETRY|YES)|MB_(ABORTRETRYIGNORE|DEFBUTTON1|DEFBUTTON2|DEFBUTTON3|DEFBUTTON4|ICONEXCLAMATION|ICONINFORMATION|ICONQUESTION|ICONSTOP|OK|OKCANCEL|RETRYCANCEL|RIGHT|RTLREADING|SETFOREGROUND|TOPMOST|USERICON|YESNO)|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SYSTEM|TEMPORARY)\b/g,variable:/(\$(\(|\{)?[-_\w]+)(\)|\})?/i,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|<=?|>=?|={1,3}|(&){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,punctuation:/[{}[\];(),.:]/g,important:/\!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|else|endif|error|execute|finalize|getdllversionsystem|ifdef|ifmacrodef|ifmacrondef|ifndef|if|include|insertmacro|macroend|macro|makensis|packhdr|searchparse|searchreplace|tempfile|undef|verbose|warning)\b/gi}; \ No newline at end of file diff --git a/components/prism-scheme.min.js b/components/prism-scheme.min.js index d9ed781a62..bb8717740a 100644 --- a/components/prism-scheme.min.js +++ b/components/prism-scheme.min.js @@ -1 +1 @@ -Prism.languages.scheme={"boolean":/#(t|f){1}/,comment:/;.*/,keyword:{pattern:/([(])(define(-syntax|-library|-values)?|(case-)?lambda|let(-values|(rec)?(\*)?)?|else|if|cond|begin|delay|delay-force|parameterize|guard|set!|(quasi-)?quote|syntax-rules)/,lookbehind:true},builtin:{pattern:/([(])(cons|car|cdr|null\?|pair\?|boolean\?|eof-object\?|char\?|procedure\?|number\?|port\?|string\?|vector\?|symbol\?|bytevector\?|list|call-with-current-continuation|call\/cc|append|abs|apply|eval)\b/,lookbehind:true},string:/(["])(?:(?=(\\?))\2.)*?\1|'[^('|\s)]+/,number:/(\s|\))[-+]?[0-9]*\.?[0-9]+((\s*)[-+]{1}(\s*)[0-9]*\.?[0-9]+i)?/,operator:/(\*|\+|\-|\%|\/|<=|=>|>=|<|=|>)/,"function":{pattern:/([(])[^(\s|\))]*\s/,lookbehind:true},punctuation:/[()]/} +Prism.languages.scheme={"boolean":/#(t|f){1}/,comment:/;.*/,keyword:{pattern:/([(])(define(-syntax|-library|-values)?|(case-)?lambda|let(-values|(rec)?(\*)?)?|else|if|cond|begin|delay|delay-force|parameterize|guard|set!|(quasi-)?quote|syntax-rules)/,lookbehind:!0},builtin:{pattern:/([(])(cons|car|cdr|null\?|pair\?|boolean\?|eof-object\?|char\?|procedure\?|number\?|port\?|string\?|vector\?|symbol\?|bytevector\?|list|call-with-current-continuation|call\/cc|append|abs|apply|eval)\b/,lookbehind:!0},string:/(["])(?:(?=(\\?))\2.)*?\1|'[^('|\s)]+/,number:/(\s|\))[-+]?[0-9]*\.?[0-9]+((\s*)[-+]{1}(\s*)[0-9]*\.?[0-9]+i)?/,operator:/(\*|\+|\-|\%|\/|<=|=>|>=|<|=|>)/,"function":{pattern:/([(])[^(\s|\))]*\s/,lookbehind:!0},punctuation:/[()]/}; \ No newline at end of file diff --git a/components/prism-sql.min.js b/components/prism-sql.min.js index bdf2cbc5f1..12f7d07f3a 100644 --- a/components/prism-sql.min.js +++ b/components/prism-sql.min.js @@ -1 +1 @@ -Prism.languages.sql={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|((--)|(\/\/)|#).*?(\r?\n|$))/g,lookbehind:!0},string:{pattern:/(^|[^@])("|')(\\?[\s\S])*?\2/g,lookbehind:!0},variable:/@[\w.$]+|@("|'|`)(\\?[\s\S])+?\1/g,"function":/\b(?:COUNT|SUM|AVG|MIN|MAX|FIRST|LAST|UCASE|LCASE|MID|LEN|ROUND|NOW|FORMAT)(?=\s*\()/ig,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALTER|ANALYZE|APPLY|AS|ASC|AUTHORIZATION|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADE|CASCADED|CASE|CHAIN|CHAR VARYING|CHARACTER VARYING|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLUMN|COLUMNS|COMMENT|COMMIT|COMMITTED|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|CURSOR|DATA|DATABASE|DATABASES|DATETIME|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DOUBLE PRECISION|DROP|DUMMY|DUMP|DUMPFILE|DUPLICATE KEY|ELSE|ENABLE|ENCLOSED BY|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPE|ESCAPED BY|EXCEPT|EXEC|EXECUTE|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR|FOR EACH ROW|FORCE|FOREIGN|FREETEXT|FREETEXTTABLE|FROM|FULL|FUNCTION|GEOMETRY|GEOMETRYCOLLECTION|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|IDENTITY|IDENTITY_INSERT|IDENTITYCOL|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTO|INVOKER|ISOLATION LEVEL|JOIN|KEY|KEYS|KILL|LANGUAGE SQL|LAST|LEFT|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONGBLOB|LONGTEXT|MATCH|MATCHED|MEDIUMBLOB|MEDIUMINT|MEDIUMTEXT|MERGE|MIDDLEINT|MODIFIES SQL DATA|MODIFY|MULTILINESTRING|MULTIPOINT|MULTIPOLYGON|NATIONAL|NATIONAL CHAR VARYING|NATIONAL CHARACTER|NATIONAL CHARACTER VARYING|NATIONAL VARCHAR|NATURAL|NCHAR|NCHAR VARCHAR|NEXT|NO|NO SQL|NOCHECK|NOCYCLE|NONCLUSTERED|NULLIF|NUMERIC|OF|OFF|OFFSETS|ON|OPEN|OPENDATASOURCE|OPENQUERY|OPENROWSET|OPTIMIZE|OPTION|OPTIONALLY|ORDER|OUT|OUTER|OUTFILE|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREV|PRIMARY|PRINT|PRIVILEGES|PROC|PROCEDURE|PUBLIC|PURGE|QUICK|RAISERROR|READ|READS SQL DATA|READTEXT|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEATABLE|REPLICATION|REQUIRE|RESTORE|RESTRICT|RETURN|RETURNS|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROWCOUNT|ROWGUIDCOL|ROWS?|RTREE|RULE|SAVE|SAVEPOINT|SCHEMA|SELECT|SERIAL|SERIALIZABLE|SESSION|SESSION_USER|SET|SETUSER|SHARE MODE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|START|STARTING BY|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLE|TABLES|TABLESPACE|TEMP(?:ORARY)?|TEMPTABLE|TERMINATED BY|TEXT|TEXTSIZE|THEN|TIMESTAMP|TINYBLOB|TINYINT|TINYTEXT|TO|TOP|TRAN|TRANSACTION|TRANSACTIONS|TRIGGER|TRUNCATE|TSEQUAL|TYPE|TYPES|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNPIVOT|UPDATE|UPDATETEXT|USAGE|USE|USER|USING|VALUE|VALUES|VARBINARY|VARCHAR|VARCHARACTER|VARYING|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH|WITH ROLLUP|WITHIN|WORK|WRITE|WRITETEXT)\b/gi,"boolean":/\b(?:TRUE|FALSE|NULL)\b/gi,number:/\b-?(0x)?\d*\.?[\da-f]+\b/g,operator:/\b(?:ALL|AND|ANY|BETWEEN|EXISTS|IN|LIKE|NOT|OR|IS|UNIQUE|CHARACTER SET|COLLATE|DIV|OFFSET|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b|[-+]{1}|!|[=<>]{1,2}|(&){1,2}|\|?\||\?|\*|\//gi,punctuation:/[;[\]()`,.]/g}; \ No newline at end of file +Prism.languages.sql={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|((--)|(\/\/)|#).*?(\r?\n|$))/g,lookbehind:!0},string:{pattern:/(^|[^@])("|')(\\?[\s\S])*?\2/g,lookbehind:!0},variable:/@[\w.$]+|@("|'|`)(\\?[\s\S])+?\1/g,"function":/\b(?:COUNT|SUM|AVG|MIN|MAX|FIRST|LAST|UCASE|LCASE|MID|LEN|ROUND|NOW|FORMAT)(?=\s*\()/gi,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALTER|ANALYZE|APPLY|AS|ASC|AUTHORIZATION|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADE|CASCADED|CASE|CHAIN|CHAR VARYING|CHARACTER VARYING|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLUMN|COLUMNS|COMMENT|COMMIT|COMMITTED|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|CURSOR|DATA|DATABASE|DATABASES|DATETIME|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DOUBLE PRECISION|DROP|DUMMY|DUMP|DUMPFILE|DUPLICATE KEY|ELSE|ENABLE|ENCLOSED BY|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPE|ESCAPED BY|EXCEPT|EXEC|EXECUTE|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR|FOR EACH ROW|FORCE|FOREIGN|FREETEXT|FREETEXTTABLE|FROM|FULL|FUNCTION|GEOMETRY|GEOMETRYCOLLECTION|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|IDENTITY|IDENTITY_INSERT|IDENTITYCOL|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTO|INVOKER|ISOLATION LEVEL|JOIN|KEY|KEYS|KILL|LANGUAGE SQL|LAST|LEFT|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONGBLOB|LONGTEXT|MATCH|MATCHED|MEDIUMBLOB|MEDIUMINT|MEDIUMTEXT|MERGE|MIDDLEINT|MODIFIES SQL DATA|MODIFY|MULTILINESTRING|MULTIPOINT|MULTIPOLYGON|NATIONAL|NATIONAL CHAR VARYING|NATIONAL CHARACTER|NATIONAL CHARACTER VARYING|NATIONAL VARCHAR|NATURAL|NCHAR|NCHAR VARCHAR|NEXT|NO|NO SQL|NOCHECK|NOCYCLE|NONCLUSTERED|NULLIF|NUMERIC|OF|OFF|OFFSETS|ON|OPEN|OPENDATASOURCE|OPENQUERY|OPENROWSET|OPTIMIZE|OPTION|OPTIONALLY|ORDER|OUT|OUTER|OUTFILE|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREV|PRIMARY|PRINT|PRIVILEGES|PROC|PROCEDURE|PUBLIC|PURGE|QUICK|RAISERROR|READ|READS SQL DATA|READTEXT|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEATABLE|REPLICATION|REQUIRE|RESTORE|RESTRICT|RETURN|RETURNS|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROWCOUNT|ROWGUIDCOL|ROWS?|RTREE|RULE|SAVE|SAVEPOINT|SCHEMA|SELECT|SERIAL|SERIALIZABLE|SESSION|SESSION_USER|SET|SETUSER|SHARE MODE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|START|STARTING BY|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLE|TABLES|TABLESPACE|TEMP(?:ORARY)?|TEMPTABLE|TERMINATED BY|TEXT|TEXTSIZE|THEN|TIMESTAMP|TINYBLOB|TINYINT|TINYTEXT|TO|TOP|TRAN|TRANSACTION|TRANSACTIONS|TRIGGER|TRUNCATE|TSEQUAL|TYPE|TYPES|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNPIVOT|UPDATE|UPDATETEXT|USAGE|USE|USER|USING|VALUE|VALUES|VARBINARY|VARCHAR|VARCHARACTER|VARYING|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH|WITH ROLLUP|WITHIN|WORK|WRITE|WRITETEXT)\b/gi,"boolean":/\b(?:TRUE|FALSE|NULL)\b/gi,number:/\b-?(0x)?\d*\.?[\da-f]+\b/g,operator:/\b(?:ALL|AND|ANY|BETWEEN|EXISTS|IN|LIKE|NOT|OR|IS|UNIQUE|CHARACTER SET|COLLATE|DIV|OFFSET|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b|[-+]{1}|!|[=<>]{1,2}|(&){1,2}|\|?\||\?|\*|\//gi,punctuation:/[;[\]()`,.]/g}; \ No newline at end of file diff --git a/plugins/autolinker/prism-autolinker.min.js b/plugins/autolinker/prism-autolinker.min.js index 2cef972958..80f30dfdf2 100644 --- a/plugins/autolinker/prism-autolinker.min.js +++ b/plugins/autolinker/prism-autolinker.min.js @@ -1 +1 @@ -(function(){if(!self.Prism)return;var e=/\b([a-z]{3,7}:\/\/|tel:)[\w-+%~/.:#=?&]+/,t=/\b\S+@[\w.]+[a-z]{2}/,n=/\[([^\]]+)]\(([^)]+)\)/,r=["comment","url","attr-value","string"];for(var i in Prism.languages){var s=Prism.languages[i];Prism.languages.DFS(s,function(i,s,o){if(r.indexOf(o)>-1&&Prism.util.type(s)!=="Array"){s.pattern||(s=this[i]={pattern:s});s.inside=s.inside||{};o=="comment"&&(s.inside["md-link"]=n);o=="attr-value"?Prism.languages.insertBefore("inside","punctuation",{"url-link":e},s):s.inside["url-link"]=e;s.inside["email-link"]=t}});s["url-link"]=e;s["email-link"]=t}Prism.hooks.add("wrap",function(e){if(/-link$/.test(e.type)){e.tag="a";var t=e.content;if(e.type=="email-link"&&t.indexOf("mailto:")!=0)t="mailto:"+t;else if(e.type=="md-link"){var r=e.content.match(n);t=r[2];e.content=r[1]}e.attributes.href=t}})})(); \ No newline at end of file +!function(){if(self.Prism){var i=/\b([a-z]{3,7}:\/\/|tel:)[\w-+%~/.:#=?&]+/,n=/\b\S+@[\w.]+[a-z]{2}/,t=/\[([^\]]+)]\(([^)]+)\)/,e=["comment","url","attr-value","string"];for(var a in Prism.languages){var r=Prism.languages[a];Prism.languages.DFS(r,function(a,r,l){e.indexOf(l)>-1&&"Array"!==Prism.util.type(r)&&(r.pattern||(r=this[a]={pattern:r}),r.inside=r.inside||{},"comment"==l&&(r.inside["md-link"]=t),"attr-value"==l?Prism.languages.insertBefore("inside","punctuation",{"url-link":i},r):r.inside["url-link"]=i,r.inside["email-link"]=n)}),r["url-link"]=i,r["email-link"]=n}Prism.hooks.add("wrap",function(i){if(/-link$/.test(i.type)){i.tag="a";var n=i.content;if("email-link"==i.type&&0!=n.indexOf("mailto:"))n="mailto:"+n;else if("md-link"==i.type){var e=i.content.match(t);n=e[2],i.content=e[1]}i.attributes.href=n}})}}(); \ No newline at end of file diff --git a/plugins/file-highlight/prism-file-highlight.min.js b/plugins/file-highlight/prism-file-highlight.min.js index 19f13b8a06..bd9891e4a5 100644 --- a/plugins/file-highlight/prism-file-highlight.min.js +++ b/plugins/file-highlight/prism-file-highlight.min.js @@ -1 +1 @@ -(function(){if(!self.Prism||!self.document||!document.querySelector)return;var e={js:"javascript",html:"markup",svg:"markup",xml:"markup",py:"python",rb:"ruby"};Array.prototype.slice.call(document.querySelectorAll("pre[data-src]")).forEach(function(t){var n=t.getAttribute("data-src"),r=(n.match(/\.(\w+)$/)||[,""])[1],i=e[r]||r,s=document.createElement("code");s.className="language-"+i;t.textContent="";s.textContent="Loading…";t.appendChild(s);var o=new XMLHttpRequest;o.open("GET",n,!0);o.onreadystatechange=function(){if(o.readyState==4)if(o.status<400&&o.responseText){s.textContent=o.responseText;Prism.highlightElement(s)}else o.status>=400?s.textContent="✖ Error "+o.status+" while fetching file: "+o.statusText:s.textContent="✖ Error: File does not exist or is empty"};o.send(null)})})(); \ No newline at end of file +!function(){if(self.Prism&&self.document&&document.querySelector){var t={js:"javascript",html:"markup",svg:"markup",xml:"markup",py:"python",rb:"ruby"};Array.prototype.slice.call(document.querySelectorAll("pre[data-src]")).forEach(function(e){var r=e.getAttribute("data-src"),n=(r.match(/\.(\w+)$/)||[,""])[1],a=t[n]||n,s=document.createElement("code");s.className="language-"+a,e.textContent="",s.textContent="Loading…",e.appendChild(s);var o=new XMLHttpRequest;o.open("GET",r,!0),o.onreadystatechange=function(){4==o.readyState&&(o.status<400&&o.responseText?(s.textContent=o.responseText,Prism.highlightElement(s)):s.textContent=o.status>=400?"✖ Error "+o.status+" while fetching file: "+o.statusText:"✖ Error: File does not exist or is empty")},o.send(null)})}}(); \ No newline at end of file From 65080051b1ab47f0135c174c5a4759ba447ccce0 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 19:21:48 +0100 Subject: [PATCH 061/137] Add error message in red above the code if a file fails to download --- download.html | 5 +++++ download.js | 31 +++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/download.html b/download.html index 29ea909ce0..7efa7deab8 100644 --- a/download.html +++ b/download.html @@ -87,6 +87,10 @@ padding: .3em; } + #download .error { + color: #B61500; + display: none; + } #download pre { height: 20em; word-wrap: break-word; @@ -133,6 +137,7 @@

Customize your download

Note: The filesizes displayed refer to non-gizipped files and include any CSS code required. The CSS code is not minified.

+
Download JS diff --git a/download.js b/download.js index 44a7299e5d..7b4d99e11d 100644 --- a/download.js +++ b/download.js @@ -33,7 +33,7 @@ if (qstr) { if (components[category][id].option) { delete components[category][id].option; } - }; + } ids.forEach(function(id) { if (id !== 'meta') { if (components[category][id]) { @@ -187,7 +187,7 @@ form.elements.compression[1].onclick = function() { minified = !!+this.value; getFilesSizes(); -} +}; function getFileSize(filepath) { return treePromise.then(function(tree) { @@ -242,7 +242,7 @@ function getFileContents(filepath) { $u.xhr({ url: filepath, callback: function(xhr) { - if (xhr.status < 400) { + if (xhr.status < 400 && xhr.responseText) { resolve(xhr.responseText); } else { reject(); @@ -361,7 +361,19 @@ function generateCode(){ } } - buildCode(promises).then(function(code) { + // Hide error message if visible + var error = $('#download .error'); + error.style.display = ''; + + buildCode(promises).then(function(res) { + var code = res.code; + var errors = res.errors; + + if(errors.length) { + error.style.display = 'block'; + error.innerHTML = ''; + $u.element.contents(error, errors); + } var redownloadUrl = window.location.href.split("?")[0] + "?"; for (var category in redownload) { @@ -384,6 +396,8 @@ function buildCode(promises) { var i = 0, l = promises.length; var code = {js: '', css: ''}; + var errors = []; + var f = function(resolve) { if(i < l) { var p = promises[i]; @@ -393,12 +407,17 @@ function buildCode(promises) { f(resolve); }); p.contentsPromise['catch'](function() { - code[p.type] += '/* Error downloading file '+p.path+' */' + '\n'; + errors.push($u.element.create({ + tag: 'p', + prop: { + textContent: 'An error occurred while fetching the file "' + p.path + '".' + } + })); i++; f(resolve); }); } else { - resolve(code); + resolve({code: code, errors: errors}); } }; From 22ec5cb22b4e5d937951485b4a1501ee2d11b9ae Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 19:33:43 +0100 Subject: [PATCH 062/137] Exponent may be signed with + --- components/prism-javascript.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-javascript.js b/components/prism-javascript.js index ef63808be5..c0feeec742 100644 --- a/components/prism-javascript.js +++ b/components/prism-javascript.js @@ -1,6 +1,6 @@ Prism.languages.javascript = Prism.languages.extend('clike', { 'keyword': /\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/g, - 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g + 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g }); Prism.languages.insertBefore('javascript', 'keyword', { From 3b0521321ac06d87c26204a2a5aed43afb87bdae Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 19:35:18 +0100 Subject: [PATCH 063/137] JS function can contain $ --- components/prism-javascript.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/prism-javascript.js b/components/prism-javascript.js index c0feeec742..1d5c3e7838 100644 --- a/components/prism-javascript.js +++ b/components/prism-javascript.js @@ -1,6 +1,7 @@ Prism.languages.javascript = Prism.languages.extend('clike', { 'keyword': /\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/g, - 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g + 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g, + 'function': /(?!\d)[a-z0-9_$]+(?=\()/ig }); Prism.languages.insertBefore('javascript', 'keyword', { From 91bb0bb18f6354220d1f78cfbafcf96a20262753 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 19:37:26 +0100 Subject: [PATCH 064/137] Run gulp --- components/prism-javascript.min.js | 2 +- prism.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/prism-javascript.min.js b/components/prism-javascript.min.js index 9af805f750..f3c1210cba 100644 --- a/components/prism-javascript.min.js +++ b/components/prism-javascript.min.js @@ -1 +1 @@ -Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/[\w\W]*?<\/script>/gi,inside:{tag:{pattern:/|<\/script>/gi,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript},alias:"language-javascript"}}); \ No newline at end of file +Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g,"function":/(?!\d)[a-z0-9_$]+(?=\()/gi}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/[\w\W]*?<\/script>/gi,inside:{tag:{pattern:/|<\/script>/gi,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript},alias:"language-javascript"}}); \ No newline at end of file diff --git a/prism.js b/prism.js index 6e610df117..4826c35fd9 100644 --- a/prism.js +++ b/prism.js @@ -575,7 +575,8 @@ Prism.languages.clike = { Prism.languages.javascript = Prism.languages.extend('clike', { 'keyword': /\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/g, - 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g + 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g, + 'function': /(?!\d)[a-z0-9_$]+(?=\()/ig }); Prism.languages.insertBefore('javascript', 'keyword', { From 62262857af726225660731cdb16e9c0d5722e256 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 19:42:58 +0100 Subject: [PATCH 065/137] Moved some definitions to JS --- components/prism-actionscript.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/prism-actionscript.js b/components/prism-actionscript.js index d116c7c252..66b3f7269e 100644 --- a/components/prism-actionscript.js +++ b/components/prism-actionscript.js @@ -4,9 +4,7 @@ Prism.languages.actionscript = Prism.languages.extend('javascript', { 'keyword': /\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with|dynamic|each|final|get|include|namespace|native|override|set|static)\b/, - 'number': /\b-?(\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g, - 'operator': /(?:[+\-*\/%^]|&&?|\|\|?|<>?>?|[!=]=)=?|[=~?@]/, - 'function': /(?!\d)[a-z0-9_$]+(?=\()/ig + 'operator': /(?:[+\-*\/%^]|&&?|\|\|?|<>?>?|[!=]=)=?|[=~?@]/ }); Prism.languages.actionscript['class-name'].alias = 'function'; From f55b0c08ad2539e03c471618df1746ba594c7a3e Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 19:45:05 +0100 Subject: [PATCH 066/137] Updated minified file --- components/prism-actionscript.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-actionscript.min.js b/components/prism-actionscript.min.js index a53c76fa8e..cbe958c936 100644 --- a/components/prism-actionscript.min.js +++ b/components/prism-actionscript.min.js @@ -1 +1 @@ -Prism.languages.actionscript=Prism.languages.extend("javascript",{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with|dynamic|each|final|get|include|namespace|native|override|set|static)\b/,number:/\b-?(\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g,operator:/(?:[+\-*\/%^]|&&?|\|\|?|<>?>?|[!=]=)=?|[=~?@]/,"function":/(?!\d)[a-z0-9_$]+(?=\()/gi}),Prism.languages.actionscript["class-name"].alias="function",Prism.languages.markup&&Prism.languages.insertBefore("actionscript","operator",{xml:{pattern:/(^|[^.])<[\s\S]*>(?=\s*($|[\r\n,.;\]})<]))/,inside:{rest:Prism.languages.markup}}}); \ No newline at end of file +Prism.languages.actionscript=Prism.languages.extend("javascript",{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with|dynamic|each|final|get|include|namespace|native|override|set|static)\b/,operator:/(?:[+\-*\/%^]|&&?|\|\|?|<>?>?|[!=]=)=?|[=~?@]/}),Prism.languages.actionscript["class-name"].alias="function",Prism.languages.markup&&Prism.languages.insertBefore("actionscript","operator",{xml:{pattern:/(^|[^.])<[\s\S]*>(?=\s*($|[\r\n,.;\]})<]))/,inside:{rest:Prism.languages.markup}}}); \ No newline at end of file From 9267e3604bb15fb6960d88b9b4891d57febf1f94 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 20:21:13 +0100 Subject: [PATCH 067/137] Updated minified file --- components/prism-smarty.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-smarty.min.js b/components/prism-smarty.min.js index ce5f81b20f..08b7e8fd50 100644 --- a/components/prism-smarty.min.js +++ b/components/prism-smarty.min.js @@ -1 +1 @@ -!function(a){var b=/\{\*[\w\W]+?\*\}|\{[\w\W]+?\}/g,c="{literal}",d="{/literal}",e=!1;a.languages.smarty=a.languages.extend("markup",{smarty:{pattern:b,inside:{delimiter:{pattern:/^\{|\}$/gi,alias:"punctuation"},string:/(["'])(\\?.)*?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,variable:[/\$(?!\d)\w+/g,/#(?!\d)\w+#/g,{pattern:/(\.|->)(?!\d)\w+/g,lookbehind:!0},{pattern:/(\[)(?!\d)\w+(?=\])/g,lookbehind:!0}],"function":[{pattern:/(\|\s*)@?(?!\d)\w+/,lookbehind:!0},/^\/?(?!\d)\w+/g,/(?!\d)\w+(?=\()/g],"attr-name":{pattern:/\w+\s*=\s*(?:(?!\d)\w+)?/g,inside:{variable:{pattern:/(=\s*)(?!\d)\w+/g,lookbehind:!0},punctuation:/=/g}},punctuation:/[\[\]().,=\|:`]|\->/g,operator:[/[+\-*\/%]|===?|[!<>]=?|&&|\|\|/g,/\bis\s+(?:not\s+)?(?:div|even|odd)(?:\s+by)?\b/,/\b(?:eq|neq?|gt|lt|gt?e|lt?e|not|mod|or|and)\b/g],keyword:/\b(?:false|off|on|no|true|yes)\b/g}}}),a.languages.insertBefore("smarty","tag",{"smarty-comment":{pattern:/\{\*[\w\W]*?\*\}/g,alias:["smarty","comment"]}}),a.hooks.add("before-highlight",function(a){"smarty"===a.language&&(a.tokenStack=[],a.backupCode=a.code,a.code=a.code.replace(b,function(b){return b===d&&(e=!1),e?b:(b===c&&(e=!0),a.tokenStack.push(b),"___SMARTY"+a.tokenStack.length+"___")}))}),a.hooks.add("before-insert",function(a){"smarty"===a.language&&(a.code=a.backupCode,delete a.backupCode)}),a.hooks.add("after-highlight",function(b){if("smarty"===b.language){for(var d,c=0;d=b.tokenStack[c];c++)b.highlightedCode=b.highlightedCode.replace("___SMARTY"+(c+1)+"___",a.highlight(d,b.grammar,"smarty"));b.element.innerHTML=b.highlightedCode}})}(Prism); \ No newline at end of file +!function(e){var t=/\{\*[\w\W]+?\*\}|\{[\w\W]+?\}/g,a="{literal}",n="{/literal}",o=!1;e.languages.smarty=e.languages.extend("markup",{smarty:{pattern:t,inside:{delimiter:{pattern:/^\{|\}$/gi,alias:"punctuation"},string:/(["'])(\\?.)*?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,variable:[/\$(?!\d)\w+/g,/#(?!\d)\w+#/g,{pattern:/(\.|->)(?!\d)\w+/g,lookbehind:!0},{pattern:/(\[)(?!\d)\w+(?=\])/g,lookbehind:!0}],"function":[{pattern:/(\|\s*)@?(?!\d)\w+/,lookbehind:!0},/^\/?(?!\d)\w+/g,/(?!\d)\w+(?=\()/g],"attr-name":{pattern:/\w+\s*=\s*(?:(?!\d)\w+)?/g,inside:{variable:{pattern:/(=\s*)(?!\d)\w+/g,lookbehind:!0},punctuation:/=/g}},punctuation:/[\[\]().,=\|:`]|\->/g,operator:[/[+\-*\/%]|===?|[!<>]=?|&&|\|\|/g,/\bis\s+(?:not\s+)?(?:div|even|odd)(?:\s+by)?\b/,/\b(?:eq|neq?|gt|lt|gt?e|lt?e|not|mod|or|and)\b/g],keyword:/\b(?:false|off|on|no|true|yes)\b/g}}}),e.languages.insertBefore("smarty","tag",{"smarty-comment":{pattern:/\{\*[\w\W]*?\*\}/g,alias:["smarty","comment"]}}),e.hooks.add("before-highlight",function(e){"smarty"===e.language&&(e.tokenStack=[],e.backupCode=e.code,e.code=e.code.replace(t,function(t){return t===n&&(o=!1),o?t:(t===a&&(o=!0),e.tokenStack.push(t),"___SMARTY"+e.tokenStack.length+"___")}))}),e.hooks.add("before-insert",function(e){"smarty"===e.language&&(e.code=e.backupCode,delete e.backupCode)}),e.hooks.add("after-highlight",function(t){if("smarty"===t.language){for(var a,n=0;a=t.tokenStack[n];n++)t.highlightedCode=t.highlightedCode.replace("___SMARTY"+(n+1)+"___",e.highlight(a,t.grammar,"smarty"));t.element.innerHTML=t.highlightedCode}})}(Prism); \ No newline at end of file From 11a79455fb573b5944e430d722ae6467af89fcc5 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 20:22:03 +0100 Subject: [PATCH 068/137] Updated minified file --- components/prism-css-extras.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-css-extras.min.js b/components/prism-css-extras.min.js index 440842f648..6c6067573d 100644 --- a/components/prism-css-extras.min.js +++ b/components/prism-css-extras.min.js @@ -1 +1 @@ -Prism.languages.css.selector={pattern:/[^\{\}\s][^\{\}]*(?=\s*\{)/g,inside:{"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/g,"pseudo-class":/:[-\w]+(?:\(.*\))?/g,"class":/\.[-:\.\w]+/g,id:/#[-:\.\w]+/g}},Prism.languages.insertBefore("css","ignore",{hexcode:/#[\da-f]{3,6}/gi,entity:/\\[\da-f]{1,8}/gi,number:/[\d%\.]+/g}); \ No newline at end of file +Prism.languages.css.selector={pattern:/[^\{\}\s][^\{\}]*(?=\s*\{)/g,inside:{"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/g,"pseudo-class":/:[-\w]+(?:\(.*\))?/g,"class":/\.[-:\.\w]+/g,id:/#[-:\.\w]+/g}},Prism.languages.insertBefore("css","function",{hexcode:/#[\da-f]{3,6}/gi,entity:/\\[\da-f]{1,8}/gi,number:/[\d%\.]+/g}); \ No newline at end of file From ee2d874fd0a80302cf8b0e45785161f6658222ec Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 20 Dec 2014 20:25:11 +0100 Subject: [PATCH 069/137] Updated minified file --- components/prism-handlebars.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-handlebars.min.js b/components/prism-handlebars.min.js index 3c6fa34783..555c80447d 100644 --- a/components/prism-handlebars.min.js +++ b/components/prism-handlebars.min.js @@ -1 +1 @@ -!function(a){var b=/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g;a.languages.handlebars=a.languages.extend("markup",{handlebars:{pattern:b,inside:{delimiter:{pattern:/^\{\{\{?|\}\}\}?$/gi,alias:"punctuation"},string:/(["'])(\\?.)+?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,"boolean":/\b(true|false)\b/g,block:{pattern:/^(\s*~?\s*)[#\/]\w+/gi,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/g,variable:/[\w\W]+/g}},punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g}}}),a.languages.insertBefore("handlebars","tag",{"handlebars-comment":{pattern:/\{\{![\w\W]*\}\}/g,alias:["handlebars","comment"]}}),a.hooks.add("before-highlight",function(a){"handlebars"===a.language&&(a.tokenStack=[],a.backupCode=a.code,a.code=a.code.replace(b,function(b){return a.tokenStack.push(b),"___HANDLEBARS"+a.tokenStack.length+"___"}))}),a.hooks.add("before-insert",function(a){"handlebars"===a.language&&(a.code=a.backupCode,delete a.backupCode)}),a.hooks.add("after-highlight",function(b){if("handlebars"===b.language){for(var d,c=0;d=b.tokenStack[c];c++)b.highlightedCode=b.highlightedCode.replace("___HANDLEBARS"+(c+1)+"___",a.highlight(d,b.grammar,"handlebars"));b.element.innerHTML=b.highlightedCode}})}(Prism); \ No newline at end of file +!function(e){var a=/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g;e.languages.handlebars=e.languages.extend("markup",{handlebars:{pattern:a,inside:{delimiter:{pattern:/^\{\{\{?|\}\}\}?$/gi,alias:"punctuation"},string:/(["'])(\\?.)+?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,"boolean":/\b(true|false)\b/g,block:{pattern:/^(\s*~?\s*)[#\/]\w+/gi,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/g,variable:/[\w\W]+/g}},punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g}}}),e.languages.insertBefore("handlebars","tag",{"handlebars-comment":{pattern:/\{\{![\w\W]*\}\}/g,alias:["handlebars","comment"]}}),e.hooks.add("before-highlight",function(e){"handlebars"===e.language&&(e.tokenStack=[],e.backupCode=e.code,e.code=e.code.replace(a,function(a){return e.tokenStack.push(a),"___HANDLEBARS"+e.tokenStack.length+"___"}))}),e.hooks.add("before-insert",function(e){"handlebars"===e.language&&(e.code=e.backupCode,delete e.backupCode)}),e.hooks.add("after-highlight",function(a){if("handlebars"===a.language){for(var n,t=0;n=a.tokenStack[t];t++)a.highlightedCode=a.highlightedCode.replace("___HANDLEBARS"+(t+1)+"___",e.highlight(n,a.grammar,"handlebars"));a.element.innerHTML=a.highlightedCode}})}(Prism); \ No newline at end of file From aabf7a76d53c0fc788004e99098e0f4f2984fe15 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 21 Dec 2014 12:33:29 +0100 Subject: [PATCH 070/137] Eiffel should not be a default language + add credits --- components.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components.js b/components.js index 6f0779ed04..67b3da36cf 100644 --- a/components.js +++ b/components.js @@ -60,7 +60,7 @@ var components = { }, "eiffel": { "title": "Eiffel", - "option": "default" + "owner": "Conaclos" }, "javascript": { "title": "JavaScript", From c4a9ace1d8f398d2a6fb8f1f8671b6f7f122e46e Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 21 Dec 2014 12:34:29 +0100 Subject: [PATCH 071/137] Run Gulp --- components/prism-eiffel.min.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 components/prism-eiffel.min.js diff --git a/components/prism-eiffel.min.js b/components/prism-eiffel.min.js new file mode 100644 index 0000000000..502594dfa0 --- /dev/null +++ b/components/prism-eiffel.min.js @@ -0,0 +1 @@ +Prism.languages.eiffel={string:[/"\[(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)*?]"/g,/"\{(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)*?}"/g,/"(?:[^%\b\f\n\r\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)*?"/g],comment:/--.*/,"char":/'(?:[^%\b\f\n\r\t\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)'/g,keyword:/\b(?:across|agent|alias|all|and|attached|as|assign|attribute|check|class|convert|create|Current|debug|deferred|detachable|do|else|elseif|end|ensure|expanded|export|external|feature|from|frozen|if|implies|inherit|inspect|invariant|like|local|loop|not|note|obsolete|old|once|or|Precursor|redefine|rename|require|rescue|Result|retry|select|separate|some|then|undefine|until|variant|Void|when|xor)\b/gi,"boolean":/\b(?:True|False)\b/gi,number:[/\b0(?:[xX][\da-fA-F](?:_*[\da-fA-F])*|[cC][0-7](?:_*[0-7])*|[bB][01](?:_*[01])*)\b/g,/(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/g],punctuation:/:=|<<|>>|\(\||\|\)|->|\.(?=\w)|[{}[\];(),:?]/g,operator:/\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[-+*^=~]/g}; \ No newline at end of file From a4250c8eee967ff38856e59e6bd732090f8af4b2 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 21 Dec 2014 14:33:25 +0100 Subject: [PATCH 072/137] Examples first shot --- components.js | 3 +- examples.html | 28 +++++++++-- examples.js | 100 +++++++++++++++++++++++++++++++++++++ examples/prism-markup.html | 0 4 files changed, 127 insertions(+), 4 deletions(-) create mode 100644 examples.js create mode 100644 examples/prism-markup.html diff --git a/components.js b/components.js index 67b3da36cf..6eb237235a 100644 --- a/components.js +++ b/components.js @@ -34,7 +34,8 @@ var components = { "languages": { "meta": { "path": "components/prism-{id}", - "noCSS": true + "noCSS": true, + "examplesPath": "examples/prism-{id}" }, "markup": { "title": "Markup", diff --git a/examples.html b/examples.html index 78722351f0..56bcb41411 100644 --- a/examples.html +++ b/examples.html @@ -7,6 +7,23 @@ Examples ▲ Prism + @@ -55,6 +72,12 @@

code.language-none

<p>hi!</p>
+
+

Per language examples

+
+
+
+

Markup

@@ -440,12 +463,11 @@

Two quotes of the same type (i.e. both single or both double) inside a regex
- - - + + diff --git a/examples.js b/examples.js new file mode 100644 index 0000000000..0adbb20de2 --- /dev/null +++ b/examples.js @@ -0,0 +1,100 @@ +/** + * Manage examples + */ + +(function() { + +var cache = {}; +var dependencies = {}; + +// TODO change treeURL before commit ! +var treeURL = 'https://github.com/gitapi/repos/Golmote/prism/git/trees/prism-examples?recursive=1'; +var treePromise = new Promise(function(resolve) { + $u.xhr({ + url: treeURL, + callback: function(xhr) { + if (xhr.status < 400) { + resolve(JSON.parse(xhr.responseText).tree); + } + } + }); +}); + +var languages = components.languages; + +for (var id in languages) { + if(id === 'meta') { + continue; + } + + var language = languages[id]; + var checked = false; + + if (language.option === 'default') { + checked = true; + } + + language.enabled = checked; + language.file = languages.meta.path.replace(/\{id}/g, id) + '.js'; + language.examples = languages.meta.examplesPath.replace(/\{id}/g, id) + '.html'; + + if (language.require) { + dependencies[language.require] = (dependencies[language.require] || []).concat(id); + } + + fileExists(language.examples).then(function() { + $u.element.create('label', { + attributes: { + 'data-id': id + }, + contents: [ + { + tag: 'input', + properties: { + type: 'checkbox', + name: 'language', + value: id, + checked: checked, + onclick: (function (id) { + return function () { + $$('input[name="' + this.name + '"]').forEach(function (input) { + languages[input.value].enabled = input.checked; + }); + + update(id); + }; + }(id)) + } + }, + language.title, + language.owner ? { + tag: 'a', + properties: { + href: 'http://github.com/' + language.owner, + className: 'owner', + target: '_blank' + }, + contents: language.owner + } : ' ' + ], + inside: '#languages' + }); + }); +} + +function fileExists(filepath) { + return treePromise.then(function(tree) { + for(var i=0, l=tree.length; i Date: Sun, 21 Dec 2014 15:25:26 +0100 Subject: [PATCH 073/137] Examples work in progress --- examples.html | 16 ++- examples.js | 188 +++++++++++++++++++++++---------- examples/prism-css.html | 31 ++++++ examples/prism-javascript.html | 51 +++++++++ examples/prism-markup.html | 75 +++++++++++++ 5 files changed, 306 insertions(+), 55 deletions(-) create mode 100644 examples/prism-css.html create mode 100644 examples/prism-javascript.html diff --git a/examples.html b/examples.html index 56bcb41411..da1a3dc985 100644 --- a/examples.html +++ b/examples.html @@ -9,7 +9,7 @@ @@ -76,7 +88,7 @@

code.language-none

Per language examples

-
+

Markup

diff --git a/examples.js b/examples.js index 0adbb20de2..d178525e13 100644 --- a/examples.js +++ b/examples.js @@ -4,15 +4,14 @@ (function() { -var cache = {}; -var dependencies = {}; +var examples = {}; // TODO change treeURL before commit ! var treeURL = 'https://github.com/gitapi/repos/Golmote/prism/git/trees/prism-examples?recursive=1'; -var treePromise = new Promise(function(resolve) { +var treePromise = new Promise(function (resolve) { $u.xhr({ url: treeURL, - callback: function(xhr) { + callback: function (xhr) { if (xhr.status < 400) { resolve(JSON.parse(xhr.responseText).tree); } @@ -23,78 +22,161 @@ var treePromise = new Promise(function(resolve) { var languages = components.languages; for (var id in languages) { - if(id === 'meta') { + if (id === 'meta') { continue; } - var language = languages[id]; - var checked = false; - - if (language.option === 'default') { - checked = true; - } + (function (id) { + var language = languages[id]; + var checked = false; - language.enabled = checked; - language.file = languages.meta.path.replace(/\{id}/g, id) + '.js'; - language.examples = languages.meta.examplesPath.replace(/\{id}/g, id) + '.html'; + if (language.option === 'default') { + checked = true; + } - if (language.require) { - dependencies[language.require] = (dependencies[language.require] || []).concat(id); - } + language.enabled = checked; + language.path = languages.meta.path.replace(/\{id}/g, id) + '.js'; + language.examplesPath = languages.meta.examplesPath.replace(/\{id}/g, id) + '.html'; - fileExists(language.examples).then(function() { - $u.element.create('label', { - attributes: { - 'data-id': id - }, - contents: [ - { - tag: 'input', - properties: { - type: 'checkbox', - name: 'language', - value: id, - checked: checked, - onclick: (function (id) { - return function () { + fileExists(language.examplesPath).then(function (exists) { + $u.element.create('label', { + attributes: { + 'data-id': id, + 'title': !exists ? 'No examples are available for this language.' : '' + }, + className: !exists ? 'unavailable' : '', + contents: [ + { + tag: 'input', + properties: { + type: 'checkbox', + name: 'language', + value: id, + checked: checked && exists, + disabled: !exists, + onclick: function () { $$('input[name="' + this.name + '"]').forEach(function (input) { languages[input.value].enabled = input.checked; }); update(id); - }; - }(id)) - } - }, - language.title, - language.owner ? { - tag: 'a', - properties: { - href: 'http://github.com/' + language.owner, - className: 'owner', - target: '_blank' + } + } }, - contents: language.owner - } : ' ' - ], - inside: '#languages' + language.title + ], + inside: '#languages' + }); + examples[id] = $u.element.create('section', { + 'id': 'language-' + id, + 'className': 'language-' + id, + inside: '#examples' + }); + if (checked) { + update(id); + } }); - }); + }(id)); } function fileExists(filepath) { - return treePromise.then(function(tree) { - for(var i=0, l=tree.length; i} the list of dependencies. Empty if the language has none. + */ +function getDependenciesOfLanguage (lang) +{ + if (!components.languages[lang] || !components.languages[lang].require) + { + return []; + } + + return ($u.type(components.languages[lang].require) === "Array") + ? components.languages[lang].require + : [components.languages[lang].require]; } }()); \ No newline at end of file diff --git a/examples/prism-css.html b/examples/prism-css.html new file mode 100644 index 0000000000..72494548ba --- /dev/null +++ b/examples/prism-css.html @@ -0,0 +1,31 @@ +

CSS

+

To use this language, use the class "language-css".

+ +

Empty rule

+
*{} * {} p {}
+
ul,
+ol {}
+ +

Simple rule

+
p { color: red; }
+ +

Important rule

+
p { color: red !important; }
+ +

@ rule

+
@media screen and (min-width: 100px) {}
+ +

LESS variable

+
@main-color: red;
+.foo {
+	background: @main-color;
+}
+ +

Comment

+
/* Simple comment here */
+ +

String

+
content: 'foo';
+ +

URL

+
content: url(foo.png);
\ No newline at end of file diff --git a/examples/prism-javascript.html b/examples/prism-javascript.html new file mode 100644 index 0000000000..d7a8725b78 --- /dev/null +++ b/examples/prism-javascript.html @@ -0,0 +1,51 @@ +

JavaScript

+

To use this language, use the class "language-javascript".

+ +

Variable assignment

+
var foo = "bar", baz = 5;
+ +

Operators

+
(1 + 2 * 3)/4 >= 3 && 4 < 5 || 6 > 7
+ +

Indented code

+
if (true) {
+	while (true) {
+	doSomething();
+	}
+	}
+ +

Regex with slashes

+
var foo = /([^/])\/(\\?.|\[.+?])+?\/[gim]{0,3}/g;
+ +

Regex that ends with double slash

+
var bar = /\/\*[\w\W]*?\*\//g;
+ +

Single line comments & regexes

+
// http://lea.verou.me
+	var comment = /\/\*[\w\W]*?\*\//g;
+ +

Link in comment

+
// http://lea.verou.me
+	/* http://lea.verou.me */
+ +

Nested strings

+
var foo = "foo", bar = "He \"said\" 'hi'!"
+ +

Strings inside comments

+
// "foo"
+
/* "foo" */
+ +

Strings with slashes

+
env.content + '</' + env.tag + '>'
+
var foo = "/" + "/";
+
var foo = "http://prismjs.com"; // Strings are strings and comments are comments ;)
+ +

Regex inside single line comment

+
// hey, /this doesn’t fail!/ :D
+ +

Two or more division operators on the same line

+
var foo = 5 / 6 / 7;
+ +

A division operator on the same line as a regex

+
var foo = 1/2, bar = /a/g;
+
var foo = /a/, bar = 3/4;
\ No newline at end of file diff --git a/examples/prism-markup.html b/examples/prism-markup.html index e69de29bb2..e069143415 100644 --- a/examples/prism-markup.html +++ b/examples/prism-markup.html @@ -0,0 +1,75 @@ +

Markup

+

To use this language, use the class "language-markup".

+ +

Empty tag

+
<p></p>
+ +

Tag that spans multiple lines

+
<p
+>hello!
+</p>
+ +

Name-attribute pair

+
<p></p>
+ +

Name-attribute pair without quotes

+
<p class=prism></p>
+ +

Attribute without value

+
<p data-foo></p>
+<p data-foo ></p>
+
+ +

Namespaces

+
<html:p foo:bar="baz" foo:weee></html:p>
+ +

XML prolog

+
<?xml version="1.0" encoding="utf-8"?>
+<svg></svg>
+ +

DOCTYPE

+
<!DOCTYPE html>
+<html></html>
+ +

CDATA section

+
<ns1:description><![CDATA[
+  CDATA is <not> magical.
+]]></ns1:description>
+ +

Comment

+
<!-- I'm a comment -->
+And i'm not
+ +

Entities

+
&amp; &#x2665; &#160; &#x152;
+ +

Embedded JS and CSS

+
<!DOCTYPE html>
+<html lang="en">
+<head>
+	<meta charset="utf-8" />
+	<title>I can haz embedded CSS and JS</title>
+	<style>
+		@media print {
+			p { color: red !important; }
+		}
+	</style>
+</head>
+<body>
+	<h1>I can haz embedded CSS and JS</h1>
+	<script>
+	if (true) {
+		console.log('foo');
+	}
+	</script>
+
+</body>
+</html>
+ +

Invalid HTML

+
<l </ul>
+ +

Multi-line attribute values

+
<p title="foo
+bar
+baz">
\ No newline at end of file From d7ab5ac6bc288ae3b75ac3da8ead6019942fc2d7 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 21 Dec 2014 15:35:47 +0100 Subject: [PATCH 074/137] Examples work in progress --- examples.html | 384 +-------------------------------- examples/prism-css.html | 18 +- examples/prism-javascript.html | 61 +++--- examples/prism-markup.html | 30 +-- 4 files changed, 62 insertions(+), 431 deletions(-) diff --git a/examples.html b/examples.html index da1a3dc985..82b37a780d 100644 --- a/examples.html +++ b/examples.html @@ -88,389 +88,7 @@

code.language-none

Per language examples

-
- -
-

Markup

- -

Empty tag

-
<p></p>
- -

Tag that spans multiple lines

-
<p
->hello!
-</p>
- -

Name-attribute pair

-
<p></p>
- -

Name-attribute pair without quotes

-
<p class=prism></p>
- -

Attribute without value

-
<p data-foo></p>
-
<p data-foo ></p>
- -

Namespaces

-
<html:p foo:bar="baz" foo:weee></html:p>
- -

XML prolog

-
<?xml version="1.0" encoding="utf-8"?>
-<svg></svg>
- -

DOCTYPE

-
<!DOCTYPE html>
-<html></html>
- -

CDATA section

-
<ns1:description><![CDATA[
-  CDATA is <not> magical.
-]]></ns1:description>
- -

Comment

-
<!-- I'm a comment -->
-And i'm not
- -

Entities

-
&amp; &#x2665; &#160; &#x152;
- -

Embedded JS and CSS

-
<!DOCTYPE html>
-<html lang="en">
-<head>
-	<meta charset="utf-8" />
-	<title>I can haz embedded CSS and JS</title>
-	<style>
-		@media print {
-			p { color: red !important; }
-		}
-	</style>
-</head>
-<body>
-	<h1>I can haz embedded CSS and JS</h1>
-	<script>
-	if (true) {
-		console.log('foo');
-	}
-	</script>
-
-</body>
-</html>
- -

Invalid HTML

-
<l </ul>
- -

Multi-line attribute values

-
<p title="foo
-bar
-baz">
-
- -
-

CSS

- -

Empty rule

-
*{} * {} p {}
-
ul,
-ol {}
- -

Simple rule

-
p { color: red; }
- -

Important rule

-
p { color: red !important; }
- -

@ rule

-
@media screen and (min-width: 100px) {}
- -

LESS variable

-
@main-color: red;
-.foo {
-  background: @main-color;
-}
- -

Comment

-
/* Simple comment here */
- -

String

-
content: 'foo';
- -

URL

-
content: url(foo.png);
-
- -
-

JavaScript

- -

Variable assignment

-
var foo = "bar", baz = 5;
- -

Operators

-
(1 + 2 * 3)/4 >= 3 && 4 < 5 || 6 > 7
- -

Indented code

-
if (true) {
-	while (true) {
-		doSomething();
-	}
-}
- -

Regex with slashes

-
var foo = /([^/])\/(\\?.|\[.+?])+?\/[gim]{0,3}/g;
- -

Regex that ends with double slash

-
var bar = /\/\*[\w\W]*?\*\//g;
- -

Single line comments & regexes

-
// http://lea.verou.me
-var comment = /\/\*[\w\W]*?\*\//g;
- -

Link in comment

-
// http://lea.verou.me
-/* http://lea.verou.me */
- -

Nested strings

-
var foo = "foo", bar = "He \"said\" 'hi'!"
- -

Strings inside comments

-
// "foo"
-
/* "foo" */
- -

Strings with slashes

-
env.content + '</' + env.tag + '>'
-
var foo = "/" + "/";
-
var foo = "http://prismjs.com"; // Strings are strings and comments are comments ;)
- -

Regex inside single line comment

-
// hey, /this doesn’t fail!/ :D
- -

Two or more division operators on the same line

-
var foo = 5 / 6 / 7;
- -

A division operator on the same line as a regex

-
var foo = 1/2, bar = /a/g;
-
var foo = /a/, bar = 3/4;
-
- -
-

Java

- -

Java Language Keywords

-

-abstract continue for        new       switch
-assert   default  goto       package   synchronized
-boolean  do       if         private   this
-break    double   implements protected throw
-byte     else     import     public    throws
-case     enum     instanceof return    transient
-catch    extends  int        short     try
-char     final    interface  static    void
-class    finally  long       strictfp  volatile
-const    float    native     super     while
-
-	
- -

Operators

-
// postfix
-expr++ expr--
-// unary
-++expr --expr +expr -expr ~ !
-// multiplicative
-* / %
-// additive
-+ -
-// shift
-<< >> >>>
-// relational
-< > <= >= instanceof
-// equality
-== !=
-// bitwise AND
-&
-// bitwise exclusive OR
-^
-// bitwise inclusive OR
-|
-// logical AND
-&&
-// logical OR
-||
-// ternary
-? :
-// assignment
-= += -= *= /= %= &= ^= |= <<= >>= >>>=
-	
- -

Simple class example

- -
package com.prismjs;
-
-import java.io.*;
-
-@SuppressWarnings("unchecked")
-public class PrismJS {
-
-	public static Integer test = 0;
-
-	/**
-	 * Javadoc style comment
-	 *
-	 * @param args
-	 */
-	public static void main(String[] args) {
-		// Let's create some variables
-		int numArgs = args.length;
-		Integer a = 0x1;
-		String test = "" + "Hello" + " \"World\"!";
-		double dvalue = 1.23;
-		int optest = 0;
-		optest += 321 - 45 * 1247 / 425 % 123;
-
-		/*
-		 * Multiline comment
-		 */
-		for (int i = 0; i < numArgs; i++) {
-			// Simple line comment
-			System.out.println("Arg value= " + args[i]);
-		}
-
-		do {
-			System.out.println("Do while ok!");
-		} while (false);
-	}
-}
-
-	
-

As you can notice String keyword is not highlighted because it's not a Java language keyword (cf. Java Language Keywords). The main reason is that String is not a primitive type such as int but a class type like Integer.

-
- -
-

Coffeescript

- -

Variable assignment

-
foo = "bar"
- -

Operators

-
(1 + 2 * 3)/4 >= 3 && 4 < 5 || 6 > 7
- -

Indented code

-
if true
-	while true
-		doSomething()
-	
- -

Regex with slashes

-
var foo = /([^/])\/(\\?.|\[.+?])+?\/[gim]{0,3}/g;
- -

Single line comments

-
# This is a comment
- -

Link in comment

-
# http://lea.verou.me
-###
-Block Comment
-### 
- -

Nested strings

-
var foo = "foo", bar = "He \"said\" 'hi'!"
- -

String inside comment

-
# "foo"
- - -

Strings with slashes

-
env.content + '</' + env.tag + '>'
-
var foo = "/" + "/";
- -

Two or more division operators on the same line

-
foo = 5 / 6 / 7;
- -

A division operator on the same line as a regex

-
foo = 1/2, bar = /a/g;
-
foo = /a/, bar = 3/4;
- -

A function

-

-_buttonClick: (a, b) ->
-	@hide()
-	
- -

An Object

-

-code = {
-	css: "Cascading Style Sheets"
-	cs: "CoffeeScript"
-}
-	
- -

Class Definition

-

-class CoffeeScript extends Prism.Javascript
-	
-
- -
-

HTTP

- -

Request Examples

-

A simple HTTP GET request:

-
GET https://example.tld/v1/:serviceName/users.json?sort=:sortMethod HTTP/1.1
-

Here is an HTTP POST with a body:

-
POST https://example.tld/v1/:serviceName/users.json HTTP/1.1
-Content-Type: application/json
-
-{
-	"names": ["test1", "test2"],
-	"version": 1.0
-}
-
- -

Response Examples

-

JSON response body:

-
HTTP/1.1 200 OK
-Content-Type: application/json
-X-Response-Time: 6ms
-
-{
-	"users": [
-		{
-			"name": "John",
-			"points": 24
-		},
-		{
-			"name": "Lea",
-			"points": 15
-		}
-	]
-}
-
-

XML response body:

-
HTTP/1.1 200 OK
-Content-Type: application/xml
-X-Response-Time: 10ms
-
-<root>
-	<status code="0">
-		Successful
-	</status>
-</root>
-
-
- -
-

Known failures (JavaScript)

-

There are certain edge cases where Prism will fail. - There are always such cases in every regex-based syntax highlighter. - However, Prism dares to be open and honest about them. - If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. -

- -

Comment-like substrings

-
"foo /* bar */ baz"; "foo // bar";
- -

Two quotes of the same type (i.e. both single or both double) inside a regex

-
foo = /"foo"/;
-
+
diff --git a/examples/prism-css.html b/examples/prism-css.html index 72494548ba..73cda7e6a3 100644 --- a/examples/prism-css.html +++ b/examples/prism-css.html @@ -1,31 +1,31 @@ -

CSS

+

CSS

To use this language, use the class "language-css".

-

Empty rule

+

Empty rule

*{} * {} p {}
ul,
 ol {}
-

Simple rule

+

Simple rule

p { color: red; }
-

Important rule

+

Important rule

p { color: red !important; }
-

@ rule

+

@ rule

@media screen and (min-width: 100px) {}
-

LESS variable

+

LESS variable

@main-color: red;
 .foo {
 	background: @main-color;
 }
-

Comment

+

Comment

/* Simple comment here */
-

String

+

String

content: 'foo';
-

URL

+

URL

content: url(foo.png);
\ No newline at end of file diff --git a/examples/prism-javascript.html b/examples/prism-javascript.html index d7a8725b78..2ecd0a481f 100644 --- a/examples/prism-javascript.html +++ b/examples/prism-javascript.html @@ -1,51 +1,64 @@ -

JavaScript

+

JavaScript

To use this language, use the class "language-javascript".

-

Variable assignment

+

Variable assignment

var foo = "bar", baz = 5;
-

Operators

+

Operators

(1 + 2 * 3)/4 >= 3 && 4 < 5 || 6 > 7
-

Indented code

+

Indented code

if (true) {
 	while (true) {
 	doSomething();
 	}
-	}
+} -

Regex with slashes

+

Regex with slashes

var foo = /([^/])\/(\\?.|\[.+?])+?\/[gim]{0,3}/g;
-

Regex that ends with double slash

+

Regex that ends with double slash

var bar = /\/\*[\w\W]*?\*\//g;
-

Single line comments & regexes

+

Single line comments & regexes

// http://lea.verou.me
-	var comment = /\/\*[\w\W]*?\*\//g;
+var comment = /\/\*[\w\W]*?\*\//g; -

Link in comment

+

Link in comment

// http://lea.verou.me
-	/* http://lea.verou.me */
+/* http://lea.verou.me */ -

Nested strings

+

Nested strings

var foo = "foo", bar = "He \"said\" 'hi'!"
-

Strings inside comments

-
// "foo"
-
/* "foo" */
+

Strings inside comments

+
// "foo"
+/* "foo" */
-

Strings with slashes

-
env.content + '</' + env.tag + '>'
-
var foo = "/" + "/";
-
var foo = "http://prismjs.com"; // Strings are strings and comments are comments ;)
+

Strings with slashes

+
env.content + '</' + env.tag + '>'
+var foo = "/" + "/";
+var foo = "http://prismjs.com"; // Strings are strings and comments are comments ;)
-

Regex inside single line comment

+

Regex inside single line comment

// hey, /this doesn’t fail!/ :D
-

Two or more division operators on the same line

+

Two or more division operators on the same line

var foo = 5 / 6 / 7;
-

A division operator on the same line as a regex

-
var foo = 1/2, bar = /a/g;
-
var foo = /a/, bar = 3/4;
\ No newline at end of file +

A division operator on the same line as a regex

+
var foo = 1/2, bar = /a/g;
+var foo = /a/, bar = 3/4;
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Comment-like substrings

+
"foo /* bar */ baz"; "foo // bar";
+ +

Two quotes of the same type (i.e. both single or both double) inside a regex

+
foo = /"foo"/;
\ No newline at end of file diff --git a/examples/prism-markup.html b/examples/prism-markup.html index e069143415..d3a333c76d 100644 --- a/examples/prism-markup.html +++ b/examples/prism-markup.html @@ -1,49 +1,49 @@ -

Markup

+

Markup

To use this language, use the class "language-markup".

-

Empty tag

+

Empty tag

<p></p>
-

Tag that spans multiple lines

+

Tag that spans multiple lines

<p
 >hello!
 </p>
-

Name-attribute pair

+

Name-attribute pair

<p></p>
-

Name-attribute pair without quotes

+

Name-attribute pair without quotes

<p class=prism></p>
-

Attribute without value

+

Attribute without value

<p data-foo></p>
 <p data-foo ></p>
 
-

Namespaces

+

Namespaces

<html:p foo:bar="baz" foo:weee></html:p>
-

XML prolog

+

XML prolog

<?xml version="1.0" encoding="utf-8"?>
 <svg></svg>
-

DOCTYPE

+

DOCTYPE

<!DOCTYPE html>
 <html></html>
-

CDATA section

+

CDATA section

<ns1:description><![CDATA[
   CDATA is <not> magical.
 ]]></ns1:description>
-

Comment

+

Comment

<!-- I'm a comment -->
 And i'm not
-

Entities

+

Entities

&amp; &#x2665; &#160; &#x152;
-

Embedded JS and CSS

+

Embedded JS and CSS

<!DOCTYPE html>
 <html lang="en">
 <head>
@@ -66,10 +66,10 @@ 

Embedded JS and CSS

</body> </html>
-

Invalid HTML

+

Invalid HTML

<l </ul>
-

Multi-line attribute values

+

Multi-line attribute values

<p title="foo
 bar
 baz">
\ No newline at end of file From aac37ffff792c6177f83dd64666ed484723c6417 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 21 Dec 2014 15:38:07 +0100 Subject: [PATCH 075/137] Add Rust examples --- examples/prism-rust.html | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 examples/prism-rust.html diff --git a/examples/prism-rust.html b/examples/prism-rust.html new file mode 100644 index 0000000000..2a2240a90f --- /dev/null +++ b/examples/prism-rust.html @@ -0,0 +1,7 @@ +

Rust

+

To use this language, use the class "language-rust".

+ +

Comments

+
// Single line comment
+/* Multiline
+comment */
\ No newline at end of file From 1a4fcc63b61f90ca02a43bf26a0bd2f8857bbf51 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 21 Dec 2014 16:11:33 +0100 Subject: [PATCH 076/137] Add Rust examples --- examples/prism-rust.html | 74 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/examples/prism-rust.html b/examples/prism-rust.html index 2a2240a90f..bd4d2c03e5 100644 --- a/examples/prism-rust.html +++ b/examples/prism-rust.html @@ -3,5 +3,77 @@

Rust

Comments

// Single line comment
+/// Doc comments
 /* Multiline
-comment */
\ No newline at end of file +comment */ + +

Strings

+
'C'; '\''; '\n'; '\u7FFF'; // Characters
+"foo \"bar\" baz"; // String
+r##"foo #"bar"# baz"##; // Raw string with # pairs
+b'C'; b'\''; b'\n'; // Bytes
+b"foo \"bar\" baz"; // Byte string
+br##"foo #"bar"# baz"##; // Raw byte string with # pairs
+
+ +

Numbers

+
123i;                              // type int
+123u;                              // type uint
+123_u;                             // type uint
+0xff_u8;                           // type u8
+0o70_i16;                          // type i16
+0b1111_1111_1001_0000_i32;         // type i32
+
+123.0f64;        // type f64
+0.1f64;          // type f64
+0.1f32;          // type f32
+12E+99_f64;      // type f64
+
+ +

Booleans

+
true; false;
+ +

Functions and macros

+
println!("x is {}", x);
+fn next_two(x: int) -> (int, int) { (x + 1i, x + 2i) }
+next_two(5i);
+vec![1i, 2, 3];
+
+ +

Attributes

+

+#![warn(unstable)]
+#[test]
+fn a_test() {
+	// ...
+}
+ +

Closure parameters and bitwise OR

+

+let x = a | b;
+let y = c || d;
+let add_one = |x: int| -> int { 1i + x };
+let printer = || { println!("x is: {}", x); };
+
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Nested block comments

+
/* Nested block
+	/* comments
+	are */
+not supported */
+ +

Comment-like substrings

+
"foo /* bar */ baz"; "foo // bar";
+ +

Attribute containing string

+
#[cfg(unix, target_word_size = "32")]
+ +

Delimiters of parameters for closures that don't use braces

+
|x| x + 1i;
\ No newline at end of file From b22827dcc45bc8e0f0b85cd97ae3b20e50c152cb Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 21 Dec 2014 19:37:44 +0100 Subject: [PATCH 077/137] The TODO wasn't big enough --- examples.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples.js b/examples.js index d178525e13..ceaeb6ae32 100644 --- a/examples.js +++ b/examples.js @@ -6,8 +6,7 @@ var examples = {}; -// TODO change treeURL before commit ! -var treeURL = 'https://github.com/gitapi/repos/Golmote/prism/git/trees/prism-examples?recursive=1'; +var treeURL = 'https://github.com/gitapi/repos/LeaVerou/prism/git/trees/gh-pages?recursive=1'; var treePromise = new Promise(function (resolve) { $u.xhr({ url: treeURL, From 2e156c9ac4878cb87598fee58f614369625a0416 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 21 Dec 2014 19:42:02 +0100 Subject: [PATCH 078/137] Fixed spacing in examples --- examples/prism-javascript.html | 2 +- examples/prism-rust.html | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/examples/prism-javascript.html b/examples/prism-javascript.html index 2ecd0a481f..213969fc2c 100644 --- a/examples/prism-javascript.html +++ b/examples/prism-javascript.html @@ -10,7 +10,7 @@

Operators

Indented code

if (true) {
 	while (true) {
-	doSomething();
+		doSomething();
 	}
 }
diff --git a/examples/prism-rust.html b/examples/prism-rust.html index bd4d2c03e5..2c482ec6dd 100644 --- a/examples/prism-rust.html +++ b/examples/prism-rust.html @@ -41,16 +41,14 @@

Functions and macros

Attributes

-

-#![warn(unstable)]
+
#![warn(unstable)]
 #[test]
 fn a_test() {
 	// ...
 }

Closure parameters and bitwise OR

-

-let x = a | b;
+
let x = a | b;
 let y = c || d;
 let add_one = |x: int| -> int { 1i + x };
 let printer = || { println!("x is: {}", x); };

From 6e9bffb04f1bae3fb67829189778e107ff5c902a Mon Sep 17 00:00:00 2001
From: Golmote 
Date: Sun, 21 Dec 2014 19:48:03 +0100
Subject: [PATCH 079/137] Added apacheconf examples

---
 examples/prism-apacheconf.html | 60 ++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 examples/prism-apacheconf.html

diff --git a/examples/prism-apacheconf.html b/examples/prism-apacheconf.html
new file mode 100644
index 0000000000..2b0cc1be88
--- /dev/null
+++ b/examples/prism-apacheconf.html
@@ -0,0 +1,60 @@
+

Apache Configuration

+

To use this language, use the class "language-apacheconf".

+ +

Comments

+
# This is a comment
+# <VirtualHost *:80>
+
+ +

Directives

+
<Files .htaccess>
+	Order allow,deny
+	Deny from all
+</Files>
+
+ +

Variables

+
RewriteCond %{REQUEST_FILENAME}.php -f
+ +

Regex

+
^(.*)$
+!^www\.
+ +

Directive flags

+
[NC]
+[RC=301,L]
+ +

Strings

+
AuthName "Fichiers réservés"
+ +

Full example

+
## BASIC PASSWORD PROTECTION
+AuthType basic
+AuthName "prompt"
+AuthUserFile /.htpasswd
+AuthGroupFile /dev/null
+Require valid-user
+
+
+## ALLOW FROM IP OR VALID PASSWORD
+Require valid-user
+Allow from 192.168.1.23
+Satisfy Any
+
+
+## PROTECT FILES
+
+  Order Allow,Deny
+  Deny from all
+
+
+
+## PREVENT HOTLINKING
+SetEnvIfNoCase Referer "^http://subdomain.domain.tld/" good
+SetEnvIfNoCase Referer "^$" good
+
+   Order Deny,Allow
+   Deny from all
+   Allow from env=good
+   ErrorDocument 403 http://www.google.com/intl/en_ALL/images/logo.gif
+   ErrorDocument 403 /images/you_bad_hotlinker.gif
From 30f590560c494d7e051760e5dd37af434de4f7ce Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 21 Dec 2014 20:53:49 +0100 Subject: [PATCH 080/137] Add several examples --- examples/prism-apacheconf.html | 25 +++++----- examples/prism-applescript.html | 42 +++++++++++++++++ examples/prism-dart.html | 72 ++++++++++++++++++++++++++++ examples/prism-erlang.html | 59 +++++++++++++++++++++++ examples/prism-fortran.html | 84 +++++++++++++++++++++++++++++++++ 5 files changed, 268 insertions(+), 14 deletions(-) create mode 100644 examples/prism-fortran.html diff --git a/examples/prism-apacheconf.html b/examples/prism-apacheconf.html index 2b0cc1be88..29ac4ad4b4 100644 --- a/examples/prism-apacheconf.html +++ b/examples/prism-apacheconf.html @@ -35,26 +35,23 @@

Full example

AuthGroupFile /dev/null Require valid-user - ## ALLOW FROM IP OR VALID PASSWORD Require valid-user Allow from 192.168.1.23 Satisfy Any - ## PROTECT FILES +Order Allow,Deny +Deny from all - Order Allow,Deny - Deny from all - - +## REQUIRE SUBDOMAIN +RewriteCond %{HTTP_HOST} !^$ +RewriteCond %{HTTP_HOST} !^subdomain\.domain\.tld$ [NC] +RewriteRule ^/(.*)$ http://subdomain.domain.tld/$1 [L,R=301] -## PREVENT HOTLINKING -SetEnvIfNoCase Referer "^http://subdomain.domain.tld/" good -SetEnvIfNoCase Referer "^$" good +ErrorDocument 403 http://www.example.com/logo.gif +ErrorDocument 403 /images/you_bad_hotlinker.gif - Order Deny,Allow - Deny from all - Allow from env=good - ErrorDocument 403 http://www.google.com/intl/en_ALL/images/logo.gif - ErrorDocument 403 /images/you_bad_hotlinker.gif
+## REDIRECT UPLOADS +RewriteCond %{REQUEST_METHOD} ^(PUT|POST)$ [NC] +RewriteRule ^(.*)$ /cgi-bin/form-upload-processor.cgi?p=$1 [L,QSA]
\ No newline at end of file diff --git a/examples/prism-applescript.html b/examples/prism-applescript.html index e69de29bb2..7365cb1607 100644 --- a/examples/prism-applescript.html +++ b/examples/prism-applescript.html @@ -0,0 +1,42 @@ +

AppleScript

+

To use this language, use the class "language-applescript".

+ +

Comments

+
-- Single line comment
+#!/usr/bin/osascript
+(* Here is
+a block
+comment *)
+ +

Strings

+
"foo \"bar\" baz"
+ +

Operators

+
a ≠ b
+12 + 2 * 5
+"DUMPtruck" is equal to "dumptruck"
+"zebra" comes after "aardvark"
+{ "this", "is", 2, "cool" } starts with "this"
+{ "is", 2} is contained by { "this", "is", 2, "cool" }
+set docRef to a reference to the first document
+
+ +

Classes and units

+
tell application "Finder"
+text 1 thru 5 of "Bring me the mouse."
+set averageTemp to 63 as degrees Fahrenheit
+set circleArea to (pi * 7 * 7) as square yards
+
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Nested block comments

+
(* Nested block
+	(* comments
+	are *)
+not supported *)
\ No newline at end of file diff --git a/examples/prism-dart.html b/examples/prism-dart.html index e69de29bb2..3995802741 100644 --- a/examples/prism-dart.html +++ b/examples/prism-dart.html @@ -0,0 +1,72 @@ +

Dart

+

To use this language, use the class "language-dart".

+ +

Comments

+
// Single line comment
+/// Documentation single line comment
+/* Block comment
+on several lines */
+/** Multi-line
+doc comment */
+ +

Annotations

+
@todo('seth', 'make this do something')
+@deprecated // Metadata; makes Dart Editor warn about using activate().
+ +

Numbers

+
var x = 1;
+var hex = 0xDEADBEEF;
+var bigInt = 346534658346524376592384765923749587398457294759347029438709349347;
+var y = 1.1;
+var exponents = 1.42e5;
+
+ +

Strings

+
var s1 = 'Single quotes work well for string literals.';
+var s2 = "Double quotes work just as well.";
+var s3 = 'It\'s easy to escape the string delimiter.';
+var s4 = "It's even easier to just use the other string delimiter.";
+var s1 = '''
+You can create
+multi-line strings like this one.
+''';
+var s2 = """This is also a
+multi-line string.""";
+var s = r"In a raw string, even \n isn't special.";
+ +

Full example

+
class Logger {
+  final String name;
+  bool mute = false;
+
+  // _cache is library-private, thanks to the _ in front of its name.
+  static final Map<String, Logger> _cache = <String, Logger>{};
+
+  factory Logger(String name) {
+    if (_cache.containsKey(name)) {
+      return _cache[name];
+    } else {
+      final logger = new Logger._internal(name);
+      _cache[name] = logger;
+      return logger;
+    }
+  }
+
+  Logger._internal(this.name);
+
+  void log(String msg) {
+    if (!mute) {
+      print(msg);
+    }
+  }
+}
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Comment-like substrings

+
"foo /* bar */ baz"; "foo // bar";
\ No newline at end of file diff --git a/examples/prism-erlang.html b/examples/prism-erlang.html index e69de29bb2..f1888d84a8 100644 --- a/examples/prism-erlang.html +++ b/examples/prism-erlang.html @@ -0,0 +1,59 @@ +

Dart

+

To use this language, use the class "language-erlang".

+ +

Comments

+
% This is a comment
+%% coding: utf-8
+ +

Strings

+
"foo \"bar\" baz"
+ +

Numbers

+
42.
+$A.
+$\n.
+2#101.
+16#1f.
+2.3.
+2.3e3.
+2.3e-3.
+ +

Functions

+
P = spawn(m, loop, []).
+io:format("I am ~p~n", [self()]).
+'weird function'().
+
+ +

Variables

+
P = {adam,24,{july,29}}.
+M1 = #{name=>adam,age=>24,date=>{july,29}}.
+M2 = maps:update(age,25,M1).
+ +

Operators

+
1==1.0.
+1=:=1.0.
+1 > a.
++1.
+-1.
+1+1.
+4/2.
+5 div 2.
+5 rem 2.
+2#10 band 2#01.
+2#10 bor 2#01.
+a + 10.
+1 bsl (1 bsl 64).
+not true.
+true and false.
+true xor false.
+true or garbage.
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Comment-like substrings

+
"foo % bar";
\ No newline at end of file diff --git a/examples/prism-fortran.html b/examples/prism-fortran.html new file mode 100644 index 0000000000..41be788c17 --- /dev/null +++ b/examples/prism-fortran.html @@ -0,0 +1,84 @@ +

Fortran

+

To use this language, use the class "language-fortran".

+ +

Comments

+
! This is a comment
+ +

Strings

+
"foo 'bar' baz"
+'foo ''bar'' baz'
+''
+ITALICS_'This is in italics'
+"test &
+	! Some "tricky comment" here
+	&test"
+ +

Numbers

+
473
++56
+-101
+21_2
+21_SHORT
+1976354279568241_8
+B'01110'
+B"010"
+O'047'
+O"642"
+Z'F41A'
+Z"00BC"
+-12.78
++1.6E3
+2.1
+-16.E4_8
+0.45E-4
+10.93E7_QUAD
+.123
+3E4
+ +

Full example

+
MODULE MOD1
+TYPE INITIALIZED_TYPE
+	INTEGER :: I = 1 ! Default initialization
+END TYPE INITIALIZED_TYPE
+SAVE :: SAVED1, SAVED2
+INTEGER :: SAVED1, UNSAVED1
+TYPE(INITIALIZED_TYPE) :: SAVED2, UNSAVED2
+ALLOCATABLE :: SAVED1(:), SAVED2(:), UNSAVED1(:), UNSAVED2(:)
+END MODULE MOD1
+	
+PROGRAM MAIN
+CALL SUB1 ! The values returned by the ALLOCATED intrinsic calls
+          ! in the PRINT statement are:
+          ! .FALSE., .FALSE., .FALSE., and .FALSE.
+          ! Module MOD1 is used, and its variables are allocated.
+          ! After return from the subroutine, whether the variables
+          ! which were not specified with the SAVE attribute
+          ! retain their allocation status is processor dependent.
+CALL SUB1 ! The values returned by the first two ALLOCATED intrinsic
+	      ! calls in the PRINT statement are:
+	      ! .TRUE., .TRUE.
+	      ! The values returned by the second two ALLOCATED
+	      ! intrinsic calls in the PRINT statement are
+	      ! processor dependent and each could be either
+	      ! .TRUE. or .FALSE.
+CONTAINS
+	SUBROUTINE SUB1
+	USE MOD1 ! Brings in saved and not saved variables.
+	PRINT *, ALLOCATED(SAVED1), ALLOCATED(SAVED2), &
+	         ALLOCATED(UNSAVED1), ALLOCATED(UNSAVED2)
+	IF (.NOT. ALLOCATED(SAVED1)) ALLOCATE(SAVED1(10))
+	IF (.NOT. ALLOCATED(SAVED2)) ALLOCATE(SAVED2(10))
+	IF (.NOT. ALLOCATED(UNSAVED1)) ALLOCATE(UNSAVED1(10))
+	IF (.NOT. ALLOCATED(UNSAVED2)) ALLOCATE(UNSAVED2(10))
+	END SUBROUTINE SUB1
+END PROGRAM MAIN
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Commented string

+
! This "string" should not be highlighted
\ No newline at end of file From 63563e5a7ebc5f7b1f96a949a74c1df66cdc52ef Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 21 Dec 2014 21:18:22 +0100 Subject: [PATCH 081/137] Improved examples --- examples/prism-erlang.html | 5 +++-- examples/prism-fortran.html | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/prism-erlang.html b/examples/prism-erlang.html index f1888d84a8..c02b60f229 100644 --- a/examples/prism-erlang.html +++ b/examples/prism-erlang.html @@ -1,4 +1,4 @@ -

Dart

+

Erlang

To use this language, use the class "language-erlang".

Comments

@@ -27,7 +27,8 @@

Functions

Variables

P = {adam,24,{july,29}}.
 M1 = #{name=>adam,age=>24,date=>{july,29}}.
-M2 = maps:update(age,25,M1).
+M2 = maps:update(age,25,M1). +io:format("{~p,~p}: ~p~n", [?MODULE,?LINE,X]).

Operators

1==1.0.
diff --git a/examples/prism-fortran.html b/examples/prism-fortran.html
index 41be788c17..12e9c2070b 100644
--- a/examples/prism-fortran.html
+++ b/examples/prism-fortran.html
@@ -45,7 +45,7 @@ 

Full example

TYPE(INITIALIZED_TYPE) :: SAVED2, UNSAVED2 ALLOCATABLE :: SAVED1(:), SAVED2(:), UNSAVED1(:), UNSAVED2(:) END MODULE MOD1 - + PROGRAM MAIN CALL SUB1 ! The values returned by the ALLOCATED intrinsic calls ! in the PRINT statement are: From 6600faa9fbf96ab5c3f1b929572fa02720c76f9b Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 21 Dec 2014 21:19:18 +0100 Subject: [PATCH 082/137] Fix quoted functions and atoms in erlang --- components/prism-erlang.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/components/prism-erlang.js b/components/prism-erlang.js index 77adbd392d..deea6aa054 100644 --- a/components/prism-erlang.js +++ b/components/prism-erlang.js @@ -1,23 +1,23 @@ Prism.languages.erlang = { 'comment': /%.+/, 'string': /"(?:\\?.)*?"/, + 'quoted-function': { + pattern: /'[^']+'(?=\()/, + alias: 'function' + }, 'quoted-atom': { pattern: /'[^']+'/, alias: 'atom' }, 'boolean': /\b(?:true|false)\b/, 'keyword': /\b(?:fun|when|case|of|end|if|receive|after|try|catch)\b/, - 'function': /(?:\b[a-z][\w@]*|'[^']+')(?=\()/, - 'variable': /(?:\b|\?)[A-Z_][\w@]*/, - 'atom': { - pattern: /(^|(?!\$).)\b[a-z][\w@]*/, - lookbehind: true - }, 'number': [ /\$\\?./, /\d+#[a-z0-9]+/i, /(?:\b|-)\d*\.?\d+([Ee][+-]?\d+)?\b/ ], + 'function': /\b[a-z][\w@]*(?=\()/, + 'variable': /(?:\b|\?)[A-Z_][\w@]*/, 'operator': [ /[=\/>:]=|>=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/, { @@ -29,6 +29,7 @@ Prism.languages.erlang = { lookbehind: true } ], + 'atom': /\b[a-z][\w@]*/, 'punctuation': /[()[\]{}:;,.#|]|<<|>>/ }; \ No newline at end of file From c326b9ec63e78aba06ccc41751015cd72924ae20 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 21 Dec 2014 21:19:36 +0100 Subject: [PATCH 083/137] Fix quoted numbers in Fortran --- components/prism-fortran.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/prism-fortran.js b/components/prism-fortran.js index 9285c8baa9..6448dad2e2 100644 --- a/components/prism-fortran.js +++ b/components/prism-fortran.js @@ -1,4 +1,8 @@ Prism.languages.fortran = { + 'quoted-number': { + pattern: /[BOZ](['"])[A-F0-9]+\1/i, + alias: 'number' + }, 'string': { pattern: /(?:\w+_)?(['"])(?:\1\1|&\n(?:\s*!.+\n)?|(?!\1).)*(?:\1|&)/, inside: { @@ -7,11 +11,7 @@ Prism.languages.fortran = { }, 'comment': /!.*/, 'boolean': /\.(?:TRUE|FALSE)\.(?:_\w+)?/i, - 'number': [ - /[BO](['"])\d+\1/i, - /Z(['"])[A-F0-9]+\1/i, - /(?:\b|[+-])(?:\d+(?:\.\d*)?|\.\d+)(?:[ED][+-]?\d+)?(?:_\w+)?/i - ], + 'number': /(?:\b|[+-])(?:\d+(?:\.\d*)?|\.\d+)(?:[ED][+-]?\d+)?(?:_\w+)?/i, 'keyword': [ // Types /\b(?:INTEGER|REAL|DOUBLE ?PRECISION|COMPLEX|CHARACTER|LOGICAL)\b/i, From 8994ef0b03251772169502437ab63c3236010d60 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 21 Dec 2014 21:28:54 +0100 Subject: [PATCH 084/137] Simplified regexps in Eiffel --- components/prism-eiffel.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/components/prism-eiffel.js b/components/prism-eiffel.js index 2c387c6e33..2647c6e352 100644 --- a/components/prism-eiffel.js +++ b/components/prism-eiffel.js @@ -1,23 +1,23 @@ Prism.languages.eiffel = { 'string': [ - // Aligned-verbatim-strings (verbatim option not supported) - /"\[(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)*?]"/g, - // Non-aligned-verbatim-strings (verbatim option not supported) - /"\{(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)*?}"/g, + // Aligned-verbatim-strings + /"([^[]*)\[[\s\S]+?\]\1"/, + // Non-aligned-verbatim-strings + /"([^{]*)\{[\s\S]+?\}\1"/, // Single-line string - /"(?:[^%\b\f\n\r\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)*?"/g + /"(?:%\s+%|%"|.)*?"/ ], // (comments including quoted strings not supported) 'comment': /--.*/, // normal char | special char | char code - 'char': /'(?:[^%\b\f\n\r\t\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)'/g, + 'char': /'(?:%'|.)+?'/, 'keyword': /\b(?:across|agent|alias|all|and|attached|as|assign|attribute|check|class|convert|create|Current|debug|deferred|detachable|do|else|elseif|end|ensure|expanded|export|external|feature|from|frozen|if|implies|inherit|inspect|invariant|like|local|loop|not|note|obsolete|old|once|or|Precursor|redefine|rename|require|rescue|Result|retry|select|separate|some|then|undefine|until|variant|Void|when|xor)\b/gi, 'boolean': /\b(?:True|False)\b/gi, 'number': [ // hexa | octal | bin - /\b0(?:[xX][\da-fA-F](?:_*[\da-fA-F])*|[cC][0-7](?:_*[0-7])*|[bB][01](?:_*[01])*)\b/g, + /\b0[xcb][\da-f](?:_*[\da-f])*\b/ig, // Decimal - /(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/g, + /(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/g ], 'punctuation': /:=|<<|>>|\(\||\|\)|->|\.(?=\w)|[{}[\];(),:?]/g, 'operator': /\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[-+*^=~]/g From e64fe6c166803a1d6f0f26849a1227ec08f387ce Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 21 Dec 2014 21:29:23 +0100 Subject: [PATCH 085/137] Run gulp --- components/prism-eiffel.min.js | 2 +- components/prism-erlang.min.js | 2 +- components/prism-fortran.min.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/prism-eiffel.min.js b/components/prism-eiffel.min.js index 502594dfa0..31f5369527 100644 --- a/components/prism-eiffel.min.js +++ b/components/prism-eiffel.min.js @@ -1 +1 @@ -Prism.languages.eiffel={string:[/"\[(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)*?]"/g,/"\{(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)*?}"/g,/"(?:[^%\b\f\n\r\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)*?"/g],comment:/--.*/,"char":/'(?:[^%\b\f\n\r\t\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)'/g,keyword:/\b(?:across|agent|alias|all|and|attached|as|assign|attribute|check|class|convert|create|Current|debug|deferred|detachable|do|else|elseif|end|ensure|expanded|export|external|feature|from|frozen|if|implies|inherit|inspect|invariant|like|local|loop|not|note|obsolete|old|once|or|Precursor|redefine|rename|require|rescue|Result|retry|select|separate|some|then|undefine|until|variant|Void|when|xor)\b/gi,"boolean":/\b(?:True|False)\b/gi,number:[/\b0(?:[xX][\da-fA-F](?:_*[\da-fA-F])*|[cC][0-7](?:_*[0-7])*|[bB][01](?:_*[01])*)\b/g,/(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/g],punctuation:/:=|<<|>>|\(\||\|\)|->|\.(?=\w)|[{}[\];(),:?]/g,operator:/\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[-+*^=~]/g}; \ No newline at end of file +Prism.languages.eiffel={string:[/"([^[]*)\[[\s\S]+?\]\1"/,/"([^{]*)\{[\s\S]+?\}\1"/,/"(?:%\s+%|%"|.)*?"/],comment:/--.*/,"char":/'(?:%'|.)+?'/,keyword:/\b(?:across|agent|alias|all|and|attached|as|assign|attribute|check|class|convert|create|Current|debug|deferred|detachable|do|else|elseif|end|ensure|expanded|export|external|feature|from|frozen|if|implies|inherit|inspect|invariant|like|local|loop|not|note|obsolete|old|once|or|Precursor|redefine|rename|require|rescue|Result|retry|select|separate|some|then|undefine|until|variant|Void|when|xor)\b/gi,"boolean":/\b(?:True|False)\b/gi,number:[/\b0[xcb][\da-f](?:_*[\da-f])*\b/gi,/(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/g],punctuation:/:=|<<|>>|\(\||\|\)|->|\.(?=\w)|[{}[\];(),:?]/g,operator:/\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[-+*^=~]/g}; \ No newline at end of file diff --git a/components/prism-erlang.min.js b/components/prism-erlang.min.js index 85d3653be7..6a072b6296 100644 --- a/components/prism-erlang.min.js +++ b/components/prism-erlang.min.js @@ -1 +1 @@ -Prism.languages.erlang={comment:/%.+/,string:/"(?:\\?.)*?"/,"quoted-atom":{pattern:/'[^']+'/,alias:"atom"},"boolean":/\b(?:true|false)\b/,keyword:/\b(?:fun|when|case|of|end|if|receive|after|try|catch)\b/,"function":/(?:\b[a-z][\w@]*|'[^']+')(?=\()/,variable:/(?:\b|\?)[A-Z_][\w@]*/,atom:{pattern:/(^|(?!\$).)\b[a-z][\w@]*/,lookbehind:!0},number:[/\$\\?./,/\d+#[a-z0-9]+/i,/(?:\b|-)\d*\.?\d+([Ee][+-]?\d+)?\b/],operator:[/[=\/>:]=|>=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/,{pattern:/(^|(?!<).)<(?!<)/,lookbehind:!0},{pattern:/(^|(?!>).)>(?!>)/,lookbehind:!0}],punctuation:/[()[\]{}:;,.#|]|<<|>>/}; \ No newline at end of file +Prism.languages.erlang={comment:/%.+/,string:/"(?:\\?.)*?"/,"quoted-function":{pattern:/'[^']+'(?=\()/,alias:"function"},"quoted-atom":{pattern:/'[^']+'/,alias:"atom"},"boolean":/\b(?:true|false)\b/,keyword:/\b(?:fun|when|case|of|end|if|receive|after|try|catch)\b/,number:[/\$\\?./,/\d+#[a-z0-9]+/i,/(?:\b|-)\d*\.?\d+([Ee][+-]?\d+)?\b/],"function":/\b[a-z][\w@]*(?=\()/,variable:/(?:\b|\?)[A-Z_][\w@]*/,operator:[/[=\/>:]=|>=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/,{pattern:/(^|(?!<).)<(?!<)/,lookbehind:!0},{pattern:/(^|(?!>).)>(?!>)/,lookbehind:!0}],atom:/\b[a-z][\w@]*/,punctuation:/[()[\]{}:;,.#|]|<<|>>/}; \ No newline at end of file diff --git a/components/prism-fortran.min.js b/components/prism-fortran.min.js index b0932be3d5..407cc9603c 100644 --- a/components/prism-fortran.min.js +++ b/components/prism-fortran.min.js @@ -1 +1 @@ -Prism.languages.fortran={string:{pattern:/(?:\w+_)?(['"])(?:\1\1|&\n(?:\s*!.+\n)?|(?!\1).)*(?:\1|&)/,inside:{comment:/!.*/}},comment:/!.*/,"boolean":/\.(?:TRUE|FALSE)\.(?:_\w+)?/i,number:[/[BO](['"])\d+\1/i,/Z(['"])[A-F0-9]+\1/i,/(?:\b|[+-])(?:\d+(?:\.\d*)?|\.\d+)(?:[ED][+-]?\d+)?(?:_\w+)?/i],keyword:[/\b(?:INTEGER|REAL|DOUBLE ?PRECISION|COMPLEX|CHARACTER|LOGICAL)\b/i,/\b(?:ALLOCATABLE|ALLOCATE|BACKSPACE|CALL|CASE|CLOSE|COMMON|CONTAINS|CONTINUE|CYCLE|DATA|DEALLOCATE|DIMENSION|DO|END|EQUIVALENCE|EXIT|EXTERNAL|FORMAT|GO ?TO|IMPLICIT(?: NONE)?|INQUIRE|INTENT|INTRINSIC|MODULE PROCEDURE|NAMELIST|NULLIFY|OPEN|OPTIONAL|PARAMETER|POINTER|PRINT|PRIVATE|PUBLIC|READ|RETURN|REWIND|SAVE|SELECT|STOP|TARGET|WHILE|WRITE)\b/i,/\b(?:END ?)?(?:BLOCK ?DATA|DO|FILE|FORALL|FUNCTION|IF|INTERFACE|MODULE|PROGRAM|SELECT|SUBROUTINE|TYPE|WHERE)\b/i,/\b(?:ASSIGNMENT|DEFAULT|ELEMENTAL|ELSE|ELSEWHERE|ELSEIF|ENTRY|IN|INCLUDE|INOUT|KIND|NULL|ONLY|OPERATOR|OUT|PURE|RECURSIVE|RESULT|SEQUENCE|STAT|THEN|USE)\b/i],operator:[/\*\*|\/\/|=>|[=\/]=|[<>]=?|::|[+\-*=%]|\.(?:EQ|NE|LT|LE|GT|GE|NOT|AND|OR|EQV|NEQV)\.|\.[A-Z]+\./i,{pattern:/(^|(?!\().)\/(?!\))/,lookbehind:!0}],punctuation:/\(\/|\/\)|[(),;:&]/}; \ No newline at end of file +Prism.languages.fortran={"quoted-number":{pattern:/[BOZ](['"])[A-F0-9]+\1/i,alias:"number"},string:{pattern:/(?:\w+_)?(['"])(?:\1\1|&\n(?:\s*!.+\n)?|(?!\1).)*(?:\1|&)/,inside:{comment:/!.*/}},comment:/!.*/,"boolean":/\.(?:TRUE|FALSE)\.(?:_\w+)?/i,number:/(?:\b|[+-])(?:\d+(?:\.\d*)?|\.\d+)(?:[ED][+-]?\d+)?(?:_\w+)?/i,keyword:[/\b(?:INTEGER|REAL|DOUBLE ?PRECISION|COMPLEX|CHARACTER|LOGICAL)\b/i,/\b(?:ALLOCATABLE|ALLOCATE|BACKSPACE|CALL|CASE|CLOSE|COMMON|CONTAINS|CONTINUE|CYCLE|DATA|DEALLOCATE|DIMENSION|DO|END|EQUIVALENCE|EXIT|EXTERNAL|FORMAT|GO ?TO|IMPLICIT(?: NONE)?|INQUIRE|INTENT|INTRINSIC|MODULE PROCEDURE|NAMELIST|NULLIFY|OPEN|OPTIONAL|PARAMETER|POINTER|PRINT|PRIVATE|PUBLIC|READ|RETURN|REWIND|SAVE|SELECT|STOP|TARGET|WHILE|WRITE)\b/i,/\b(?:END ?)?(?:BLOCK ?DATA|DO|FILE|FORALL|FUNCTION|IF|INTERFACE|MODULE|PROGRAM|SELECT|SUBROUTINE|TYPE|WHERE)\b/i,/\b(?:ASSIGNMENT|DEFAULT|ELEMENTAL|ELSE|ELSEWHERE|ELSEIF|ENTRY|IN|INCLUDE|INOUT|KIND|NULL|ONLY|OPERATOR|OUT|PURE|RECURSIVE|RESULT|SEQUENCE|STAT|THEN|USE)\b/i],operator:[/\*\*|\/\/|=>|[=\/]=|[<>]=?|::|[+\-*=%]|\.(?:EQ|NE|LT|LE|GT|GE|NOT|AND|OR|EQV|NEQV)\.|\.[A-Z]+\./i,{pattern:/(^|(?!\().)\/(?!\))/,lookbehind:!0}],punctuation:/\(\/|\/\)|[(),;:&]/}; \ No newline at end of file From 00068402acb94104df0ebf6987e34c4cfa39ce65 Mon Sep 17 00:00:00 2001 From: Golmote Date: Mon, 22 Dec 2014 08:59:49 +0100 Subject: [PATCH 086/137] Added bash, Jade, Less, SQL and Twig examples --- examples/prism-bash.html | 36 ++++++++++++++++ examples/prism-jade.html | 88 ++++++++++++++++++++++++++++++++++++++++ examples/prism-less.html | 73 +++++++++++++++++++++++++++++++++ examples/prism-sql.html | 37 +++++++++++++++++ examples/prism-twig.html | 30 ++++++++++++++ 5 files changed, 264 insertions(+) create mode 100644 examples/prism-bash.html create mode 100644 examples/prism-jade.html create mode 100644 examples/prism-less.html create mode 100644 examples/prism-sql.html create mode 100644 examples/prism-twig.html diff --git a/examples/prism-bash.html b/examples/prism-bash.html new file mode 100644 index 0000000000..c92f8b1b99 --- /dev/null +++ b/examples/prism-bash.html @@ -0,0 +1,36 @@ +

Bash

+

To use this language, use the class "language-bash".

+ +

Shebang

+
#!/bin/bash
+#!/bin/sh
+ +

Comments

+
# This is a comment
+ +

Strings

+
STRING="Hello World"
+'Single and
+multi-line strings are supported.'
+"Single and
+multi-line strings are supported."
+ +

Variables

+
echo $STRING
+args=("$@")
+echo ${args[0]} ${args[1]} ${args[2]}
+ +

Keywords

+
for (( i=0;i<$ELEMENTS;i++)); do
+	echo ${ARRAY[${i}]}
+done
+while read LINE; do
+    ARRAY[$count]=$LINE
+    ((count++))
+done
+if [ -d $directory ]; then
+	echo "Directory exists"
+else
+	echo "Directory does not exists"
+fi
+
\ No newline at end of file diff --git a/examples/prism-jade.html b/examples/prism-jade.html new file mode 100644 index 0000000000..1b68125d91 --- /dev/null +++ b/examples/prism-jade.html @@ -0,0 +1,88 @@ +

Jade

+

To use this language, use the class "language-jade".

+ +

Comments

+
// Some
+  multiline
+  comment !
+
+// This is a comment
+But this is not
+ +

Doctype

+
doctype html
+doctype 1.1
+doctype html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN"
+ +

Tags

+
ul
+  li Item A
+  li Item B
+  li Item C
+foo(bar='baz')/
+input(type='checkbox', checked=true.toString())
+#content
+div#foo(data-bar="foo")&attributes({'data-foo': 'bar'})
+ +

Markup

+
<div class="foo bar"></div>
+ +

Flow control

+
#user
+  if user.description
+    p.description= user.description
+  else if authorised
+    p.description.
+      User has no description,
+      why not add one...
+  else
+    p.description User has no description
+ul
+  each val in [1, 2, 3, 4, 5]
+    li= val
+case friends
+  when 0
+    p you have no friends
+  when 1
+    p you have a friend
+  default
+    p you have #{friends} friends
+
+ +

Inline JavaScript

+
script alert('test');
+script(type="text/javascript").
+  alert('foo');
+  alert('bar');
+- var classes = ['foo', 'bar', 'baz']
+- for (var x = 0; x < 3; x++)
+  li item
+
+ +

Keywords

+
include ./includes/head.jade
+extends ./layout.jade
+block content
+append head
+ +

Mixins

+
mixin list
+  ul
+    li foo
+    li bar
+    li baz
++list
+mixin pet(name)
+  li.pet= name
+ul
+  +pet('cat')
+  +pet('dog')
+
+ +

Filters

+

Filters require the desired language to be loaded. +On this page, check CoffeeScript before checking Jade should make +the example below work properly.

+
script
+  :coffee
+    console.log 'This is coffee script'
\ No newline at end of file diff --git a/examples/prism-less.html b/examples/prism-less.html new file mode 100644 index 0000000000..c84bc68287 --- /dev/null +++ b/examples/prism-less.html @@ -0,0 +1,73 @@ +

Less

+

To use this language, use the class "language-less".

+ +

Comments

+
// Single line comment
+/* Multi-line
+comment */
+ +

Variables

+
@nice-blue: #5B83AD;
+@light-blue: @nice-blue + #111;
+ +

At-rules

+
@media screen and (min-width: 320px) {}
+ +

Mixins

+
.bordered {
+  border-top: dotted 1px black;
+  border-bottom: solid 2px black;
+}
+#menu a {
+  .bordered;
+}
+#header a {
+  color: orange;
+  #bundle > .button;
+}
+ +

Mixins with parameters

+
.foo (@bg: #f5f5f5, @color: #900) {
+  background: @bg;
+  color: @color;
+}
+.bar {
+  .foo();
+}
+.class1 {
+  .mixin(@margin: 20px; @color: #33acfe);
+}
+.class2 {
+  .mixin(#efca44; @padding: 40px);
+}
+ +

Interpolation

+
@mySelector: banner;
+.@{mySelector} {
+  font-weight: bold;
+}
+@property: color;
+.widget {
+  @{property}: #0ee;
+  background-@{property}: #999;
+}
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

At-rules looking like variables

+
@import "some file.less";
+ +

At-rules containing interpolation

+
@import "@{themes}/tidal-wave.less";
+ +

extend is not highlighted consistently

+
nav ul {
+  &:extend(.inline);
+  background: blue;
+}
+.a:extend(.b) {}
\ No newline at end of file diff --git a/examples/prism-sql.html b/examples/prism-sql.html new file mode 100644 index 0000000000..f26706ef9f --- /dev/null +++ b/examples/prism-sql.html @@ -0,0 +1,37 @@ +

SQL

+

To use this language, use the class "language-sql".

+ +

Comments

+
# Single line comment
+-- Single line comment
+// Single line comment
+/* Multi-line
+comment */
+ +

Strings

+
"foo \"bar\" baz"
+'foo \'bar\' baz'
+"Multi-line strings
+are supported"
+'Multi-line strings
+are supported'
+ +

Variables

+
SET @variable = 1;
+SET @$_ = 2;
+SET @"quoted-variable" = 3;
+SET @'quoted-variable' = 3;
+SET @`quoted-variable` = 3;
+ +

Operators

+
SELECT 1 && 1;
+SELECT 1 OR NULL;
+SELECT 5 & ~1;
+SELECT 2 BETWEEN 1 AND 3;
+ +

Functions and keywords

+
SELECT COUNT(*) AS cpt,
+FROM `table`
+LEFT JOIN `other_table` AS t
+WHERE `somecol` IS NOT NULL
+ORDER BY t.other_col DESC
diff --git a/examples/prism-twig.html b/examples/prism-twig.html new file mode 100644 index 0000000000..4ed93bfab0 --- /dev/null +++ b/examples/prism-twig.html @@ -0,0 +1,30 @@ +

Twig

+

To use this language, use the class "language-twig".

+ +

Comments

+
{# Some comment
+on multiple lines
+with <html></html>
+inside #}
+ +

Keywords

+
{% if foo %} bar {% endif %}
+{% for key, value in arr if value %} {{ do_something() }} {% endfor %}
+{% include 'header.html' %}
+{% include 'template.html' with {'foo': 'bar'} %}
+ +

Operators

+
{{ not a }}
+{{ 20 // 7 }}
+{{ b b-and c }}
+{% if phone matches '/^[\\d\\.]+$/' %} ... {% endif %}
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Tag containing Twig is not highlighted

+
<div{% if foo %} class="bar"{% endif %}></div>
\ No newline at end of file From 49a1467b236073850a701ca429c5018d1025eda9 Mon Sep 17 00:00:00 2001 From: Golmote Date: Mon, 22 Dec 2014 09:14:46 +0100 Subject: [PATCH 087/137] Add CoffeeScript examples + fix others --- examples/prism-bash.html | 3 +- examples/prism-coffeescript.html | 64 ++++++++++++++++++++++++++++++++ examples/prism-sql.html | 6 +-- 3 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 examples/prism-coffeescript.html diff --git a/examples/prism-bash.html b/examples/prism-bash.html index c92f8b1b99..fddd87507c 100644 --- a/examples/prism-bash.html +++ b/examples/prism-bash.html @@ -2,8 +2,7 @@

Bash

To use this language, use the class "language-bash".

Shebang

-
#!/bin/bash
-#!/bin/sh
+
#!/bin/bash

Comments

# This is a comment
diff --git a/examples/prism-coffeescript.html b/examples/prism-coffeescript.html new file mode 100644 index 0000000000..8835469e50 --- /dev/null +++ b/examples/prism-coffeescript.html @@ -0,0 +1,64 @@ +

CoffeeScript

+

To use this language, use the class "language-coffeescript".

+ +

Comments

+
# This is a comment
+### This is a
+multi-line comment###
+ +

Strings

+
'foo \'bar\' baz'
+	"foo \"bar\" baz"
+'Multi-line
+strings are supported'
+"Multi-line
+strings are supported"
+''' 'Block strings'
+are supported too'''
+""" "Block strings"
+are supported too"""
+ +

String interpolation

+
"String #{interpolation} is supported"
+'This works #{only} between double-quoted strings'
+ +

Object properties

+
kids =
+  brother:
+    name: "Max"
+    age:  11
+  sister:
+    name: "Ida"
+    age:  9
+ +

Regexps

+
/normal [r]egexp?/;
+/// ^(
+  mul\t[i-l]ine
+  regexp          # with embedded comment
+) ///
+ +

Classes

+
class Animal
+  constructor: (@name) ->
+  move: (meters) ->
+    alert @name + " moved #{meters}m."
+
+class Snake extends Animal
+  move: ->
+    alert "Slithering..."
+    super 5
+
+class Horse extends Animal
+  move: ->
+    alert "Galloping..."
+    super 45
+
+sam = new Snake "Sammy the Python"
+tom = new Horse "Tommy the Palomino"
+
+sam.move()
+tom.move()
+ +

Inline JavaScript

+
`alert("foo")`
\ No newline at end of file diff --git a/examples/prism-sql.html b/examples/prism-sql.html index f26706ef9f..5de33877a8 100644 --- a/examples/prism-sql.html +++ b/examples/prism-sql.html @@ -26,12 +26,12 @@

Variables

Operators

SELECT 1 && 1;
 SELECT 1 OR NULL;
-SELECT 5 & ~1;
+SELECT 5 & 2*3;
 SELECT 2 BETWEEN 1 AND 3;

Functions and keywords

-
SELECT COUNT(*) AS cpt,
-FROM `table`
+
SELECT COUNT(*) AS cpt, MAX(t.pos) AS max_pos
+FROM `my_table`
 LEFT JOIN `other_table` AS t
 WHERE `somecol` IS NOT NULL
 ORDER BY t.other_col DESC
From 95ef3dae3c8519ad64d1c591ce1e9c8fbc1a7e05 Mon Sep 17 00:00:00 2001 From: Golmote Date: Mon, 22 Dec 2014 09:18:36 +0100 Subject: [PATCH 088/137] Fixed spacing --- examples/prism-coffeescript.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/prism-coffeescript.html b/examples/prism-coffeescript.html index 8835469e50..8d7537bef9 100644 --- a/examples/prism-coffeescript.html +++ b/examples/prism-coffeescript.html @@ -8,7 +8,7 @@

Comments

Strings

'foo \'bar\' baz'
-	"foo \"bar\" baz"
+"foo \"bar\" baz"
 'Multi-line
 strings are supported'
 "Multi-line

From 4166b2fdd2b701b67b7cad78eb1de9b7a1e52555 Mon Sep 17 00:00:00 2001
From: Golmote 
Date: Mon, 22 Dec 2014 21:27:03 +0100
Subject: [PATCH 089/137] Add support for single quoted multi-line strings in
 Python

---
 components/prism-python.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/components/prism-python.js b/components/prism-python.js
index 4ba15fa568..34d44c6ba7 100644
--- a/components/prism-python.js
+++ b/components/prism-python.js
@@ -3,7 +3,7 @@ Prism.languages.python= {
 		pattern: /(^|[^\\])#.*?(\r?\n|$)/g,
 		lookbehind: true
 	},
-	'string': /"""[\s\S]+?"""|("|')(\\?.)*?\1/g,
+	'string': /"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(\\?.)*?\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,

From 081e6026f23e5565b8c1a8f089d9ac8fa27b16a6 Mon Sep 17 00:00:00 2001
From: Golmote 
Date: Mon, 22 Dec 2014 21:28:11 +0100
Subject: [PATCH 090/137] Add support for single quoted multi-line strings in
 Python

---
 components/prism-python.min.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/components/prism-python.min.js b/components/prism-python.min.js
index eb858af183..566137894e 100644
--- a/components/prism-python.min.js
+++ b/components/prism-python.min.js
@@ -1 +1 @@
-Prism.languages.python={comment:{pattern:/(^|[^\\])#.*?(\r?\n|$)/g,lookbehind:!0},string:/"""[\s\S]+?"""|("|')(\\?.)*?\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};
\ No newline at end of file
+Prism.languages.python={comment:{pattern:/(^|[^\\])#.*?(\r?\n|$)/g,lookbehind:!0},string:/"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(\\?.)*?\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};
\ No newline at end of file

From a1747745a4509d9b01ce60d91a043b410395de57 Mon Sep 17 00:00:00 2001
From: Golmote 
Date: Mon, 22 Dec 2014 22:15:56 +0100
Subject: [PATCH 091/137] Add examples for Git, HTTP, LOLCODE, MATLAB, Perl,
 Python and Ruby

---
 examples/prism-git.html     | 13 ++++++
 examples/prism-http.html    | 36 +++++++++++++++
 examples/prism-jade.html    |  2 +-
 examples/prism-lolcode.html | 65 +++++++++++++++++++++++++++
 examples/prism-matlab.html  | 66 +++++++++++++++++++++++++++
 examples/prism-perl.html    | 90 +++++++++++++++++++++++++++++++++++++
 examples/prism-python.html  | 64 ++++++++++++++++++++++++++
 examples/prism-ruby.html    | 46 +++++++++++++++++++
 8 files changed, 381 insertions(+), 1 deletion(-)
 create mode 100644 examples/prism-git.html
 create mode 100644 examples/prism-http.html
 create mode 100644 examples/prism-lolcode.html
 create mode 100644 examples/prism-matlab.html
 create mode 100644 examples/prism-perl.html
 create mode 100644 examples/prism-python.html
 create mode 100644 examples/prism-ruby.html

diff --git a/examples/prism-git.html b/examples/prism-git.html
new file mode 100644
index 0000000000..c705c9d2ac
--- /dev/null
+++ b/examples/prism-git.html
@@ -0,0 +1,13 @@
+

Git

+

To use this language, use the class "language-git".

+ +

Comments

+
# On branch prism-examples
+# Changes to be committed:
+#   (use "git reset HEAD <file>..." to unstage)
+#
+#       new file:   examples/prism-git.html
+ +

Inserted and deleted lines

+
- Some deleted line
++ Some added line
diff --git a/examples/prism-http.html b/examples/prism-http.html new file mode 100644 index 0000000000..38419791e4 --- /dev/null +++ b/examples/prism-http.html @@ -0,0 +1,36 @@ +

HTTP

+

To use this language, use the class "language-http".

+ +

Request header

+
GET http://localhost:9999/foo.html HTTP/1.1
+Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
+Accept-Encoding: gzip, deflate
+ +

Response header

+
HTTP/1.1 200 OK
+Server: GitHub.com
+Date: Mon, 22 Dec 2014 18:25:30 GMT
+Content-Type: text/html; charset=utf-8
+ +

Response body highlighted based on Content-Type

+

This currently supports the following content types : + "application/json", + "application/xml", + "text/xml" and + "text/html".

+
HTTP/1.1 200 OK
+Server: GitHub.com
+Date: Mon, 22 Dec 2014 18:25:30 GMT
+Content-Type: text/html; charset=utf-8
+Last-Modified: Sun, 21 Dec 2014 20:29:48 GMT
+Transfer-Encoding: chunked
+Expires: Mon, 22 Dec 2014 18:35:30 GMT
+Cache-Control: max-age=600
+Vary: Accept-Encoding
+Content-Encoding: gzip
+
+<!DOCTYPE html>
+<html lang="en">
+<head></head>
+<body></body>
+</html>
\ No newline at end of file diff --git a/examples/prism-jade.html b/examples/prism-jade.html index 1b68125d91..4b7661f90c 100644 --- a/examples/prism-jade.html +++ b/examples/prism-jade.html @@ -27,7 +27,7 @@

Tags

Markup

<div class="foo bar"></div>
-

Flow control

+

Control flow

#user
   if user.description
     p.description= user.description
diff --git a/examples/prism-lolcode.html b/examples/prism-lolcode.html
new file mode 100644
index 0000000000..b94ef5f8f8
--- /dev/null
+++ b/examples/prism-lolcode.html
@@ -0,0 +1,65 @@
+

LOLCODE

+

To use this language, use the class "language-lolcode".

+ +

Comments

+
BTW Single line comment
+OBTW Multi-line
+comment TLDR
+ +

Strings and special characters

+
"foo :"bar:" baz"
+"foo:)bar:>baz"
+"Interpolation :{works} too!"
+ +

Numbers

+
42
+-42
+123.456
+ +

Variable declaration

+
I HAS A var
+var R "THREE"
+var R 3
+ +

Types

+
MAEK some_expr A YARN
+some_var IS NOW A NUMBR
+ +

Full example

+
OBTW Convert a number to hexadecimal. This
+     is returned as a string.
+TLDR
+HOW IZ I decimal_to_hex YR num
+    I HAS A i ITZ 0
+    I HAS A rem
+    I HAS A hex_num ITZ A BUKKIT
+    I HAS A decimal_num ITZ num
+    IM IN YR num_loop
+        rem R MOD OF decimal_num AN 16
+        I HAS A hex_digit
+        rem, WTF?
+            OMG 10, hex_digit R "A", GTFO
+            OMG 11, hex_digit R "B", GTFO
+            OMG 12, hex_digit R "C", GTFO
+            OMG 13, hex_digit R "D", GTFO
+            OMG 14, hex_digit R "E", GTFO
+            OMG 15, hex_digit R "F", GTFO
+            OMGWTF, hex_digit R rem
+        OIC
+        hex_num HAS A SRS i ITZ hex_digit
+        decimal_num R QUOSHUNT OF decimal_num AN 16
+        BOTH SAEM decimal_num AN 0, O RLY?
+            YA RLY, GTFO
+            NO WAI, i R SUM OF i AN 1
+        OIC
+    IM OUTTA YR num_loop
+    I HAS A hex_string ITZ A YARN
+    IM IN YR string_reverse
+        DIFFRINT i AN BIGGR OF i AN 0, O RLY?
+            YA RLY, GTFO
+        OIC
+        hex_string R SMOOSH hex_string AN hex_num'Z SRS i MKAY
+        i R DIFF OF i AN 1
+    IM OUTTA YR string_reverse
+    FOUND YR hex_string
+IF U SAY SOC
\ No newline at end of file diff --git a/examples/prism-matlab.html b/examples/prism-matlab.html new file mode 100644 index 0000000000..00e985dd37 --- /dev/null +++ b/examples/prism-matlab.html @@ -0,0 +1,66 @@ +

MATLAB

+

To use this language, use the class "language-matlab".

+ +

Strings

+
myString = 'Hello, world';
+otherString = 'You''re right';
+ +

Comments

+
% Single line comment
+%{ Multi-line
+comment }%
+ +

Numbers

+
x = 325.499
+realmax + .0001e+308
+e = 1 - 3*(4/3 - 1)
+b = 1e-16 + 1 - 1e-16;
+x = 2 + 3i;
+z =
+   4.7842 -1.0921i   0.8648 -1.5931i   1.2616 -2.2753i
+   2.6130 -0.0941i   4.8987 -2.3898i   4.3787 -3.7538i
+   4.4007 -7.1512i   1.3572 -5.2915i   3.6865 -0.5182i
+
+ +

Control flow

+
if rem(a, 2) == 0
+    disp('a is even')
+    b = a/2;
+end
+switch dayString
+   case 'Monday'
+      disp('Start of the work week')
+   case 'Tuesday'
+      disp('Day 2')
+   case 'Wednesday'
+      disp('Day 3')
+   case 'Thursday'
+      disp('Day 4')
+   case 'Friday'
+      disp('Last day of the work week')
+   otherwise
+      disp('Weekend!')
+end
+n = 1;
+nFactorial = 1;
+while nFactorial < 1e100
+    n = n + 1;
+    nFactorial = nFactorial * n;
+end
+ +

Functions

+
q = integral(sqr,0,1);
+y = parabola(x)
+mygrid = @(x,y) ndgrid((-x:x/c:x),(-y:y/c:y));
+[x,y] = mygrid(pi,2*pi);
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

String inside comment

+
%{ 'test' }%
+% 'test'
\ No newline at end of file diff --git a/examples/prism-perl.html b/examples/prism-perl.html new file mode 100644 index 0000000000..f8c4802b1b --- /dev/null +++ b/examples/prism-perl.html @@ -0,0 +1,90 @@ +

Perl

+

To use this language, use the class "language-perl".

+ +

Comments

+
# Single line comment
+=head1 Here There
+	Be Pods!
+=cut
+ +

Strings

+
q/foo bar baz/;
+q awhy not ?a;
+qw(foo bar baz) q{foo bar baz}
+q[foo bar baz] qq<foo bar baz>
+"foo bar baz" 'foo bar baz' `foo bar baz`
+ +

Regex

+
m/foo/ s/foo/bar/
+m zfooz s zfoozbarz
+qr(foo) m{foo} s(foo)(bar) s{foo}{bar}
+m[foo] m<foo> tr[foo][bar] s<foo><bar>
+/foo/i
+
+ +

Variables

+
${^POSTMATCH}
+$^V
+$element_count = scalar(@whatever);
+keys(%users) = 1000;
+$1, $_, %!;
+ +

Numbers

+
12345
+12345.67
+.23E-10 # a very small number
+3.14_15_92 # a very important number
+4_294_967_296 # underscore for legibility
+0xff # hex
+0xdead_beef # more hex
+0377 # octal (only numbers, begins with 0)
+0b011011 # binary
+ +

Full example

+
sub read_config_file {
+  my ($class, $filename) = @_;
+
+  unless (defined $filename) {
+    my $home  = File::HomeDir->my_home || '.';
+    $filename = File::Spec->catfile($home, '.pause');
+
+    return {} unless -e $filename and -r _;
+  }
+
+  my %conf;
+  if ( eval { require Config::Identity } ) {
+    %conf = Config::Identity->load($filename);
+    $conf{user} = delete $conf{username} unless $conf{user};
+  }
+  else { # Process .pause manually
+    open my $pauserc, '<', $filename
+      or die "can't open $filename for reading: $!";
+
+    while (<$pauserc>) {
+      chomp;
+      next unless $_ and $_ !~ /^\s*#/;
+
+      my ($k, $v) = /^\s*(\w+)\s+(.+)$/;
+      Carp::croak "multiple enties for $k" if $conf{$k};
+      $conf{$k} = $v;
+    }
+  }
+
+  return \%conf;
+}
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Comment-like substring

+
"test # test";
+ +

Comment symbol in regexp

+
/test#test/;
+ +

Two quotes of the same type (i.e. both single or both double) inside a regex

+
/"foo"/;
\ No newline at end of file diff --git a/examples/prism-python.html b/examples/prism-python.html new file mode 100644 index 0000000000..26cd46cecf --- /dev/null +++ b/examples/prism-python.html @@ -0,0 +1,64 @@ +

Python

+

To use this language, use the class "language-python".

+ +

Comments

+
# This is a comment
+# -*- coding: <encoding-name> -*-
+ +

Strings

+
"foo \"bar\" baz"
+'foo \'bar\' baz'
+""" "Multi-line" strings
+are supported."""
+''' 'Multi-line' strings
+are supported.'''
+ +

Numbers

+
7
+2147483647
+0o177
+0b100110111
+3
+79228162514264337593543950336
+0o377
+0x100000000
+0xdeadbeef
+3.14
+10.
+.001
+1e100
+3.14e-10
+0e0
+3.14j
+10.j
+10j
+.001j
+1e100j
+3.14e-10j
+
+ +

Full example

+
def median(pool):
+    '''Statistical median to demonstrate doctest.
+    >>> median([2, 9, 9, 7, 9, 2, 4, 5, 8])
+    7
+    '''
+    copy = sorted(pool)
+    size = len(copy)
+    if size % 2 == 1:
+        return copy[(size - 1) / 2]
+    else:
+        return (copy[size/2 - 1] + copy[size/2]) / 2
+if __name__ == '__main__':
+    import doctest
+    doctest.testmod()
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Comment-like substrings

+
"foo # bar";
\ No newline at end of file diff --git a/examples/prism-ruby.html b/examples/prism-ruby.html new file mode 100644 index 0000000000..8d724c98ce --- /dev/null +++ b/examples/prism-ruby.html @@ -0,0 +1,46 @@ +

Ruby

+

To use this language, use the class "language-ruby".

+ +

Single-line comments

+
# This is a comment
+ +

Strings

+
"foo \"bar\" baz"
+'foo \'bar\' baz'
+ +

Regular expressions

+
/foo?[ ]*bar/
+ +

Variables

+
$foo = 5;
+class InstTest
+  def set_foo(n)
+    @foo = n
+  end
+  def set_bar(n)
+    @bar = n
+  end
+end
+ +

Symbols

+
mystring = :steveT;
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Comment-like substrings

+
"foo # bar";
+ +

Two quotes of the same type (i.e. both single or both double) inside a regex

+
/"foo"/;
+ +

Multi-line comments are not supported

+
=begin
+************************
+This is a comment block
+************************
+=end
\ No newline at end of file From c51673874b71cc2e97ee8fe393b193a3d2891146 Mon Sep 17 00:00:00 2001 From: Golmote Date: Mon, 22 Dec 2014 22:34:36 +0100 Subject: [PATCH 092/137] Improved examples --- examples/prism-coffeescript.html | 12 +++++++++++- examples/prism-lolcode.html | 2 +- examples/prism-twig.html | 8 ++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/examples/prism-coffeescript.html b/examples/prism-coffeescript.html index 8d7537bef9..cd99ecbbed 100644 --- a/examples/prism-coffeescript.html +++ b/examples/prism-coffeescript.html @@ -61,4 +61,14 @@

Classes

tom.move()

Inline JavaScript

-
`alert("foo")`
\ No newline at end of file +
`alert("foo")`
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Comment-like substrings

+
"foo # bar";
\ No newline at end of file diff --git a/examples/prism-lolcode.html b/examples/prism-lolcode.html index b94ef5f8f8..e985546b5b 100644 --- a/examples/prism-lolcode.html +++ b/examples/prism-lolcode.html @@ -62,4 +62,4 @@

Full example

i R DIFF OF i AN 1 IM OUTTA YR string_reverse FOUND YR hex_string -IF U SAY SOC
\ No newline at end of file +IF U SAY SO
\ No newline at end of file diff --git a/examples/prism-twig.html b/examples/prism-twig.html index 4ed93bfab0..22528c76a3 100644 --- a/examples/prism-twig.html +++ b/examples/prism-twig.html @@ -19,6 +19,14 @@

Operators

{{ b b-and c }} {% if phone matches '/^[\\d\\.]+$/' %} ... {% endif %}
+

Twig embedded in HTML

+
<div>
+{% if foo %}
+	<p>Foo!</p>
+{% else %}
+	<p>Not foo...</p>
+{% endif %}
+

Known failures

There are certain edge cases where Prism will fail. There are always such cases in every regex-based syntax highlighter. From 348bcb33937689ef9ab723c87ae43c7121f3286d Mon Sep 17 00:00:00 2001 From: Golmote Date: Mon, 22 Dec 2014 22:35:17 +0100 Subject: [PATCH 093/137] Fix string interpolation in LOLCODE --- components/prism-lolcode.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/prism-lolcode.js b/components/prism-lolcode.js index 46cabe16d5..09e343308e 100644 --- a/components/prism-lolcode.js +++ b/components/prism-lolcode.js @@ -6,10 +6,10 @@ Prism.languages.lolcode = { 'string': { pattern: /"(?::.|[^"])*"/, inside: { - 'variable': /:\{[^}+]\}/, + 'variable': /:\{[^}]+\}/, 'symbol': [ /:\([a-f\d]+\)/i, - /:\[[^\]]\]/, + /:\[[^\]]+\]/, /:[)>o":]/ ] } From 3052213ca9291767396944a9c0c2b4f1e5bbf174 Mon Sep 17 00:00:00 2001 From: Golmote Date: Mon, 22 Dec 2014 22:35:34 +0100 Subject: [PATCH 094/137] Fix POD comments in Perl --- components/prism-perl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-perl.js b/components/prism-perl.js index 6bc1187687..c93b4a0aec 100644 --- a/components/prism-perl.js +++ b/components/prism-perl.js @@ -2,7 +2,7 @@ Prism.languages.perl = { 'comment': [ { // POD - pattern: /((?:^|\n)\s*)=\w+[\s\S]*?=cut.+/g, + pattern: /((?:^|\n)\s*)=\w+[\s\S]*?=cut.*/g, lookbehind: true }, { From d2a960c8e0f5d219a59377c3230033720e91683f Mon Sep 17 00:00:00 2001 From: Golmote Date: Mon, 22 Dec 2014 22:35:58 +0100 Subject: [PATCH 095/137] Fix numbers in Python (octal, binary, imaginary) --- components/prism-python.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-python.js b/components/prism-python.js index 34d44c6ba7..fd3eb0fd22 100644 --- a/components/prism-python.js +++ b/components/prism-python.js @@ -6,7 +6,7 @@ Prism.languages.python= { 'string': /"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(\\?.)*?\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, + 'number' : /\b-?(0[box])?(?:[\da-f]+\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/gi, 'operator' : /[-+]{1,2}|=?<|=?>|!|={1,2}|(&){1,2}|(&){1,2}|\|?\||\?|\*|\/|~|\^|%|\b(or|and|not)\b/g, 'ignore' : /&(lt|gt|amp);/gi, 'punctuation' : /[{}[\];(),.:]/g From f842975d5f6f2129f4db475863b4d7330b5493a2 Mon Sep 17 00:00:00 2001 From: Golmote Date: Mon, 22 Dec 2014 22:38:24 +0100 Subject: [PATCH 096/137] Run gulp --- components/prism-lolcode.min.js | 2 +- components/prism-perl.min.js | 2 +- components/prism-python.min.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/prism-lolcode.min.js b/components/prism-lolcode.min.js index 78e32d8b19..76cd604088 100644 --- a/components/prism-lolcode.min.js +++ b/components/prism-lolcode.min.js @@ -1 +1 @@ -Prism.languages.lolcode={comment:[/\bOBTW\s+[\s\S]*?\s+TLDR\b/,/\bBTW.+/],string:{pattern:/"(?::.|[^"])*"/,inside:{variable:/:\{[^}+]\}/,symbol:[/:\([a-f\d]+\)/i,/:\[[^\]]\]/,/:[)>o":]/]}},number:/(-|\b)\d*\.?\d+/,symbol:{pattern:/(^|\s)(?:A )?(?:YARN|NUMBR|NUMBAR|TROOF|BUKKIT|NOOB)(?=\s|,|$)/,lookbehind:!0,inside:{keyword:/A(?=\s)/}},label:{pattern:/((?:^|\s)(?:IM IN YR|IM OUTTA YR) )[a-zA-Z]\w*/,lookbehind:!0,alias:"string"},"function":{pattern:/((?:^|\s)(?:I IZ|HOW IZ I|IZ) )[a-zA-Z]\w*/,lookbehind:!0},keyword:[{pattern:/(^|\s)(?:O HAI IM|KTHX|HAI|KTHXBYE|I HAS A|ITZ(?: A)?|R|AN|MKAY|SMOOSH|MAEK|IS NOW(?: A)?|VISIBLE|GIMMEH|O RLY\?|YA RLY|NO WAI|OIC|MEBBE|WTF\?|OMG|OMGWTF|GTFO|IM IN YR|IM OUTTA YR|FOUND YR|YR|TIL|WILE|UPPIN|NERFIN|I IZ|HOW IZ I|IF U SAY SO|SRS|HAS A|LIEK(?: A)?|IZ)(?=\s|,|$)/,lookbehind:!0},/'Z(?=\s|,|$)/],"boolean":{pattern:/(^|\s)(?:WIN|FAIL)(?=\s|,|$)/,lookbehind:!0},variable:{pattern:/(^|\s)(?:IT)(?=\s|,|$)/,lookbehind:!0},operator:{pattern:/(^|\s)(?:NOT|BOTH SAEM|DIFFRINT|(?:SUM|DIFF|PRODUKT|QUOSHUNT|MOD|BIGGR|SMALLR|BOTH|EITHER|WON|ALL|ANY) OF)(?=\s|,|$)/,lookbehind:!0},punctuation:/\.{3}|\u2026|,|!/}; \ No newline at end of file +Prism.languages.lolcode={comment:[/\bOBTW\s+[\s\S]*?\s+TLDR\b/,/\bBTW.+/],string:{pattern:/"(?::.|[^"])*"/,inside:{variable:/:\{[^}]+\}/,symbol:[/:\([a-f\d]+\)/i,/:\[[^\]]+\]/,/:[)>o":]/]}},number:/(-|\b)\d*\.?\d+/,symbol:{pattern:/(^|\s)(?:A )?(?:YARN|NUMBR|NUMBAR|TROOF|BUKKIT|NOOB)(?=\s|,|$)/,lookbehind:!0,inside:{keyword:/A(?=\s)/}},label:{pattern:/((?:^|\s)(?:IM IN YR|IM OUTTA YR) )[a-zA-Z]\w*/,lookbehind:!0,alias:"string"},"function":{pattern:/((?:^|\s)(?:I IZ|HOW IZ I|IZ) )[a-zA-Z]\w*/,lookbehind:!0},keyword:[{pattern:/(^|\s)(?:O HAI IM|KTHX|HAI|KTHXBYE|I HAS A|ITZ(?: A)?|R|AN|MKAY|SMOOSH|MAEK|IS NOW(?: A)?|VISIBLE|GIMMEH|O RLY\?|YA RLY|NO WAI|OIC|MEBBE|WTF\?|OMG|OMGWTF|GTFO|IM IN YR|IM OUTTA YR|FOUND YR|YR|TIL|WILE|UPPIN|NERFIN|I IZ|HOW IZ I|IF U SAY SO|SRS|HAS A|LIEK(?: A)?|IZ)(?=\s|,|$)/,lookbehind:!0},/'Z(?=\s|,|$)/],"boolean":{pattern:/(^|\s)(?:WIN|FAIL)(?=\s|,|$)/,lookbehind:!0},variable:{pattern:/(^|\s)(?:IT)(?=\s|,|$)/,lookbehind:!0},operator:{pattern:/(^|\s)(?:NOT|BOTH SAEM|DIFFRINT|(?:SUM|DIFF|PRODUKT|QUOSHUNT|MOD|BIGGR|SMALLR|BOTH|EITHER|WON|ALL|ANY) OF)(?=\s|,|$)/,lookbehind:!0},punctuation:/\.{3}|\u2026|,|!/}; \ No newline at end of file diff --git a/components/prism-perl.min.js b/components/prism-perl.min.js index a09d2c9d01..9121a53e71 100644 --- a/components/prism-perl.min.js +++ b/components/prism-perl.min.js @@ -1 +1 @@ -Prism.languages.perl={comment:[{pattern:/((?:^|\n)\s*)=\w+[\s\S]*?=cut.+/g,lookbehind:!0},{pattern:/(^|[^\\$])#.*?(\r?\n|$)/g,lookbehind:!0}],string:[/\b(?:q|qq|qx|qw)\s*([^a-zA-Z0-9\s\{\(\[<])(\\?.)*?\s*\1/g,/\b(?:q|qq|qx|qw)\s+([a-zA-Z0-9])(\\?.)*?\s*\1/g,/\b(?:q|qq|qx|qw)\s*\(([^()]|\\.)*\s*\)/g,/\b(?:q|qq|qx|qw)\s*\{([^{}]|\\.)*\s*\}/g,/\b(?:q|qq|qx|qw)\s*\[([^[\]]|\\.)*\s*\]/g,/\b(?:q|qq|qx|qw)\s*<([^<>]|\\.)*\s*>/g,/("|'|`)(\\?.)*?\1/g],regex:[/\b(?:m|qr)\s*([^a-zA-Z0-9\s\{\(\[<])(\\?.)*?\s*\1[msixpodualgc]*/g,/\b(?:m|qr)\s+([a-zA-Z0-9])(\\?.)*?\s*\1[msixpodualgc]*/g,/\b(?:m|qr)\s*\(([^()]|\\.)*\s*\)[msixpodualgc]*/g,/\b(?:m|qr)\s*\{([^{}]|\\.)*\s*\}[msixpodualgc]*/g,/\b(?:m|qr)\s*\[([^[\]]|\\.)*\s*\][msixpodualgc]*/g,/\b(?:m|qr)\s*<([^<>]|\\.)*\s*>[msixpodualgc]*/g,/\b(?:s|tr|y)\s*([^a-zA-Z0-9\s\{\(\[<])(\\?.)*?\s*\1\s*((?!\1).|\\.)*\s*\1[msixpodualgcer]*/g,/\b(?:s|tr|y)\s+([a-zA-Z0-9])(\\?.)*?\s*\1\s*((?!\1).|\\.)*\s*\1[msixpodualgcer]*/g,/\b(?:s|tr|y)\s*\(([^()]|\\.)*\s*\)\s*\(\s*([^()]|\\.)*\s*\)[msixpodualgcer]*/g,/\b(?:s|tr|y)\s*\{([^{}]|\\.)*\s*\}\s*\{\s*([^{}]|\\.)*\s*\}[msixpodualgcer]*/g,/\b(?:s|tr|y)\s*\[([^[\]]|\\.)*\s*\]\s*\[\s*([^[\]]|\\.)*\s*\][msixpodualgcer]*/g,/\b(?:s|tr|y)\s*<([^<>]|\\.)*\s*>\s*<\s*([^<>]|\\.)*\s*>[msixpodualgcer]*/g,/\/(\[.+?]|\\.|[^\/\r\n])*\/[msixpodualgc]*(?=\s*($|[\r\n,.;})&|\-+*=~<>!?^]|(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b))/g],variable:[/[&*\$@%]\{\^[A-Z]+\}/g,/[&*\$@%]\^[A-Z_]/g,/[&*\$@%]#?(?=\{)/,/[&*\$@%]#?((::)*'?(?!\d)[\w$]+)+(::)*/gi,/[&*\$@%]\d+/g,/[\$@%][!"#\$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/g],filehandle:{pattern:/<(?!=).*>|\b_\b/g,alias:"symbol"},vstring:{pattern:/v\d+(\.\d+)*|\d+(\.\d+){2,}/g,alias:"string"},"function":{pattern:/sub [a-z0-9_]+/gi,inside:{keyword:/sub/}},keyword:/\b(any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|say|state|sub|switch|undef|unless|until|use|when|while)\b/g,number:/(\n|\b)-?(0x[\dA-Fa-f](_?[\dA-Fa-f])*|0b[01](_?[01])*|(\d(_?\d)*)?\.?\d(_?\d)*([Ee]-?\d+)?)\b/g,operator:/-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|[-+*=~\/|&]{1,2}|<=?|>=?|\.{1,3}|[!?\\^]|\b(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b/g,punctuation:/[{}[\];(),:]/g}; \ No newline at end of file +Prism.languages.perl={comment:[{pattern:/((?:^|\n)\s*)=\w+[\s\S]*?=cut.*/g,lookbehind:!0},{pattern:/(^|[^\\$])#.*?(\r?\n|$)/g,lookbehind:!0}],string:[/\b(?:q|qq|qx|qw)\s*([^a-zA-Z0-9\s\{\(\[<])(\\?.)*?\s*\1/g,/\b(?:q|qq|qx|qw)\s+([a-zA-Z0-9])(\\?.)*?\s*\1/g,/\b(?:q|qq|qx|qw)\s*\(([^()]|\\.)*\s*\)/g,/\b(?:q|qq|qx|qw)\s*\{([^{}]|\\.)*\s*\}/g,/\b(?:q|qq|qx|qw)\s*\[([^[\]]|\\.)*\s*\]/g,/\b(?:q|qq|qx|qw)\s*<([^<>]|\\.)*\s*>/g,/("|'|`)(\\?.)*?\1/g],regex:[/\b(?:m|qr)\s*([^a-zA-Z0-9\s\{\(\[<])(\\?.)*?\s*\1[msixpodualgc]*/g,/\b(?:m|qr)\s+([a-zA-Z0-9])(\\?.)*?\s*\1[msixpodualgc]*/g,/\b(?:m|qr)\s*\(([^()]|\\.)*\s*\)[msixpodualgc]*/g,/\b(?:m|qr)\s*\{([^{}]|\\.)*\s*\}[msixpodualgc]*/g,/\b(?:m|qr)\s*\[([^[\]]|\\.)*\s*\][msixpodualgc]*/g,/\b(?:m|qr)\s*<([^<>]|\\.)*\s*>[msixpodualgc]*/g,/\b(?:s|tr|y)\s*([^a-zA-Z0-9\s\{\(\[<])(\\?.)*?\s*\1\s*((?!\1).|\\.)*\s*\1[msixpodualgcer]*/g,/\b(?:s|tr|y)\s+([a-zA-Z0-9])(\\?.)*?\s*\1\s*((?!\1).|\\.)*\s*\1[msixpodualgcer]*/g,/\b(?:s|tr|y)\s*\(([^()]|\\.)*\s*\)\s*\(\s*([^()]|\\.)*\s*\)[msixpodualgcer]*/g,/\b(?:s|tr|y)\s*\{([^{}]|\\.)*\s*\}\s*\{\s*([^{}]|\\.)*\s*\}[msixpodualgcer]*/g,/\b(?:s|tr|y)\s*\[([^[\]]|\\.)*\s*\]\s*\[\s*([^[\]]|\\.)*\s*\][msixpodualgcer]*/g,/\b(?:s|tr|y)\s*<([^<>]|\\.)*\s*>\s*<\s*([^<>]|\\.)*\s*>[msixpodualgcer]*/g,/\/(\[.+?]|\\.|[^\/\r\n])*\/[msixpodualgc]*(?=\s*($|[\r\n,.;})&|\-+*=~<>!?^]|(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b))/g],variable:[/[&*\$@%]\{\^[A-Z]+\}/g,/[&*\$@%]\^[A-Z_]/g,/[&*\$@%]#?(?=\{)/,/[&*\$@%]#?((::)*'?(?!\d)[\w$]+)+(::)*/gi,/[&*\$@%]\d+/g,/[\$@%][!"#\$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/g],filehandle:{pattern:/<(?!=).*>|\b_\b/g,alias:"symbol"},vstring:{pattern:/v\d+(\.\d+)*|\d+(\.\d+){2,}/g,alias:"string"},"function":{pattern:/sub [a-z0-9_]+/gi,inside:{keyword:/sub/}},keyword:/\b(any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|say|state|sub|switch|undef|unless|until|use|when|while)\b/g,number:/(\n|\b)-?(0x[\dA-Fa-f](_?[\dA-Fa-f])*|0b[01](_?[01])*|(\d(_?\d)*)?\.?\d(_?\d)*([Ee]-?\d+)?)\b/g,operator:/-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|[-+*=~\/|&]{1,2}|<=?|>=?|\.{1,3}|[!?\\^]|\b(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|x)\b/g,punctuation:/[{}[\];(),:]/g}; \ No newline at end of file diff --git a/components/prism-python.min.js b/components/prism-python.min.js index 566137894e..921f6c4982 100644 --- a/components/prism-python.min.js +++ b/components/prism-python.min.js @@ -1 +1 @@ -Prism.languages.python={comment:{pattern:/(^|[^\\])#.*?(\r?\n|$)/g,lookbehind:!0},string:/"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(\\?.)*?\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}; \ No newline at end of file +Prism.languages.python={comment:{pattern:/(^|[^\\])#.*?(\r?\n|$)/g,lookbehind:!0},string:/"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(\\?.)*?\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-?(0[box])?(?:[\da-f]+\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/gi,operator:/[-+]{1,2}|=?<|=?>|!|={1,2}|(&){1,2}|(&){1,2}|\|?\||\?|\*|\/|~|\^|%|\b(or|and|not)\b/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g}; \ No newline at end of file From 27ec928b35353668344f6127451f45f7bcb2aff6 Mon Sep 17 00:00:00 2001 From: Golmote Date: Tue, 23 Dec 2014 08:53:56 +0100 Subject: [PATCH 097/137] Add examples for Haml, Handlebars, Ini, LaTeX and PHP --- examples/prism-haml.html | 82 ++++++++++++++++++++++++++++++++++ examples/prism-handlebars.html | 39 ++++++++++++++++ examples/prism-ini.html | 13 ++++++ examples/prism-latex.html | 15 +++++++ examples/prism-php.html | 66 +++++++++++++++++++++++++++ 5 files changed, 215 insertions(+) create mode 100644 examples/prism-haml.html create mode 100644 examples/prism-handlebars.html create mode 100644 examples/prism-ini.html create mode 100644 examples/prism-latex.html create mode 100644 examples/prism-php.html diff --git a/examples/prism-haml.html b/examples/prism-haml.html new file mode 100644 index 0000000000..fe7220d9fe --- /dev/null +++ b/examples/prism-haml.html @@ -0,0 +1,82 @@ +

Haml

+

To use this language, use the class "language-haml".

+ +

Comments

+

+/ This is comment
+    on multiple lines
+/ This is a comment
+but this is not
+-# This is another comment
+    on multiple lines
+ +

Doctype

+
!!! XML
+!!!
+!!! 5
+ +

Tags

+
%div
+	%span
+%span(class="widget_#{@widget.number}")
+%div{:id => [@item.type, @item.number], :class => [@item.type, @item.urgency]}
+%html{:xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en", :lang => "en"}
+%html{html_attrs('fr-fr')}
+%div[@user, :greeting]
+%img
+%pre><
+  foo
+  bar
+%img
+
+ +

Markup

+
%p
+  <div id="blah">Blah!</div>
+ +

Inline Ruby

+
= ['hi', 'there', 'reader!'].join " "
+- foo = "hello"
+= link_to_remote "Add to cart",
+    :url => { :action => "add", :id => product.id },
+    :update => { :success => "cart", :failure => "error" }
+~ "Foo\n<pre>Bar\nBaz</pre>"
+%p
+  - case 2
+  - when 1
+    = "1!"
+  - when 2
+    = "2?"
+  - when 3
+    = "3."
+- (42...47).each do |i|
+  %p= i
+%p See, I can count!
+
+ +

Filters

+ +
%head
+	:css
+		#content: {
+			background: url('img/background.jpg');
+		}
+		div {
+			color: #333;
+		}
+	:javascript
+		(function() {
+			var test = "Do you like Prism?";
+			if(confirm(test)) {
+				do_something_great();
+			}
+		}());
+%body
+
+ +

Filters require the desired language to be loaded. +On this page, check CoffeeScript before checking Haml should make +the example below work properly.

+
script
+  :coffee
+    console.log 'This is coffee script'
\ No newline at end of file diff --git a/examples/prism-handlebars.html b/examples/prism-handlebars.html new file mode 100644 index 0000000000..dc67ceb81a --- /dev/null +++ b/examples/prism-handlebars.html @@ -0,0 +1,39 @@ +

Handlebars

+

To use this language, use the class "language-handlebars".

+ +

Comments

+
{{! This is a comment with <p>some markup</p> in it }}
+ +

Variables

+
<p>{{ text }}</p>
+<h1>{{article.title}}</h1>
+{{{ triple_slash_is_supported }}}
+{{articles.[10].[#comments]}}
+ +

Strings, numbers and booleans

+
{{{link "See more..." story.url}}}
+{{ true }}
+{{ custom_helper 42 href="somepage.html" false }}
+ +

Block helpers

+
<div class="body">
+	{{#bold}}{{body}}{{/bold}}
+</div>
+{{#with story}}
+	<div class="intro">{{{intro}}}</div>
+	<div class="body">{{{body}}}</div>
+{{/with}}
+<div class="{{#if test}}foo{{else}}bar{{/if}}"></div>
+{{#list array}}
+  {{@index}}. {{title}}
+{{/list}}
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Handlebars tag in the middle of an HTML tag

+
<div{{#if test}} class="test"{{/if}}></div>
\ No newline at end of file diff --git a/examples/prism-ini.html b/examples/prism-ini.html new file mode 100644 index 0000000000..d404e42720 --- /dev/null +++ b/examples/prism-ini.html @@ -0,0 +1,13 @@ +

Ini

+

To use this language, use the class "language-ini".

+ +

Comments

+
; This is a comment
+ +

Section title

+
[owner]
+[database]
+ +

Properties

+
name=prism
+file="somefile.txt"
\ No newline at end of file diff --git a/examples/prism-latex.html b/examples/prism-latex.html new file mode 100644 index 0000000000..4d8769f9e4 --- /dev/null +++ b/examples/prism-latex.html @@ -0,0 +1,15 @@ +

LaTeX

+

To use this language, use the class "language-latex".

+ +

Comments

+
% This is a comment
+ +

Commands

+
\begin{document}
+\documentstyle[twoside,epsfig]{article}
+\usepackage{epsfig,multicol}
+ +

Math mode

+
$\alpha$
+H$_{2}$O
+45$^{\circ}$C
\ No newline at end of file diff --git a/examples/prism-php.html b/examples/prism-php.html new file mode 100644 index 0000000000..764e89ead1 --- /dev/null +++ b/examples/prism-php.html @@ -0,0 +1,66 @@ +

PHP

+

To use this language, use the class "language-php".

+ +

Comments

+
// Single line comment
+/* Multi-line
+comment */
+ +

Strings

+
'foo \'bar\' baz'
+"foo \"bar\" baz"
+ +

Variables

+
$some_var = 5;
+$otherVar = "Some text";
+$null = null;
+$false = FaLsE;
+ +

Functions

+
$json = json_encode($my_object);
+$array1 = array("a" => "green", "red", "blue", "red");
+$array2 = array("b" => "green", "yellow", "red");
+$result = array_diff($array1, $array2);
+ +

Constants

+
define('MAXSIZE', 42);
+echo MAXSIZE;
+json_decode($json, false, 512, JSON_BIGINT_AS_STRING)
+ +

PHP 5.3+ support

+
namespace my\name;
+$c = new \my\name\MyClass;
+$arr = [1,2,3];
+trait ezcReflectionReturnInfo {
+    function getReturnType() { /*1*/ }
+    function getReturnDescription() { /*2*/ }
+}
+function gen_one_to_three() {
+    for ($i = 1; $i <= 3; $i++) {
+        // Note that $i is preserved between yields.
+        yield $i;
+    }
+}
+ +

PHP embedded in HTML

+
<div class="<?php echo $a ? 'foo' : 'bar'; ?>">
+<?php if($var < 42) {
+    echo "Something";
+} else {
+    echo "Something else";
+} ?>
+</div>
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Comment-like substrings

+
"foo /* bar */ baz"; "foo // bar";
+ +

A less-than sign and a greater-than sign on the same line

+
if($a < $b && $b > $c) {}
+ From 88ba4c48f0c62db700d8272767f14e80f0259c58 Mon Sep 17 00:00:00 2001 From: Golmote Date: Tue, 23 Dec 2014 09:01:46 +0100 Subject: [PATCH 098/137] Fixes in examples --- examples/prism-haml.html | 6 +++--- examples/prism-php.html | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/prism-haml.html b/examples/prism-haml.html index fe7220d9fe..c5561e5b02 100644 --- a/examples/prism-haml.html +++ b/examples/prism-haml.html @@ -31,8 +31,8 @@

Tags

Markup

-
%p
-  <div id="blah">Blah!</div>
+
%div
+  <p id="blah">Blah!</p>

Inline Ruby

= ['hi', 'there', 'reader!'].join " "
@@ -77,6 +77,6 @@ 

Filters

Filters require the desired language to be loaded. On this page, check CoffeeScript before checking Haml should make the example below work properly.

-
script
+
%script
   :coffee
     console.log 'This is coffee script'
\ No newline at end of file diff --git a/examples/prism-php.html b/examples/prism-php.html index 764e89ead1..68f0363f90 100644 --- a/examples/prism-php.html +++ b/examples/prism-php.html @@ -14,7 +14,7 @@

Variables

$some_var = 5;
 $otherVar = "Some text";
 $null = null;
-$false = FaLsE;
+$false = false;

Functions

$json = json_encode($my_object);

From 68f60007c89e34659bb9fff48882791bcd076cc2 Mon Sep 17 00:00:00 2001
From: Golmote 
Date: Tue, 23 Dec 2014 20:48:51 +0100
Subject: [PATCH 099/137] Add examples for ASP.NET, C, C++, Go, Scheme and
 Swift

---
 examples/prism-aspnet.html | 39 +++++++++++++++++++
 examples/prism-c.html      | 25 ++++++++++++
 examples/prism-cpp.html    | 64 ++++++++++++++++++++++++++++++
 examples/prism-go.html     | 71 +++++++++++++++++++++++++++++++++
 examples/prism-scheme.html | 48 +++++++++++++++++++++++
 examples/prism-swift.html  | 80 ++++++++++++++++++++++++++++++++++++++
 6 files changed, 327 insertions(+)
 create mode 100644 examples/prism-aspnet.html
 create mode 100644 examples/prism-c.html
 create mode 100644 examples/prism-cpp.html
 create mode 100644 examples/prism-go.html
 create mode 100644 examples/prism-scheme.html
 create mode 100644 examples/prism-swift.html

diff --git a/examples/prism-aspnet.html b/examples/prism-aspnet.html
new file mode 100644
index 0000000000..cdc1fc3701
--- /dev/null
+++ b/examples/prism-aspnet.html
@@ -0,0 +1,39 @@
+

ASP.NET (C#)

+

To use this language, use the class "language-aspnet".

+ +

Comments

+
<%-- This is a comment --%>
+<%-- This is a
+multi-line comment --%>
+ +

Page directives

+
<%@ Page Title="Products" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"  CodeBehind="ProductList.aspx.cs" Inherits="WingtipToys.ProductList" %>
+
+ +

Directive tag

+
<%: Page.Title %>
+<a href="ProductDetails.aspx?productID=<%#:Item.ProductID%>">
+<span>
+    <%#:Item.ProductName%>
+</span>
+ +

Highlighted C# inside scripts

+

This requires the C# component to be loaded. + On this page, check C# before checking ASP.NET should make + the example below work properly.

+
<script runat="server">
+    // The following variables are visible to all procedures
+    // within the script block.
+    String str;
+    int i;
+    int i2;
+
+    int DoubleIt(int inpt)
+    {
+        // The following variable is visible only within
+        // the DoubleIt procedure.
+        int factor = 2;
+
+        return inpt * factor;
+    }
+</script>
\ No newline at end of file diff --git a/examples/prism-c.html b/examples/prism-c.html new file mode 100644 index 0000000000..ae5e77d963 --- /dev/null +++ b/examples/prism-c.html @@ -0,0 +1,25 @@ +

C

+

To use this language, use the class "language-c".

+ +

Strings

+
"foo \"bar\" baz"
+'foo \'bar\' baz'
+"Multi-line strings ending with a \
+are supported too."
+ +

Macro statements

+
# include <stdio.h>
+#define PG_locked   0
+#define PG_error    1
+
+ +

Full example

+
#include <stdio.h>
+main(int argc, char *argv[])
+{
+   int c;
+   printf("Number of command line arguments passed: %d\n", argc);
+   for ( c = 0 ; c < argc ; c++)
+      printf("%d. Command line argument passed is %s\n", c+1, argv[c]);
+   return 0;
+}
\ No newline at end of file diff --git a/examples/prism-cpp.html b/examples/prism-cpp.html new file mode 100644 index 0000000000..054f4afd3e --- /dev/null +++ b/examples/prism-cpp.html @@ -0,0 +1,64 @@ +

C++

+

To use this language, use the class "language-cpp".

+ +

Strings

+
"foo \"bar\" baz"
+'foo \'bar\' baz'
+"Multi-line strings ending with a \
+are supported too."
+ +

Macro statements

+
# include <stdio.h>
+#define PG_locked   0
+#define PG_error    1
+
+ +

Booleans

+
true;
+false;
+ +

Operators

+
a and b;
+c bitand d;
+ +

Full example

+
/*
+David Cary 2010-09-14
+quick demo for wikibooks
+public domain
+*/
+#include <iostream>
+#include <vector>
+using namespace std;
+
+vector<int> pick_vector_with_biggest_fifth_element(
+    vector<int> left,
+    vector<int> right
+){
+    if( (left[5]) < (right[5]) ){
+        return( right );
+    };
+    // else
+    return( left );
+}
+
+int vector_demo(void){
+    cout << "vector demo" << endl;
+    vector<int> left(7);
+    vector<int> right(7);
+
+    left[5] = 7;
+    right[5] = 8;
+    cout << left[5] << endl;
+    cout << right[5] << endl;
+    vector<int> biggest(
+        pick_vector_with_biggest_fifth_element( left, right )
+    );
+    cout << biggest[5] << endl;
+
+    return 0;
+}
+
+int main(void){
+    vector_demo();
+}
diff --git a/examples/prism-go.html b/examples/prism-go.html new file mode 100644 index 0000000000..196dcf468e --- /dev/null +++ b/examples/prism-go.html @@ -0,0 +1,71 @@ +

Go

+

To use this language, use the class "language-go".

+ +

Comments

+
// This is a comment
+/* This is a comment
+on multiple lines */
+ +

Numbers

+
42
+0600
+0xBadFace
+170141183460469231731687303715884105727
+0.
+72.40
+072.40
+2.71828
+1.e+0
+6.67428e-11
+1E6
+.25
+.12345E+5
+0i
+011i
+0.i
+2.71828i
+1.e+0i
+6.67428e-11i
+1E6i
+.25i
+.12345E+5i
+ +

Runes and strings

+
'\t'
+'\000'
+'\x07'
+'\u12e4'
+'\U00101234'
+`abc`
+`multi-line
+string`
+"Hello, world!"
+"multi-line
+string"
+ +

Functions

+
func(a, b int, z float64) bool { return a*b < int(z) }
+ +

Full example

+
package main
+import "fmt"
+
+func sum(a []int, c chan int) {
+	sum := 0
+	for _, v := range a {
+		sum += v
+	}
+	c <- sum // send sum to c
+}
+
+func main() {
+	a := []int{7, 2, 8, -9, 4, 0}
+
+	c := make(chan int)
+	go sum(a[:len(a)/2], c)
+	go sum(a[len(a)/2:], c)
+	x, y := <-c, <-c // receive from c
+
+	fmt.Println(x, y, x+y)
+}
+
\ No newline at end of file diff --git a/examples/prism-scheme.html b/examples/prism-scheme.html new file mode 100644 index 0000000000..3b98271715 --- /dev/null +++ b/examples/prism-scheme.html @@ -0,0 +1,48 @@ +

Scheme

+

To use this language, use the class "language-scheme".

+ +

Comments

+
; This is a comment
+ +

Booleans

+
#t
+#f
+ +

Strings

+
"two \"quotes\" within"
+ +

Functions

+
(lambda (x) (+ x 3))
+(apply vector 'a 'b '(c d e))
+
+ +

Full example

+
;; Calculation of Hofstadter's male and female sequences as a list of pairs
+
+(define (hofstadter-male-female n)
+  (letrec ((female (lambda (n)
+		     (if (= n 0)
+			 1
+			 (- n (male (female (- n 1)))))))
+	   (male (lambda (n)
+		   (if (= n 0)
+		       0
+		       (- n (female (male (- n 1))))))))
+    (let loop ((i 0))
+      (if (> i n)
+	  '()
+	  (cons (cons (female i)
+		      (male i))
+		(loop (+ i 1)))))))
+
+(hofstadter-male-female 8)
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Comment-like substrings

+
"foo ; bar"
\ No newline at end of file diff --git a/examples/prism-swift.html b/examples/prism-swift.html new file mode 100644 index 0000000000..5bc1633a5c --- /dev/null +++ b/examples/prism-swift.html @@ -0,0 +1,80 @@ +

Swift

+

To use this language, use the class "language-swift".

+ +

Comments

+
// this is a comment
+/* this is also a comment,
+but written over multiple lines */
+
+ +

Numbers

+
42
+-23
+3.14159
+0.1
+-273.15
+1.25e-2
+0xC.3p0
+1_000_000
+1_000_000.000_000_1
+ +

Strings

+
let someString = "Some string literal value"
+var emptyString = ""
+ +

Control flow

+
for index in 1...5 {
+	println("\(index) times 5 is \(index * 5)")
+}
+for _ in 1...power {
+	answer *= base
+}
+while square < finalSquare {
+	// roll the dice
+	if ++diceRoll == 7 { diceRoll = 1 }
+	// move by the rolled amount
+	square += diceRoll
+	if square < board.count {
+		// if we're still on the board, move up or down for a snake or a ladder
+		square += board[square]
+	}
+}
+switch someCharacter {
+	case "a", "e", "i", "o", "u":
+		println("\(someCharacter) is a vowel")
+	case "b", "c", "d", "f", "g", "h", "j", "k", "l", "m",
+		"n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z":
+		println("\(someCharacter) is a consonant")
+	default:
+		println("\(someCharacter) is not a vowel or a consonant")
+}
+
+ +

Classes and attributes

+
class MyViewController: UIViewController {
+    @IBOutlet weak var button: UIButton!
+    @IBOutlet var textFields: [UITextField]!
+    @IBAction func buttonTapped(AnyObject) {
+	    println("button tapped!")
+	}
+}
+
+@IBDesignable
+class MyCustomView: UIView {
+    @IBInspectable var textColor: UIColor
+    @IBInspectable var iconHeight: CGFloat
+    /* ... */
+}
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Nested block comments

+
/* Nested block
+	/* comments
+	are */
+not supported */
\ No newline at end of file From 9cfcc2d8d40e55440ca5855e6f5cd16161848722 Mon Sep 17 00:00:00 2001 From: Daniel Flint Date: Wed, 31 Dec 2014 10:19:19 +1100 Subject: [PATCH 100/137] PowerShell support --- components.js | 4 ++ components/prism-powershell.js | 37 +++++++++++++++++++ components/prism-powershell.min.js | 1 + examples/prism-powershell.html | 22 +++++++++++ .../file-highlight/prism-file-highlight.js | 4 +- .../prism-file-highlight.min.js | 2 +- 6 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 components/prism-powershell.js create mode 100644 components/prism-powershell.min.js create mode 100644 examples/prism-powershell.html diff --git a/components.js b/components.js index f10aff6d3f..8d48e5fe46 100644 --- a/components.js +++ b/components.js @@ -264,6 +264,10 @@ var components = { "title": "Dart", "require": "clike", "owner": "Golmote" + }, + "powershell": { + "title": "PowerShell", + "owner": "nauzilus" } }, "plugins": { diff --git a/components/prism-powershell.js b/components/prism-powershell.js new file mode 100644 index 0000000000..fddcb8fa98 --- /dev/null +++ b/components/prism-powershell.js @@ -0,0 +1,37 @@ +Prism.languages.powershell = { + 'comment': [ + { + pattern: /(^|[^`])<#[\w\W]*?#>/g, + lookbehind: true + }, + { + pattern: /(^|[^`])#.*?(\r?\n|$)/g, + lookbehind: true + } + ], + 'string': { + pattern: /("|')(\\?.)*?\1/g, + inside: {} + }, + // Matches name spaces as well as casts, attribute decorators. Force starting with letter to avoid matching array indices + 'namespace': /\[[a-z][\w\W]*?\]/i, + 'variable': /(\$\w+)\b/ig, + 'keyword': /\b(Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|In|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/gi, + 'function': [ + { + // Full function names + // Get-Command | ?{ $_.ModuleName -match "Microsoft.PowerShell.(Util|Core|Management)" } + pattern: /\b(Add-(Computer|Content|History|Member|PSSnapin|Type)|Checkpoint-(Computer|Content|EventLog|History|Item|ItemProperty|Variable)|Compare-(Object)|Complete-(Transaction)|Connect-(PSSession)|ConvertFrom-(Csv|Json|StringData)|Convert-(Path)|ConvertTo-(Csv|Html|Json|Xml)|Copy-(Item|ItemProperty)|Debug-(Process)|Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disconnect-(PSSession)|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Enter-(PSSession)|Exit-(PSSession)|Export-(Alias|Clixml|Console|Csv|FormatData|ModuleMember|PSSession)|ForEach-(Object)|Format-(Custom|List|Table|Wide)|Get-(Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-(Object)|Import-(Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-(Path)|Limit-(EventLog)|Measure-(Command)|Measure-(Object)|Move-(Item|ItemProperty)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(Default|File|GridView|Host|Null|Printer|String)|Pop-(Location)|Push-(Location)|Read-(Host)|Receive-(Job)|Receive-(PSSession)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(Computer|Item|ItemProperty)|Reset-(ComputerMachinePassword)|Resolve-(Path)|Restart-(Computer|Service)|Restore-(Computer)|Resume-(Job|Service)|Save-(Help)|Select-(Object|String|Xml)|Send-(MailMessage)|Set-(Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(Command|ControlPanelItem|EventLog)|Sort-(Object)|Split-(Path)|Start-(Job|Process|Service|Sleep|Transaction)|Stop-(Computer|Job|Process|Service)|Suspend-(Job|Service)|Tee-(Object)|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)|Trace-(Command)|Unblock-(File)|Undo-(Transaction)|Unregister-(Event|PSSessionConfiguration)|Update-(FormatData)|Update-(Help|List|TypeData)|Use-(Transaction)|Wait-(Event|Job|Process)|Where-(Object)|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning))\b/gi + }, + { + // Aliases. Should come second, otherwise "write" gets preferred over "write-host" for example + pattern: /\b(ac|asnp|cat|cd|chdir|clc|clear|clhy|cli|clp|cls|clv|cnsn|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|dnsn|ebp|echo|epal|epcsv|epsn|erase|etsn|exsn|fc|fl|foreach|ft|fw|gal|gbp|gc|gci|gcm|gcs|gdr|ghy|gi|gjb|gl|gm|gmo|gp|gps|group|gsn|gsnp|gsv|gu|gv|gwmi|h|history|icm|iex|ihy|ii|ipal|ipcsv|ipmo|ipsn|irm|ise|iwmi|iwr|kill|lp|ls|man|md|measure|mi|mount|move|mp|mv|nal|ndr|ni|nmo|npssc|nsn|nv|ogv|oh|popd|ps|pushd|pwd|r|rbp|rcjb|rcsn|rd|rdr|ren|ri|rjb|rm|rmdir|rmo|rni|rnp|rp|rsn|rsnp|rujb|rv|rvpa|rwmi|sajb|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spjb|spps|spsv|start|sujb|sv|swmi|tee|trcm|type|where|wjb|write)\b/gi + } + ], + 'operator': { + pattern: /(\W)-(and|x?or|not|eq|ne|gt|ge|lt|le|Like|(Not)?(Like|Match|Contains|In)|Replace)\b/gi, + lookbehind: true + } +}; +// Variable interpolation inside strings +Prism.languages.powershell.string.inside.variable = Prism.languages.powershell.variable; \ No newline at end of file diff --git a/components/prism-powershell.min.js b/components/prism-powershell.min.js new file mode 100644 index 0000000000..c424a6da83 --- /dev/null +++ b/components/prism-powershell.min.js @@ -0,0 +1 @@ +Prism.languages.powershell={comment:[{pattern:/(^|[^`])<#[\w\W]*?#>/g,lookbehind:true},{pattern:/(^|[^`])#.*?(\r?\n|$)/g,lookbehind:true}],string:{pattern:/("|')(\\?.)*?\1/g,inside:{}},namespace:/\[[a-z][\w\W]*?\]/i,variable:/(\$\w+)\b/ig,keyword:/\b(Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|In|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/gi,"function":[{pattern:/\b(Add-(Computer|Content|History|Member|PSSnapin|Type)|Checkpoint-(Computer|Content|EventLog|History|Item|ItemProperty|Variable)|Compare-(Object)|Complete-(Transaction)|Connect-(PSSession)|ConvertFrom-(Csv|Json|StringData)|Convert-(Path)|ConvertTo-(Csv|Html|Json|Xml)|Copy-(Item|ItemProperty)|Debug-(Process)|Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disconnect-(PSSession)|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Enter-(PSSession)|Exit-(PSSession)|Export-(Alias|Clixml|Console|Csv|FormatData|ModuleMember|PSSession)|ForEach-(Object)|Format-(Custom|List|Table|Wide)|Get-(Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-(Object)|Import-(Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-(Path)|Limit-(EventLog)|Measure-(Command)|Measure-(Object)|Move-(Item|ItemProperty)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(Default|File|GridView|Host|Null|Printer|String)|Pop-(Location)|Push-(Location)|Read-(Host)|Receive-(Job)|Receive-(PSSession)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(Computer|Item|ItemProperty)|Reset-(ComputerMachinePassword)|Resolve-(Path)|Restart-(Computer|Service)|Restore-(Computer)|Resume-(Job|Service)|Save-(Help)|Select-(Object|String|Xml)|Send-(MailMessage)|Set-(Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(Command|ControlPanelItem|EventLog)|Sort-(Object)|Split-(Path)|Start-(Job|Process|Service|Sleep|Transaction)|Stop-(Computer|Job|Process|Service)|Suspend-(Job|Service)|Tee-(Object)|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)|Trace-(Command)|Unblock-(File)|Undo-(Transaction)|Unregister-(Event|PSSessionConfiguration)|Update-(FormatData)|Update-(Help|List|TypeData)|Use-(Transaction)|Wait-(Event|Job|Process)|Where-(Object)|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning))\b/gi},{pattern:/\b(ac|asnp|cat|cd|chdir|clc|clear|clhy|cli|clp|cls|clv|cnsn|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|dnsn|ebp|echo|epal|epcsv|epsn|erase|etsn|exsn|fc|fl|foreach|ft|fw|gal|gbp|gc|gci|gcm|gcs|gdr|ghy|gi|gjb|gl|gm|gmo|gp|gps|group|gsn|gsnp|gsv|gu|gv|gwmi|h|history|icm|iex|ihy|ii|ipal|ipcsv|ipmo|ipsn|irm|ise|iwmi|iwr|kill|lp|ls|man|md|measure|mi|mount|move|mp|mv|nal|ndr|ni|nmo|npssc|nsn|nv|ogv|oh|popd|ps|pushd|pwd|r|rbp|rcjb|rcsn|rd|rdr|ren|ri|rjb|rm|rmdir|rmo|rni|rnp|rp|rsn|rsnp|rujb|rv|rvpa|rwmi|sajb|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spjb|spps|spsv|start|sujb|sv|swmi|tee|trcm|type|where|wjb|write)\b/gi}],operator:{pattern:/(\W)-(and|x?or|not|eq|ne|gt|ge|lt|le|Like|(Not)?(Like|Match|Contains|In)|Replace)\b/gi,lookbehind:true}};Prism.languages.powershell.string.inside.variable=Prism.languages.powershell.variable; \ No newline at end of file diff --git a/examples/prism-powershell.html b/examples/prism-powershell.html new file mode 100644 index 0000000000..ffbbd2d129 --- /dev/null +++ b/examples/prism-powershell.html @@ -0,0 +1,22 @@ +

PowerShell

+

To use this language, use the class "language-powershell".

+ +

Comments

+
# This is a comment
+<# This is a
+multi-line comment #>
+ +

Variable Interpolation

+
$Name = "Alice"
+Write-Host "Hello, my name is $Name."
+ +

Full Example

+
Function SayHello([string]$name) {
+    Write-Host "Hello, $name."
+}
+$Names = @("Bob", "Alice")
+
+$Names | ForEach {
+    SayHello $_
+}
+
\ No newline at end of file diff --git a/plugins/file-highlight/prism-file-highlight.js b/plugins/file-highlight/prism-file-highlight.js index f2510dc3f6..0dd7edacba 100644 --- a/plugins/file-highlight/prism-file-highlight.js +++ b/plugins/file-highlight/prism-file-highlight.js @@ -10,7 +10,9 @@ var Extensions = { 'svg': 'markup', 'xml': 'markup', 'py': 'python', - 'rb': 'ruby' + 'rb': 'ruby', + 'ps1': 'powershell', + 'psm1': 'powershell' }; Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function(pre) { diff --git a/plugins/file-highlight/prism-file-highlight.min.js b/plugins/file-highlight/prism-file-highlight.min.js index bd9891e4a5..4cc453a71d 100644 --- a/plugins/file-highlight/prism-file-highlight.min.js +++ b/plugins/file-highlight/prism-file-highlight.min.js @@ -1 +1 @@ -!function(){if(self.Prism&&self.document&&document.querySelector){var t={js:"javascript",html:"markup",svg:"markup",xml:"markup",py:"python",rb:"ruby"};Array.prototype.slice.call(document.querySelectorAll("pre[data-src]")).forEach(function(e){var r=e.getAttribute("data-src"),n=(r.match(/\.(\w+)$/)||[,""])[1],a=t[n]||n,s=document.createElement("code");s.className="language-"+a,e.textContent="",s.textContent="Loading…",e.appendChild(s);var o=new XMLHttpRequest;o.open("GET",r,!0),o.onreadystatechange=function(){4==o.readyState&&(o.status<400&&o.responseText?(s.textContent=o.responseText,Prism.highlightElement(s)):s.textContent=o.status>=400?"✖ Error "+o.status+" while fetching file: "+o.statusText:"✖ Error: File does not exist or is empty")},o.send(null)})}}(); \ No newline at end of file +(function(){if(!self.Prism||!self.document||!document.querySelector){return}var a={js:"javascript",html:"markup",svg:"markup",xml:"markup",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell"};Array.prototype.slice.call(document.querySelectorAll("pre[data-src]")).forEach(function(c){var e=c.getAttribute("data-src");var g=(e.match(/\.(\w+)$/)||[,""])[1];var f=a[g]||g;var b=document.createElement("code");b.className="language-"+f;c.textContent="";b.textContent="Loading…";c.appendChild(b);var d=new XMLHttpRequest();d.open("GET",e,true);d.onreadystatechange=function(){if(d.readyState==4){if(d.status<400&&d.responseText){b.textContent=d.responseText;Prism.highlightElement(b)}else{if(d.status>=400){b.textContent="✖ Error "+d.status+" while fetching file: "+d.statusText}else{b.textContent="✖ Error: File does not exist or is empty"}}}};d.send(null)})})(); \ No newline at end of file From 75f4745cd8f6ec532d9855cfbf1269a8effece9d Mon Sep 17 00:00:00 2001 From: Daniel Flint Date: Wed, 31 Dec 2014 10:41:54 +1100 Subject: [PATCH 101/137] Filtered alias list --- components/prism-powershell.js | 4 +++- components/prism-powershell.min.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/prism-powershell.js b/components/prism-powershell.js index fddcb8fa98..2ecbc916d7 100644 --- a/components/prism-powershell.js +++ b/components/prism-powershell.js @@ -16,6 +16,7 @@ Prism.languages.powershell = { // Matches name spaces as well as casts, attribute decorators. Force starting with letter to avoid matching array indices 'namespace': /\[[a-z][\w\W]*?\]/i, 'variable': /(\$\w+)\b/ig, + // per http://technet.microsoft.com/en-us/library/hh847744.aspx 'keyword': /\b(Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|In|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/gi, 'function': [ { @@ -24,8 +25,9 @@ Prism.languages.powershell = { pattern: /\b(Add-(Computer|Content|History|Member|PSSnapin|Type)|Checkpoint-(Computer|Content|EventLog|History|Item|ItemProperty|Variable)|Compare-(Object)|Complete-(Transaction)|Connect-(PSSession)|ConvertFrom-(Csv|Json|StringData)|Convert-(Path)|ConvertTo-(Csv|Html|Json|Xml)|Copy-(Item|ItemProperty)|Debug-(Process)|Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disconnect-(PSSession)|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Enter-(PSSession)|Exit-(PSSession)|Export-(Alias|Clixml|Console|Csv|FormatData|ModuleMember|PSSession)|ForEach-(Object)|Format-(Custom|List|Table|Wide)|Get-(Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-(Object)|Import-(Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-(Path)|Limit-(EventLog)|Measure-(Command)|Measure-(Object)|Move-(Item|ItemProperty)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(Default|File|GridView|Host|Null|Printer|String)|Pop-(Location)|Push-(Location)|Read-(Host)|Receive-(Job)|Receive-(PSSession)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(Computer|Item|ItemProperty)|Reset-(ComputerMachinePassword)|Resolve-(Path)|Restart-(Computer|Service)|Restore-(Computer)|Resume-(Job|Service)|Save-(Help)|Select-(Object|String|Xml)|Send-(MailMessage)|Set-(Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(Command|ControlPanelItem|EventLog)|Sort-(Object)|Split-(Path)|Start-(Job|Process|Service|Sleep|Transaction)|Stop-(Computer|Job|Process|Service)|Suspend-(Job|Service)|Tee-(Object)|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)|Trace-(Command)|Unblock-(File)|Undo-(Transaction)|Unregister-(Event|PSSessionConfiguration)|Update-(FormatData)|Update-(Help|List|TypeData)|Use-(Transaction)|Wait-(Event|Job|Process)|Where-(Object)|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning))\b/gi }, { + // Get-Alias | ?{ $_.ReferencedCommand.Module.Name -match "Microsoft.PowerShell.(Util|Core|Management)" } // Aliases. Should come second, otherwise "write" gets preferred over "write-host" for example - pattern: /\b(ac|asnp|cat|cd|chdir|clc|clear|clhy|cli|clp|cls|clv|cnsn|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|dnsn|ebp|echo|epal|epcsv|epsn|erase|etsn|exsn|fc|fl|foreach|ft|fw|gal|gbp|gc|gci|gcm|gcs|gdr|ghy|gi|gjb|gl|gm|gmo|gp|gps|group|gsn|gsnp|gsv|gu|gv|gwmi|h|history|icm|iex|ihy|ii|ipal|ipcsv|ipmo|ipsn|irm|ise|iwmi|iwr|kill|lp|ls|man|md|measure|mi|mount|move|mp|mv|nal|ndr|ni|nmo|npssc|nsn|nv|ogv|oh|popd|ps|pushd|pwd|r|rbp|rcjb|rcsn|rd|rdr|ren|ri|rjb|rm|rmdir|rmo|rni|rnp|rp|rsn|rsnp|rujb|rv|rvpa|rwmi|sajb|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spjb|spps|spsv|start|sujb|sv|swmi|tee|trcm|type|where|wjb|write)\b/gi + pattern: /\b(ac|cat|cd|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/gi } ], 'operator': { diff --git a/components/prism-powershell.min.js b/components/prism-powershell.min.js index c424a6da83..29b67bf951 100644 --- a/components/prism-powershell.min.js +++ b/components/prism-powershell.min.js @@ -1 +1 @@ -Prism.languages.powershell={comment:[{pattern:/(^|[^`])<#[\w\W]*?#>/g,lookbehind:true},{pattern:/(^|[^`])#.*?(\r?\n|$)/g,lookbehind:true}],string:{pattern:/("|')(\\?.)*?\1/g,inside:{}},namespace:/\[[a-z][\w\W]*?\]/i,variable:/(\$\w+)\b/ig,keyword:/\b(Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|In|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/gi,"function":[{pattern:/\b(Add-(Computer|Content|History|Member|PSSnapin|Type)|Checkpoint-(Computer|Content|EventLog|History|Item|ItemProperty|Variable)|Compare-(Object)|Complete-(Transaction)|Connect-(PSSession)|ConvertFrom-(Csv|Json|StringData)|Convert-(Path)|ConvertTo-(Csv|Html|Json|Xml)|Copy-(Item|ItemProperty)|Debug-(Process)|Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disconnect-(PSSession)|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Enter-(PSSession)|Exit-(PSSession)|Export-(Alias|Clixml|Console|Csv|FormatData|ModuleMember|PSSession)|ForEach-(Object)|Format-(Custom|List|Table|Wide)|Get-(Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-(Object)|Import-(Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-(Path)|Limit-(EventLog)|Measure-(Command)|Measure-(Object)|Move-(Item|ItemProperty)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(Default|File|GridView|Host|Null|Printer|String)|Pop-(Location)|Push-(Location)|Read-(Host)|Receive-(Job)|Receive-(PSSession)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(Computer|Item|ItemProperty)|Reset-(ComputerMachinePassword)|Resolve-(Path)|Restart-(Computer|Service)|Restore-(Computer)|Resume-(Job|Service)|Save-(Help)|Select-(Object|String|Xml)|Send-(MailMessage)|Set-(Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(Command|ControlPanelItem|EventLog)|Sort-(Object)|Split-(Path)|Start-(Job|Process|Service|Sleep|Transaction)|Stop-(Computer|Job|Process|Service)|Suspend-(Job|Service)|Tee-(Object)|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)|Trace-(Command)|Unblock-(File)|Undo-(Transaction)|Unregister-(Event|PSSessionConfiguration)|Update-(FormatData)|Update-(Help|List|TypeData)|Use-(Transaction)|Wait-(Event|Job|Process)|Where-(Object)|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning))\b/gi},{pattern:/\b(ac|asnp|cat|cd|chdir|clc|clear|clhy|cli|clp|cls|clv|cnsn|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|dnsn|ebp|echo|epal|epcsv|epsn|erase|etsn|exsn|fc|fl|foreach|ft|fw|gal|gbp|gc|gci|gcm|gcs|gdr|ghy|gi|gjb|gl|gm|gmo|gp|gps|group|gsn|gsnp|gsv|gu|gv|gwmi|h|history|icm|iex|ihy|ii|ipal|ipcsv|ipmo|ipsn|irm|ise|iwmi|iwr|kill|lp|ls|man|md|measure|mi|mount|move|mp|mv|nal|ndr|ni|nmo|npssc|nsn|nv|ogv|oh|popd|ps|pushd|pwd|r|rbp|rcjb|rcsn|rd|rdr|ren|ri|rjb|rm|rmdir|rmo|rni|rnp|rp|rsn|rsnp|rujb|rv|rvpa|rwmi|sajb|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spjb|spps|spsv|start|sujb|sv|swmi|tee|trcm|type|where|wjb|write)\b/gi}],operator:{pattern:/(\W)-(and|x?or|not|eq|ne|gt|ge|lt|le|Like|(Not)?(Like|Match|Contains|In)|Replace)\b/gi,lookbehind:true}};Prism.languages.powershell.string.inside.variable=Prism.languages.powershell.variable; \ No newline at end of file +Prism.languages.powershell={comment:[{pattern:/(^|[^`])<#[\w\W]*?#>/g,lookbehind:true},{pattern:/(^|[^`])#.*?(\r?\n|$)/g,lookbehind:true}],string:{pattern:/("|')(\\?.)*?\1/g,inside:{}},namespace:/\[[a-z][\w\W]*?\]/i,variable:/(\$\w+)\b/ig,keyword:/\b(Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|In|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/gi,"function":[{pattern:/\b(Add-(Computer|Content|History|Member|PSSnapin|Type)|Checkpoint-(Computer|Content|EventLog|History|Item|ItemProperty|Variable)|Compare-(Object)|Complete-(Transaction)|Connect-(PSSession)|ConvertFrom-(Csv|Json|StringData)|Convert-(Path)|ConvertTo-(Csv|Html|Json|Xml)|Copy-(Item|ItemProperty)|Debug-(Process)|Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disconnect-(PSSession)|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Enter-(PSSession)|Exit-(PSSession)|Export-(Alias|Clixml|Console|Csv|FormatData|ModuleMember|PSSession)|ForEach-(Object)|Format-(Custom|List|Table|Wide)|Get-(Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-(Object)|Import-(Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-(Path)|Limit-(EventLog)|Measure-(Command)|Measure-(Object)|Move-(Item|ItemProperty)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(Default|File|GridView|Host|Null|Printer|String)|Pop-(Location)|Push-(Location)|Read-(Host)|Receive-(Job)|Receive-(PSSession)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(Computer|Item|ItemProperty)|Reset-(ComputerMachinePassword)|Resolve-(Path)|Restart-(Computer|Service)|Restore-(Computer)|Resume-(Job|Service)|Save-(Help)|Select-(Object|String|Xml)|Send-(MailMessage)|Set-(Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(Command|ControlPanelItem|EventLog)|Sort-(Object)|Split-(Path)|Start-(Job|Process|Service|Sleep|Transaction)|Stop-(Computer|Job|Process|Service)|Suspend-(Job|Service)|Tee-(Object)|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)|Trace-(Command)|Unblock-(File)|Undo-(Transaction)|Unregister-(Event|PSSessionConfiguration)|Update-(FormatData)|Update-(Help|List|TypeData)|Use-(Transaction)|Wait-(Event|Job|Process)|Where-(Object)|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning))\b/gi},{pattern:/\b(ac|cat|cd|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/gi}],operator:{pattern:/(\W)-(and|x?or|not|eq|ne|gt|ge|lt|le|Like|(Not)?(Like|Match|Contains|In)|Replace)\b/gi,lookbehind:true}};Prism.languages.powershell.string.inside.variable=Prism.languages.powershell.variable; \ No newline at end of file From 905d952f3c3a86926eba1db328d66dbecb278f44 Mon Sep 17 00:00:00 2001 From: Daniel Flint Date: Wed, 31 Dec 2014 11:45:30 +1100 Subject: [PATCH 102/137] Multiline strings, Booleans, combine regexps, punctuation --- components/prism-powershell.js | 25 ++++++++++--------------- components/prism-powershell.min.js | 2 +- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/components/prism-powershell.js b/components/prism-powershell.js index 2ecbc916d7..f0c39b15d4 100644 --- a/components/prism-powershell.js +++ b/components/prism-powershell.js @@ -10,30 +10,25 @@ Prism.languages.powershell = { } ], 'string': { - pattern: /("|')(\\?.)*?\1/g, + pattern: /("|')(`?[\w\W])*?\1/gm, inside: {} }, // Matches name spaces as well as casts, attribute decorators. Force starting with letter to avoid matching array indices 'namespace': /\[[a-z][\w\W]*?\]/i, - 'variable': /(\$\w+)\b/ig, + 'boolean': /\$(true|false)\b/i, + 'variable': /\$\w+\b/ig, // per http://technet.microsoft.com/en-us/library/hh847744.aspx 'keyword': /\b(Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|In|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/gi, - 'function': [ - { - // Full function names - // Get-Command | ?{ $_.ModuleName -match "Microsoft.PowerShell.(Util|Core|Management)" } - pattern: /\b(Add-(Computer|Content|History|Member|PSSnapin|Type)|Checkpoint-(Computer|Content|EventLog|History|Item|ItemProperty|Variable)|Compare-(Object)|Complete-(Transaction)|Connect-(PSSession)|ConvertFrom-(Csv|Json|StringData)|Convert-(Path)|ConvertTo-(Csv|Html|Json|Xml)|Copy-(Item|ItemProperty)|Debug-(Process)|Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disconnect-(PSSession)|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Enter-(PSSession)|Exit-(PSSession)|Export-(Alias|Clixml|Console|Csv|FormatData|ModuleMember|PSSession)|ForEach-(Object)|Format-(Custom|List|Table|Wide)|Get-(Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-(Object)|Import-(Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-(Path)|Limit-(EventLog)|Measure-(Command)|Measure-(Object)|Move-(Item|ItemProperty)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(Default|File|GridView|Host|Null|Printer|String)|Pop-(Location)|Push-(Location)|Read-(Host)|Receive-(Job)|Receive-(PSSession)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(Computer|Item|ItemProperty)|Reset-(ComputerMachinePassword)|Resolve-(Path)|Restart-(Computer|Service)|Restore-(Computer)|Resume-(Job|Service)|Save-(Help)|Select-(Object|String|Xml)|Send-(MailMessage)|Set-(Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(Command|ControlPanelItem|EventLog)|Sort-(Object)|Split-(Path)|Start-(Job|Process|Service|Sleep|Transaction)|Stop-(Computer|Job|Process|Service)|Suspend-(Job|Service)|Tee-(Object)|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)|Trace-(Command)|Unblock-(File)|Undo-(Transaction)|Unregister-(Event|PSSessionConfiguration)|Update-(FormatData)|Update-(Help|List|TypeData)|Use-(Transaction)|Wait-(Event|Job|Process)|Where-(Object)|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning))\b/gi - }, - { - // Get-Alias | ?{ $_.ReferencedCommand.Module.Name -match "Microsoft.PowerShell.(Util|Core|Management)" } - // Aliases. Should come second, otherwise "write" gets preferred over "write-host" for example - pattern: /\b(ac|cat|cd|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/gi - } - ], + // Cmdlets and aliases. Aliases should come last, otherwise "write" gets preferred over "write-host" for example + // Get-Command | ?{ $_.ModuleName -match "Microsoft.PowerShell.(Util|Core|Management)" } + // Get-Alias | ?{ $_.ReferencedCommand.Module.Name -match "Microsoft.PowerShell.(Util|Core|Management)" } + 'function': /\b(Add-(Computer|Content|History|Member|PSSnapin|Type)|Checkpoint-(Computer|Content|EventLog|History|Item|ItemProperty|Variable)|Compare-(Object)|Complete-(Transaction)|Connect-(PSSession)|ConvertFrom-(Csv|Json|StringData)|Convert-(Path)|ConvertTo-(Csv|Html|Json|Xml)|Copy-(Item|ItemProperty)|Debug-(Process)|Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disconnect-(PSSession)|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Enter-(PSSession)|Exit-(PSSession)|Export-(Alias|Clixml|Console|Csv|FormatData|ModuleMember|PSSession)|ForEach-(Object)|Format-(Custom|List|Table|Wide)|Get-(Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-(Object)|Import-(Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-(Path)|Limit-(EventLog)|Measure-(Command)|Measure-(Object)|Move-(Item|ItemProperty)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(Default|File|GridView|Host|Null|Printer|String)|Pop-(Location)|Push-(Location)|Read-(Host)|Receive-(Job)|Receive-(PSSession)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(Computer|Item|ItemProperty)|Reset-(ComputerMachinePassword)|Resolve-(Path)|Restart-(Computer|Service)|Restore-(Computer)|Resume-(Job|Service)|Save-(Help)|Select-(Object|String|Xml)|Send-(MailMessage)|Set-(Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(Command|ControlPanelItem|EventLog)|Sort-(Object)|Split-(Path)|Start-(Job|Process|Service|Sleep|Transaction)|Stop-(Computer|Job|Process|Service)|Suspend-(Job|Service)|Tee-(Object)|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)|Trace-(Command)|Unblock-(File)|Undo-(Transaction)|Unregister-(Event|PSSessionConfiguration)|Update-(FormatData)|Update-(Help|List|TypeData)|Use-(Transaction)|Wait-(Event|Job|Process)|Where-(Object)|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning)|ac|cat|cd|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/gi, 'operator': { pattern: /(\W)-(and|x?or|not|eq|ne|gt|ge|lt|le|Like|(Not)?(Like|Match|Contains|In)|Replace)\b/gi, lookbehind: true - } + }, + 'punctuation': /[|{}[\];(),.]/g }; // Variable interpolation inside strings +Prism.languages.powershell.string.inside.boolean = Prism.languages.powershell.boolean; Prism.languages.powershell.string.inside.variable = Prism.languages.powershell.variable; \ No newline at end of file diff --git a/components/prism-powershell.min.js b/components/prism-powershell.min.js index 29b67bf951..f0b7afdee3 100644 --- a/components/prism-powershell.min.js +++ b/components/prism-powershell.min.js @@ -1 +1 @@ -Prism.languages.powershell={comment:[{pattern:/(^|[^`])<#[\w\W]*?#>/g,lookbehind:true},{pattern:/(^|[^`])#.*?(\r?\n|$)/g,lookbehind:true}],string:{pattern:/("|')(\\?.)*?\1/g,inside:{}},namespace:/\[[a-z][\w\W]*?\]/i,variable:/(\$\w+)\b/ig,keyword:/\b(Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|In|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/gi,"function":[{pattern:/\b(Add-(Computer|Content|History|Member|PSSnapin|Type)|Checkpoint-(Computer|Content|EventLog|History|Item|ItemProperty|Variable)|Compare-(Object)|Complete-(Transaction)|Connect-(PSSession)|ConvertFrom-(Csv|Json|StringData)|Convert-(Path)|ConvertTo-(Csv|Html|Json|Xml)|Copy-(Item|ItemProperty)|Debug-(Process)|Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disconnect-(PSSession)|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Enter-(PSSession)|Exit-(PSSession)|Export-(Alias|Clixml|Console|Csv|FormatData|ModuleMember|PSSession)|ForEach-(Object)|Format-(Custom|List|Table|Wide)|Get-(Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-(Object)|Import-(Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-(Path)|Limit-(EventLog)|Measure-(Command)|Measure-(Object)|Move-(Item|ItemProperty)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(Default|File|GridView|Host|Null|Printer|String)|Pop-(Location)|Push-(Location)|Read-(Host)|Receive-(Job)|Receive-(PSSession)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(Computer|Item|ItemProperty)|Reset-(ComputerMachinePassword)|Resolve-(Path)|Restart-(Computer|Service)|Restore-(Computer)|Resume-(Job|Service)|Save-(Help)|Select-(Object|String|Xml)|Send-(MailMessage)|Set-(Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(Command|ControlPanelItem|EventLog)|Sort-(Object)|Split-(Path)|Start-(Job|Process|Service|Sleep|Transaction)|Stop-(Computer|Job|Process|Service)|Suspend-(Job|Service)|Tee-(Object)|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)|Trace-(Command)|Unblock-(File)|Undo-(Transaction)|Unregister-(Event|PSSessionConfiguration)|Update-(FormatData)|Update-(Help|List|TypeData)|Use-(Transaction)|Wait-(Event|Job|Process)|Where-(Object)|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning))\b/gi},{pattern:/\b(ac|cat|cd|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/gi}],operator:{pattern:/(\W)-(and|x?or|not|eq|ne|gt|ge|lt|le|Like|(Not)?(Like|Match|Contains|In)|Replace)\b/gi,lookbehind:true}};Prism.languages.powershell.string.inside.variable=Prism.languages.powershell.variable; \ No newline at end of file +Prism.languages.powershell={comment:[{pattern:/(^|[^`])<#[\w\W]*?#>/g,lookbehind:true},{pattern:/(^|[^`])#.*?(\r?\n|$)/g,lookbehind:true}],string:{pattern:/("|')(`?[\w\W])*?\1/gm,inside:{}},namespace:/\[[a-z][\w\W]*?\]/i,"boolean":/\$(true|false)\b/i,variable:/\$\w+\b/ig,keyword:/\b(Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|In|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/gi,"function":/\b(Add-(Computer|Content|History|Member|PSSnapin|Type)|Checkpoint-(Computer|Content|EventLog|History|Item|ItemProperty|Variable)|Compare-(Object)|Complete-(Transaction)|Connect-(PSSession)|ConvertFrom-(Csv|Json|StringData)|Convert-(Path)|ConvertTo-(Csv|Html|Json|Xml)|Copy-(Item|ItemProperty)|Debug-(Process)|Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disconnect-(PSSession)|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Enter-(PSSession)|Exit-(PSSession)|Export-(Alias|Clixml|Console|Csv|FormatData|ModuleMember|PSSession)|ForEach-(Object)|Format-(Custom|List|Table|Wide)|Get-(Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-(Object)|Import-(Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-(Path)|Limit-(EventLog)|Measure-(Command)|Measure-(Object)|Move-(Item|ItemProperty)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(Default|File|GridView|Host|Null|Printer|String)|Pop-(Location)|Push-(Location)|Read-(Host)|Receive-(Job)|Receive-(PSSession)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(Computer|Item|ItemProperty)|Reset-(ComputerMachinePassword)|Resolve-(Path)|Restart-(Computer|Service)|Restore-(Computer)|Resume-(Job|Service)|Save-(Help)|Select-(Object|String|Xml)|Send-(MailMessage)|Set-(Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(Command|ControlPanelItem|EventLog)|Sort-(Object)|Split-(Path)|Start-(Job|Process|Service|Sleep|Transaction)|Stop-(Computer|Job|Process|Service)|Suspend-(Job|Service)|Tee-(Object)|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)|Trace-(Command)|Unblock-(File)|Undo-(Transaction)|Unregister-(Event|PSSessionConfiguration)|Update-(FormatData)|Update-(Help|List|TypeData)|Use-(Transaction)|Wait-(Event|Job|Process)|Where-(Object)|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning)|ac|cat|cd|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/gi,operator:{pattern:/(\W)-(and|x?or|not|eq|ne|gt|ge|lt|le|Like|(Not)?(Like|Match|Contains|In)|Replace)\b/gi,lookbehind:true},punctuation:/[|{}[\];(),.]/g};Prism.languages.powershell.string.inside.boolean=Prism.languages.powershell.boolean;Prism.languages.powershell.string.inside.variable=Prism.languages.powershell.variable; \ No newline at end of file From 6531900cf2d76e931f4ca7070b437604f71fa2fc Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 3 Jan 2015 11:13:51 +0100 Subject: [PATCH 103/137] Fix SCSS highlighting after removal of the "ignore" pattern in CSS --- components/prism-scss.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-scss.js b/components/prism-scss.js index bc396a4d65..063b65f87a 100644 --- a/components/prism-scss.js +++ b/components/prism-scss.js @@ -27,7 +27,7 @@ Prism.languages.insertBefore('scss', 'property', { 'variable': /((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i }); -Prism.languages.insertBefore('scss', 'ignore', { +Prism.languages.insertBefore('scss', 'function', { 'placeholder': /%[-_\w]+/i, 'statement': /\B!(default|optional)\b/gi, 'boolean': /\b(true|false)\b/g, From 95995e90b84e56f85dc6ce90582ab9e80a64626e Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 3 Jan 2015 11:20:39 +0100 Subject: [PATCH 104/137] Run gulp tasks --- components/prism-powershell.min.js | 2 +- components/prism-scss.min.js | 2 +- plugins/file-highlight/prism-file-highlight.min.js | 2 +- prism.js | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/components/prism-powershell.min.js b/components/prism-powershell.min.js index f0b7afdee3..ae9c02dcef 100644 --- a/components/prism-powershell.min.js +++ b/components/prism-powershell.min.js @@ -1 +1 @@ -Prism.languages.powershell={comment:[{pattern:/(^|[^`])<#[\w\W]*?#>/g,lookbehind:true},{pattern:/(^|[^`])#.*?(\r?\n|$)/g,lookbehind:true}],string:{pattern:/("|')(`?[\w\W])*?\1/gm,inside:{}},namespace:/\[[a-z][\w\W]*?\]/i,"boolean":/\$(true|false)\b/i,variable:/\$\w+\b/ig,keyword:/\b(Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|In|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/gi,"function":/\b(Add-(Computer|Content|History|Member|PSSnapin|Type)|Checkpoint-(Computer|Content|EventLog|History|Item|ItemProperty|Variable)|Compare-(Object)|Complete-(Transaction)|Connect-(PSSession)|ConvertFrom-(Csv|Json|StringData)|Convert-(Path)|ConvertTo-(Csv|Html|Json|Xml)|Copy-(Item|ItemProperty)|Debug-(Process)|Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disconnect-(PSSession)|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Enter-(PSSession)|Exit-(PSSession)|Export-(Alias|Clixml|Console|Csv|FormatData|ModuleMember|PSSession)|ForEach-(Object)|Format-(Custom|List|Table|Wide)|Get-(Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-(Object)|Import-(Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-(Path)|Limit-(EventLog)|Measure-(Command)|Measure-(Object)|Move-(Item|ItemProperty)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(Default|File|GridView|Host|Null|Printer|String)|Pop-(Location)|Push-(Location)|Read-(Host)|Receive-(Job)|Receive-(PSSession)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(Computer|Item|ItemProperty)|Reset-(ComputerMachinePassword)|Resolve-(Path)|Restart-(Computer|Service)|Restore-(Computer)|Resume-(Job|Service)|Save-(Help)|Select-(Object|String|Xml)|Send-(MailMessage)|Set-(Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(Command|ControlPanelItem|EventLog)|Sort-(Object)|Split-(Path)|Start-(Job|Process|Service|Sleep|Transaction)|Stop-(Computer|Job|Process|Service)|Suspend-(Job|Service)|Tee-(Object)|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)|Trace-(Command)|Unblock-(File)|Undo-(Transaction)|Unregister-(Event|PSSessionConfiguration)|Update-(FormatData)|Update-(Help|List|TypeData)|Use-(Transaction)|Wait-(Event|Job|Process)|Where-(Object)|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning)|ac|cat|cd|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/gi,operator:{pattern:/(\W)-(and|x?or|not|eq|ne|gt|ge|lt|le|Like|(Not)?(Like|Match|Contains|In)|Replace)\b/gi,lookbehind:true},punctuation:/[|{}[\];(),.]/g};Prism.languages.powershell.string.inside.boolean=Prism.languages.powershell.boolean;Prism.languages.powershell.string.inside.variable=Prism.languages.powershell.variable; \ No newline at end of file +Prism.languages.powershell={comment:[{pattern:/(^|[^`])<#[\w\W]*?#>/g,lookbehind:!0},{pattern:/(^|[^`])#.*?(\r?\n|$)/g,lookbehind:!0}],string:{pattern:/("|')(`?[\w\W])*?\1/gm,inside:{}},namespace:/\[[a-z][\w\W]*?\]/i,"boolean":/\$(true|false)\b/i,variable:/\$\w+\b/gi,keyword:/\b(Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|In|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/gi,"function":/\b(Add-(Computer|Content|History|Member|PSSnapin|Type)|Checkpoint-(Computer|Content|EventLog|History|Item|ItemProperty|Variable)|Compare-(Object)|Complete-(Transaction)|Connect-(PSSession)|ConvertFrom-(Csv|Json|StringData)|Convert-(Path)|ConvertTo-(Csv|Html|Json|Xml)|Copy-(Item|ItemProperty)|Debug-(Process)|Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disconnect-(PSSession)|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Enter-(PSSession)|Exit-(PSSession)|Export-(Alias|Clixml|Console|Csv|FormatData|ModuleMember|PSSession)|ForEach-(Object)|Format-(Custom|List|Table|Wide)|Get-(Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-(Object)|Import-(Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-(Path)|Limit-(EventLog)|Measure-(Command)|Measure-(Object)|Move-(Item|ItemProperty)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(Default|File|GridView|Host|Null|Printer|String)|Pop-(Location)|Push-(Location)|Read-(Host)|Receive-(Job)|Receive-(PSSession)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(Computer|Item|ItemProperty)|Reset-(ComputerMachinePassword)|Resolve-(Path)|Restart-(Computer|Service)|Restore-(Computer)|Resume-(Job|Service)|Save-(Help)|Select-(Object|String|Xml)|Send-(MailMessage)|Set-(Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(Command|ControlPanelItem|EventLog)|Sort-(Object)|Split-(Path)|Start-(Job|Process|Service|Sleep|Transaction)|Stop-(Computer|Job|Process|Service)|Suspend-(Job|Service)|Tee-(Object)|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)|Trace-(Command)|Unblock-(File)|Undo-(Transaction)|Unregister-(Event|PSSessionConfiguration)|Update-(FormatData)|Update-(Help|List|TypeData)|Use-(Transaction)|Wait-(Event|Job|Process)|Where-(Object)|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning)|ac|cat|cd|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/gi,operator:{pattern:/(\W)-(and|x?or|not|eq|ne|gt|ge|lt|le|Like|(Not)?(Like|Match|Contains|In)|Replace)\b/gi,lookbehind:!0},punctuation:/[|{}[\];(),.]/g},Prism.languages.powershell.string.inside.boolean=Prism.languages.powershell.boolean,Prism.languages.powershell.string.inside.variable=Prism.languages.powershell.variable; \ No newline at end of file diff --git a/components/prism-scss.min.js b/components/prism-scss.min.js index 7b3d783263..c70c3f3be3 100644 --- a/components/prism-scss.min.js +++ b/components/prism-scss.min.js @@ -1 +1 @@ -Prism.languages.scss=Prism.languages.extend("css",{comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,lookbehind:!0},atrule:/@[\w-]+(?=\s+(\(|\{|;))/gi,url:/([-a-z]+-)*url(?=\()/gi,selector:/([^@;\{\}\(\)]?([^@;\{\}\(\)]|&|\#\{\$[-_\w]+\})+)(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/gm}),Prism.languages.insertBefore("scss","atrule",{keyword:/@(if|else if|else|for|each|while|import|extend|debug|warn|mixin|include|function|return|content)|(?=@for\s+\$[-_\w]+\s)+from/i}),Prism.languages.insertBefore("scss","property",{variable:/((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i}),Prism.languages.insertBefore("scss","ignore",{placeholder:/%[-_\w]+/i,statement:/\B!(default|optional)\b/gi,"boolean":/\b(true|false)\b/g,"null":/\b(null)\b/g,operator:/\s+([-+]{1,2}|={1,2}|!=|\|?\||\?|\*|\/|\%)\s+/g}); \ No newline at end of file +Prism.languages.scss=Prism.languages.extend("css",{comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,lookbehind:!0},atrule:/@[\w-]+(?=\s+(\(|\{|;))/gi,url:/([-a-z]+-)*url(?=\()/gi,selector:/([^@;\{\}\(\)]?([^@;\{\}\(\)]|&|\#\{\$[-_\w]+\})+)(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/gm}),Prism.languages.insertBefore("scss","atrule",{keyword:/@(if|else if|else|for|each|while|import|extend|debug|warn|mixin|include|function|return|content)|(?=@for\s+\$[-_\w]+\s)+from/i}),Prism.languages.insertBefore("scss","property",{variable:/((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i}),Prism.languages.insertBefore("scss","function",{placeholder:/%[-_\w]+/i,statement:/\B!(default|optional)\b/gi,"boolean":/\b(true|false)\b/g,"null":/\b(null)\b/g,operator:/\s+([-+]{1,2}|={1,2}|!=|\|?\||\?|\*|\/|\%)\s+/g}); \ No newline at end of file diff --git a/plugins/file-highlight/prism-file-highlight.min.js b/plugins/file-highlight/prism-file-highlight.min.js index 4cc453a71d..17d61bc5f1 100644 --- a/plugins/file-highlight/prism-file-highlight.min.js +++ b/plugins/file-highlight/prism-file-highlight.min.js @@ -1 +1 @@ -(function(){if(!self.Prism||!self.document||!document.querySelector){return}var a={js:"javascript",html:"markup",svg:"markup",xml:"markup",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell"};Array.prototype.slice.call(document.querySelectorAll("pre[data-src]")).forEach(function(c){var e=c.getAttribute("data-src");var g=(e.match(/\.(\w+)$/)||[,""])[1];var f=a[g]||g;var b=document.createElement("code");b.className="language-"+f;c.textContent="";b.textContent="Loading…";c.appendChild(b);var d=new XMLHttpRequest();d.open("GET",e,true);d.onreadystatechange=function(){if(d.readyState==4){if(d.status<400&&d.responseText){b.textContent=d.responseText;Prism.highlightElement(b)}else{if(d.status>=400){b.textContent="✖ Error "+d.status+" while fetching file: "+d.statusText}else{b.textContent="✖ Error: File does not exist or is empty"}}}};d.send(null)})})(); \ No newline at end of file +!function(){if(self.Prism&&self.document&&document.querySelector){var e={js:"javascript",html:"markup",svg:"markup",xml:"markup",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell"};Array.prototype.slice.call(document.querySelectorAll("pre[data-src]")).forEach(function(t){var r=t.getAttribute("data-src"),n=(r.match(/\.(\w+)$/)||[,""])[1],s=e[n]||n,a=document.createElement("code");a.className="language-"+s,t.textContent="",a.textContent="Loading…",t.appendChild(a);var o=new XMLHttpRequest;o.open("GET",r,!0),o.onreadystatechange=function(){4==o.readyState&&(o.status<400&&o.responseText?(a.textContent=o.responseText,Prism.highlightElement(a)):a.textContent=o.status>=400?"✖ Error "+o.status+" while fetching file: "+o.statusText:"✖ Error: File does not exist or is empty")},o.send(null)})}}(); \ No newline at end of file diff --git a/prism.js b/prism.js index 4826c35fd9..cdb04d2c4c 100644 --- a/prism.js +++ b/prism.js @@ -619,7 +619,9 @@ var Extensions = { 'svg': 'markup', 'xml': 'markup', 'py': 'python', - 'rb': 'ruby' + 'rb': 'ruby', + 'ps1': 'powershell', + 'psm1': 'powershell' }; Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function(pre) { From 987e8f28992a8a95ba9be7892a5b5374b0196df2 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 3 Jan 2015 12:31:33 +0100 Subject: [PATCH 105/137] Added examples for C-like, C#, Gherkin, Groovy, Java, NSIS, Rip and SCSS --- examples/prism-clike.html | 29 +++++++++++ examples/prism-csharp.html | 69 +++++++++++++++++++++++++++ examples/prism-gherkin.html | 31 ++++++++++++ examples/prism-groovy.html | 95 +++++++++++++++++++++++++++++++++++++ examples/prism-java.html | 78 ++++++++++++++++++++++++++++++ examples/prism-nsis.html | 32 +++++++++++++ examples/prism-rip.html | 15 ++++++ examples/prism-scss.html | 34 +++++++++++++ 8 files changed, 383 insertions(+) create mode 100644 examples/prism-clike.html create mode 100644 examples/prism-csharp.html create mode 100644 examples/prism-gherkin.html create mode 100644 examples/prism-groovy.html create mode 100644 examples/prism-java.html create mode 100644 examples/prism-nsis.html create mode 100644 examples/prism-rip.html create mode 100644 examples/prism-scss.html diff --git a/examples/prism-clike.html b/examples/prism-clike.html new file mode 100644 index 0000000000..9e68f25c2b --- /dev/null +++ b/examples/prism-clike.html @@ -0,0 +1,29 @@ +

C-like

+

The C-like component is not really a language on its own, + it is the basis of many other components. To use it directly, however, + use the class "language-clike".

+ +

Comments

+
// Single line comment
+/* Multi-line
+comment */
+ +

Strings

+
"foo \"bar\" baz";
+'foo \'bar\' baz';
+ +

Numbers

+
123
+123.456
+-123.456
+1e-23
+123.456E789
+0xaf
+0xAF
+
+ +

Functions

+
foo();
+Bar();
+_456();
+
\ No newline at end of file diff --git a/examples/prism-csharp.html b/examples/prism-csharp.html new file mode 100644 index 0000000000..84d760f14d --- /dev/null +++ b/examples/prism-csharp.html @@ -0,0 +1,69 @@ +

C#

+

To use this language, use the class "language-csharp".

+ +

Comments

+
// Single line comment
+/* Multi-line
+comment */
+ +

Strings

+
"foo \"bar\" baz"
+'foo \'bar\' baz'
+@"Verbatim strings"
+
+ +

Full example

+
using System.Windows.Forms;
+using System.Drawing;
+
+public static DialogResult InputBox(string title, string promptText, ref string value)
+{
+  Form form = new Form();
+  Label label = new Label();
+  TextBox textBox = new TextBox();
+  Button buttonOk = new Button();
+  Button buttonCancel = new Button();
+
+  form.Text = title;
+  label.Text = promptText;
+  textBox.Text = value;
+
+  buttonOk.Text = "OK";
+  buttonCancel.Text = "Cancel";
+  buttonOk.DialogResult = DialogResult.OK;
+  buttonCancel.DialogResult = DialogResult.Cancel;
+
+  label.SetBounds(9, 20, 372, 13);
+  textBox.SetBounds(12, 36, 372, 20);
+  buttonOk.SetBounds(228, 72, 75, 23);
+  buttonCancel.SetBounds(309, 72, 75, 23);
+
+  label.AutoSize = true;
+  textBox.Anchor = textBox.Anchor | AnchorStyles.Right;
+  buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+  buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+
+  form.ClientSize = new Size(396, 107);
+  form.Controls.AddRange(new Control[] { label, textBox, buttonOk, buttonCancel });
+  form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height);
+  form.FormBorderStyle = FormBorderStyle.FixedDialog;
+  form.StartPosition = FormStartPosition.CenterScreen;
+  form.MinimizeBox = false;
+  form.MaximizeBox = false;
+  form.AcceptButton = buttonOk;
+  form.CancelButton = buttonCancel;
+
+  DialogResult dialogResult = form.ShowDialog();
+  value = textBox.Text;
+  return dialogResult;
+}
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Comment-like substrings

+
"foo /* bar */ baz"; "foo // bar";
\ No newline at end of file diff --git a/examples/prism-gherkin.html b/examples/prism-gherkin.html new file mode 100644 index 0000000000..b3f389b43d --- /dev/null +++ b/examples/prism-gherkin.html @@ -0,0 +1,31 @@ +

Gherkin

+

To use this language, use the class "language-gherkin".

+ +

Comments

+
// Single line comment
+/* Multi-line
+comment */
+ +

Strings

+
"foo \"bar\" baz"
+'foo \'bar\' baz'
+ +

Full example

+
Feature: Some terse yet descriptive text of what is desired
+  In order to realize a named business value
+  As an explicit system actor
+  I want to gain some beneficial outcome which furthers the goal
+
+  Additional text...
+
+  Scenario: Some determinable business situation
+    Given some precondition
+    And some other precondition
+    When some action by the actor
+    And some other action
+    And yet another action
+    Then some testable outcome is achieved
+    And something else we can check happens too
+
+  Scenario: A different situation
+    ...
diff --git a/examples/prism-groovy.html b/examples/prism-groovy.html new file mode 100644 index 0000000000..dd1824722f --- /dev/null +++ b/examples/prism-groovy.html @@ -0,0 +1,95 @@ +

Groovy

+

To use this language, use the class "language-groovy".

+ +

Comments

+
// Single line comment
+/* Multi-line
+comment */
+ +

Strings

+
"foo 'bar' baz"
+'foo "bar" baz'
+"""Multi-line
+string"""
+'''Multi-line
+string'''
+"String /containing/ slashes"
+
+ +

Slashy strings (regex)

+
/.*foo.*/
+/regex"containing quotes"/
+$/.*"(.*)".*/(.*)/$
+ +

Interpolation inside GStrings and regex

+
"The answer is ${42}"
+"The $foxtype ${foxcolor.join()} fox"
+'No interpolation here : ${42}'
+ +

Full example

+
/*
+    The input string to parse is from...
+    <...the rest of the header comment from above...>
+*/
+boolean debugging = true
+
+if (debugging) {
+    // Test data
+    dfkOutput = '''
+Filesystem           1K-blocks      Used Available Use% Mounted on
+/dev/sda1              4185956   1206996   2762888  31% /
+/dev/sda11            30679784  28324040    772140  98% /extra
+fas3050c-1-2.b:/vol/canis
+                      10485760   6599936   3885824  63% /nfs/data_d2/dog_data
+fas6070-1-1.b:/vol/felis
+                     314572800  54889600 259683200  18% /nfs/DATA-1/cat_data
+'''
+} else {
+    // Real data
+    dfkOutput = 'df -k'.execute().text
+}
+
+long kbAvail = 0
+
+regex =  '''(?ix)      # enable case-insensitive matches, extended patterns
+            (\\d+)     # 1: The disk space we want
+            \\s+       # some whitespace
+            \\d+%      # a number followed by??%
+            \\s+       # some more whitespace
+            (/nfs/data.*)  # 2: partition name'''
+
+pattern = ~regex
+matcher = pattern.matcher(dfkOutput)
+
+if (debugging) {
+    println """matcher pattern:
+/---------------------------------\\
+${matcher.pattern()}
+\\---------------------------------/"""
+
+    println "match count=${matcher.getCount()}"
+}
+
+for (i=0; i < matcher.getCount(); i++) {
+    if (debugging) {
+        println "    text matched in matcher[${i}]: '" + matcher[i][0] + "'"
+        println "        free space in  (group 1): '" + matcher[i][1] + "'"
+        println "        partition name (group 2): '" + matcher[i][2] + "'"
+    }
+    kbAvail += matcher[i][1].toLong()
+}
+
+println "KB available=${kbAvail}"
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Comment-like substrings

+
"foo /* bar */ baz"; "foo // bar";
+ +

Slashy string containing escaped slash

+
/foo\/bar/
\ No newline at end of file diff --git a/examples/prism-java.html b/examples/prism-java.html new file mode 100644 index 0000000000..65e8767a7a --- /dev/null +++ b/examples/prism-java.html @@ -0,0 +1,78 @@ +

Java

+

To use this language, use the class "language-java".

+ +

Comments

+
// Single line comment
+/* Multi-line
+comment */
+ +

Strings

+
"foo \"bar\" baz";
+'foo \'bar\' baz';
+ +

Numbers

+
123
+123.456
+-123.456
+1e-23
+123.456E789
+.3f
+1e-9d
+0xaf
+0xAF
+0xFF.AEP-4
+
+ +

Full example

+
import java.util.Scanner;
+
+public class Life {
+    public static void show(boolean[][] grid){
+        String s = "";
+        for(boolean[] row : grid){
+            for(boolean val : row)
+                if(val)
+                    s += "*";
+                else
+                    s += ".";
+            s += "\n";
+        }
+        System.out.println(s);
+    }
+
+    public static boolean[][] gen(){
+        boolean[][] grid = new boolean[10][10];
+        for(int r = 0; r < 10; r++)
+            for(int c = 0; c < 10; c++)
+                if( Math.random() > 0.7 )
+                    grid[r][c] = true;
+        return grid;
+    }
+
+    public static void main(String[] args){
+        boolean[][] world = gen();
+        show(world);
+        System.out.println();
+        world = nextGen(world);
+        show(world);
+        Scanner s = new Scanner(System.in);
+        while(s.nextLine().length() == 0){
+            System.out.println();
+            world = nextGen(world);
+            show(world);
+
+        }
+    }
+
+	// [...]
+}
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Comment-like substrings

+
"foo /* bar */ baz"; "foo // bar";
\ No newline at end of file diff --git a/examples/prism-nsis.html b/examples/prism-nsis.html new file mode 100644 index 0000000000..d8cb73c8e1 --- /dev/null +++ b/examples/prism-nsis.html @@ -0,0 +1,32 @@ +

NSIS

+

To use this language, use the class "language-nsis".

+ +

Comments

+
; Single line comment
+# Single line comment
+/* Multi-line
+comment */
+ +

Strings

+
"foo \"bar\" baz"
+'foo \'bar\' baz'
+ +

Variables

+
LicenseLangString myLicenseData ${LANG_ENGLISH} "bigtest.nsi"
+LicenseData $(myLicenseData)
+StrCmp $LANGUAGE ${LANG_ENGLISH} 0 +2
+ +

Compiler commands

+
!define VERSION "1.0.3"
+!insertmacro MyFunc ""
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Comment-like substrings

+
"foo /* bar */ baz"
+"foo ; bar";
\ No newline at end of file diff --git a/examples/prism-rip.html b/examples/prism-rip.html new file mode 100644 index 0000000000..5d192798c0 --- /dev/null +++ b/examples/prism-rip.html @@ -0,0 +1,15 @@ +

Rip

+

To use this language, use the class "language-rip".

+ +

Comments

+
# This is a comment
+ +

Strings

+
"foo \"bar\" baz"
+'foo \'bar\' baz'
+ +

Regex

+
regular_expression = /abc/
+ +

Symbols

+
string_symbol = :rip 
\ No newline at end of file diff --git a/examples/prism-scss.html b/examples/prism-scss.html new file mode 100644 index 0000000000..0cbecb1e52 --- /dev/null +++ b/examples/prism-scss.html @@ -0,0 +1,34 @@ +

Sass (Scss)

+

To use this language, use the class "language-scss".

+ +

Comments

+
// Single line comment
+/* Multi-line
+comment */
+ +

At-rules

+
@import "foo.scss";
+@media screen and (orientation: landscape) {}
+.seriousError {
+    @extend .error;
+}
+@for $i from 1 through 3 {}
+
+ +

Compass URLs

+
@font-face {
+	font-family: "opensans";
+	src: font-url("opensans.ttf");
+}
+ +

Variables

+
$width: 5em;
+#main {
+    width: $width;
+}
+ +

Interpolations are highlighted in property names

+
p.#{$name} {
+    #{$attr}-color: blue;
+}
+
\ No newline at end of file From a1dcf1aeaf0540aafe3da5274137217fb271cd67 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 3 Jan 2015 12:37:50 +0100 Subject: [PATCH 106/137] Add known failures for C-like --- examples/prism-clike.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/prism-clike.html b/examples/prism-clike.html index 9e68f25c2b..a1ec32f5f6 100644 --- a/examples/prism-clike.html +++ b/examples/prism-clike.html @@ -26,4 +26,14 @@

Functions

foo();
 Bar();
 _456();
-
\ No newline at end of file +
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Comment-like substrings

+
"foo /* bar */ baz"; "foo // bar";
\ No newline at end of file From fe9e174be1399ae78b291eaeb5cd66e30a45c1d0 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 3 Jan 2015 12:45:13 +0100 Subject: [PATCH 107/137] Removed broken java examples --- examples/prism-java.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/prism-java.html b/examples/prism-java.html index 65e8767a7a..14e0a196ca 100644 --- a/examples/prism-java.html +++ b/examples/prism-java.html @@ -14,10 +14,8 @@

Numbers

123
 123.456
 -123.456
-1e-23
-123.456E789
 .3f
-1e-9d
+1.3e9d
 0xaf
 0xAF
 0xFF.AEP-4

From dcf31d29f2cdfd0b65e5841cf7f6de9bed6bc506 Mon Sep 17 00:00:00 2001
From: Golmote 
Date: Sat, 3 Jan 2015 12:46:12 +0100
Subject: [PATCH 108/137] Little fix for Java numbers

---
 components/prism-java.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/components/prism-java.js b/components/prism-java.js
index 27fdadca0d..afe4fd9051 100644
--- a/components/prism-java.js
+++ b/components/prism-java.js
@@ -1,6 +1,6 @@
 Prism.languages.java = Prism.languages.extend('clike', {
 	'keyword': /\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/g,
-	'number': /\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+[e]?[\d]*[df]\b|\W\d*\.?\d+\b/gi,
+	'number': /\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+[e]?[\d]*[df]\b|\b\d*\.?\d+\b/gi,
 	'operator': {
 		pattern: /(^|[^\.])(?:\+=|\+\+?|-=|--?|!=?|<{1,2}=?|>{1,3}=?|==?|&=|&&?|\|=|\|\|?|\?|\*=?|\/=?|%=?|\^=?|:|~)/gm,
 		lookbehind: true

From f57df1ec9391bc10d6e67abce5c33c6be883b472 Mon Sep 17 00:00:00 2001
From: Golmote 
Date: Sat, 3 Jan 2015 12:56:15 +0100
Subject: [PATCH 109/137] Fixes on examples

---
 examples/prism-gherkin.html |  2 +-
 examples/prism-groovy.html  |  7 ++++---
 examples/prism-scss.html    | 14 ++++++++++++--
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/examples/prism-gherkin.html b/examples/prism-gherkin.html
index b3f389b43d..bc76f8ce2d 100644
--- a/examples/prism-gherkin.html
+++ b/examples/prism-gherkin.html
@@ -10,7 +10,7 @@ 

Strings

"foo \"bar\" baz"
 'foo \'bar\' baz'
-

Full example

+

Keywords

Feature: Some terse yet descriptive text of what is desired
   In order to realize a named business value
   As an explicit system actor
diff --git a/examples/prism-groovy.html b/examples/prism-groovy.html
index dd1824722f..d4f0f8f498 100644
--- a/examples/prism-groovy.html
+++ b/examples/prism-groovy.html
@@ -22,9 +22,10 @@ 

Slashy strings (regex)

$/.*"(.*)".*/(.*)/$

Interpolation inside GStrings and regex

-
"The answer is ${42}"
+
"The answer is ${21*2}"
 "The $foxtype ${foxcolor.join()} fox"
-'No interpolation here : ${42}'
+/foo${21*2}baz/ +'No interpolation here : ${21*2}'

Full example

/*
@@ -91,5 +92,5 @@ 

Known failures

Comment-like substrings

"foo /* bar */ baz"; "foo // bar";
-

Slashy string containing escaped slash

+

Slashy strings containing (escaped) slashes

/foo\/bar/
\ No newline at end of file diff --git a/examples/prism-scss.html b/examples/prism-scss.html index 0cbecb1e52..bc42e66986 100644 --- a/examples/prism-scss.html +++ b/examples/prism-scss.html @@ -8,7 +8,7 @@

Comments

At-rules

@import "foo.scss";
-@media screen and (orientation: landscape) {}
+@media (min-width: 600px) {}
 .seriousError {
     @extend .error;
 }
@@ -31,4 +31,14 @@ 

Interpolations are highlighted in property names

p.#{$name} {
     #{$attr}-color: blue;
 }
-
\ No newline at end of file +
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Media queries are not highlighted properly when not starting with a parenthesis.

+
@media screen {}
\ No newline at end of file From 1a17930bbf5fbf66115d16b3f6d2e7406608172d Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 3 Jan 2015 12:56:49 +0100 Subject: [PATCH 110/137] Run gulp task --- components/prism-java.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-java.min.js b/components/prism-java.min.js index bbf9332c24..2accb7e493 100644 --- a/components/prism-java.min.js +++ b/components/prism-java.min.js @@ -1 +1 @@ -Prism.languages.java=Prism.languages.extend("clike",{keyword:/\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/g,number:/\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+[e]?[\d]*[df]\b|\W\d*\.?\d+\b/gi,operator:{pattern:/(^|[^\.])(?:\+=|\+\+?|-=|--?|!=?|<{1,2}=?|>{1,3}=?|==?|&=|&&?|\|=|\|\|?|\?|\*=?|\/=?|%=?|\^=?|:|~)/gm,lookbehind:!0}}); \ No newline at end of file +Prism.languages.java=Prism.languages.extend("clike",{keyword:/\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/g,number:/\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+[e]?[\d]*[df]\b|\b\d*\.?\d+\b/gi,operator:{pattern:/(^|[^\.])(?:\+=|\+\+?|-=|--?|!=?|<{1,2}=?|>{1,3}=?|==?|&=|&&?|\|=|\|\|?|\?|\*=?|\/=?|%=?|\^=?|:|~)/gm,lookbehind:!0}}); \ No newline at end of file From 19c6a2583c8b34304762c4c6ebd648c3ee08b07d Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 4 Jan 2015 14:06:50 +0100 Subject: [PATCH 111/137] Fixed Pascal numbers and "&" lookbehind --- components/prism-pascal.js | 12 ++++++------ components/prism-pascal.min.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/prism-pascal.js b/components/prism-pascal.js index 1ab946b96b..8760bc9c60 100644 --- a/components/prism-pascal.js +++ b/components/prism-pascal.js @@ -18,35 +18,35 @@ Prism.languages.pascal = { 'keyword': [ { // Turbo Pascal - pattern: /(^|(?!&).)\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i, + pattern: /(^|(?!&)[\s\S])\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i, lookbehind: true }, { // Free Pascal - pattern: /(^|(?!&).)\b(?:dispose|exit|false|new|true)\b/i, + pattern: /(^|(?!&)[\s\S])\b(?:dispose|exit|false|new|true)\b/i, lookbehind: true }, { // Object Pascal - pattern: /(^|(?!&).)\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i, + pattern: /(^|(?!&)[\s\S])\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i, lookbehind: true }, { // Modifiers - pattern: /(^|(?!&).)\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i, + pattern: /(^|(?!&)[\s\S])\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i, lookbehind: true } ], 'number': [ // Hexadecimal, octal and binary - /[+-]?[&$%][a-f\d]+/i, + /[+-]?(?:[&%]\d+|\$[a-f\d]+)/i, // Decimal /([+-]|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?/i ], 'operator': [ /\.\.|\*\*|:=|[<>]{2}|[<>+\-*\/]=?|[@^=]/i, { - pattern: /(^|(?!&).)\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/, + pattern: /(^|(?!&)[\s\S])\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/, lookbehind: true } ], diff --git a/components/prism-pascal.min.js b/components/prism-pascal.min.js index 536224831b..9ea26a0fb0 100644 --- a/components/prism-pascal.min.js +++ b/components/prism-pascal.min.js @@ -1 +1 @@ -Prism.languages.pascal={comment:[/\(\*.+?\*\)/,/\{.+?\}/,/\/\/.*/],string:[/(?:'(?:''|[^'\n])*'|#[&$%]?[a-f\d]+)+/i,/\^[a-z]/i],keyword:[{pattern:/(^|(?!&).)\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i,lookbehind:!0},{pattern:/(^|(?!&).)\b(?:dispose|exit|false|new|true)\b/i,lookbehind:!0},{pattern:/(^|(?!&).)\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i,lookbehind:!0},{pattern:/(^|(?!&).)\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i,lookbehind:!0}],number:[/[+-]?[&$%][a-f\d]+/i,/([+-]|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?/i],operator:[/\.\.|\*\*|:=|[<>]{2}|[<>+\-*\/]=?|[@^=]/i,{pattern:/(^|(?!&).)\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/,lookbehind:!0}],punctuation:/\(\.|\.\)|[()\[\]:;,.]/}; \ No newline at end of file +Prism.languages.pascal={comment:[/\(\*.+?\*\)/,/\{.+?\}/,/\/\/.*/],string:[/(?:'(?:''|[^'\n])*'|#[&$%]?[a-f\d]+)+/i,/\^[a-z]/i],keyword:[{pattern:/(^|(?!&)[\s\S])\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i,lookbehind:!0},{pattern:/(^|(?!&)[\s\S])\b(?:dispose|exit|false|new|true)\b/i,lookbehind:!0},{pattern:/(^|(?!&)[\s\S])\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i,lookbehind:!0},{pattern:/(^|(?!&)[\s\S])\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i,lookbehind:!0}],number:[/[+-]?(?:[&%]\d+|\$[a-f\d]+)/i,/([+-]|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?/i],operator:[/\.\.|\*\*|:=|[<>]{2}|[<>+\-*\/]=?|[@^=]/i,{pattern:/(^|(?!&)[\s\S])\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/,lookbehind:!0}],punctuation:/\(\.|\.\)|[()\[\]:;,.]/}; \ No newline at end of file From bb4b06e3eef84a11c6235bb5ead669a36daaf204 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 4 Jan 2015 14:11:08 +0100 Subject: [PATCH 112/137] Fixed multiline Pascal comments --- components/prism-pascal.js | 4 ++-- components/prism-pascal.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/prism-pascal.js b/components/prism-pascal.js index 8760bc9c60..47164fe825 100644 --- a/components/prism-pascal.js +++ b/components/prism-pascal.js @@ -6,8 +6,8 @@ Prism.languages.pascal = { 'comment': [ - /\(\*.+?\*\)/, - /\{.+?\}/, + /\(\*[\s\S]+?\*\)/, + /\{[\s\S]+?\}/, /\/\/.*/ ], 'string': [ diff --git a/components/prism-pascal.min.js b/components/prism-pascal.min.js index 9ea26a0fb0..d16b865e58 100644 --- a/components/prism-pascal.min.js +++ b/components/prism-pascal.min.js @@ -1 +1 @@ -Prism.languages.pascal={comment:[/\(\*.+?\*\)/,/\{.+?\}/,/\/\/.*/],string:[/(?:'(?:''|[^'\n])*'|#[&$%]?[a-f\d]+)+/i,/\^[a-z]/i],keyword:[{pattern:/(^|(?!&)[\s\S])\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i,lookbehind:!0},{pattern:/(^|(?!&)[\s\S])\b(?:dispose|exit|false|new|true)\b/i,lookbehind:!0},{pattern:/(^|(?!&)[\s\S])\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i,lookbehind:!0},{pattern:/(^|(?!&)[\s\S])\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i,lookbehind:!0}],number:[/[+-]?(?:[&%]\d+|\$[a-f\d]+)/i,/([+-]|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?/i],operator:[/\.\.|\*\*|:=|[<>]{2}|[<>+\-*\/]=?|[@^=]/i,{pattern:/(^|(?!&)[\s\S])\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/,lookbehind:!0}],punctuation:/\(\.|\.\)|[()\[\]:;,.]/}; \ No newline at end of file +Prism.languages.pascal={comment:[/\(\*[\s\S]+?\*\)/,/\{[\s\S]+?\}/,/\/\/.*/],string:[/(?:'(?:''|[^'\n])*'|#[&$%]?[a-f\d]+)+/i,/\^[a-z]/i],keyword:[{pattern:/(^|(?!&)[\s\S])\b(?:absolute|array|asm|begin|case|const|constructor|destructor|do|downto|else|end|file|for|function|goto|if|implementation|inherited|inline|interface|label|nil|object|of|operator|packed|procedure|program|record|reintroduce|repeat|self|set|string|then|to|type|unit|until|uses|var|while|with)\b/i,lookbehind:!0},{pattern:/(^|(?!&)[\s\S])\b(?:dispose|exit|false|new|true)\b/i,lookbehind:!0},{pattern:/(^|(?!&)[\s\S])\b(?:class|dispinterface|except|exports|finalization|finally|initialization|inline|library|on|out|packed|property|raise|resourcestring|threadvar|try)\b/i,lookbehind:!0},{pattern:/(^|(?!&)[\s\S])\b(?:absolute|abstract|alias|assembler|bitpacked|break|cdecl|continue|cppdecl|cvar|default|deprecated|dynamic|enumerator|experimental|export|external|far|far16|forward|generic|helper|implements|index|interrupt|iochecks|local|message|name|near|nodefault|noreturn|nostackframe|oldfpccall|otherwise|overload|override|pascal|platform|private|protected|public|published|read|register|reintroduce|result|safecall|saveregisters|softfloat|specialize|static|stdcall|stored|strict|unaligned|unimplemented|varargs|virtual|write)\b/i,lookbehind:!0}],number:[/[+-]?(?:[&%]\d+|\$[a-f\d]+)/i,/([+-]|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?/i],operator:[/\.\.|\*\*|:=|[<>]{2}|[<>+\-*\/]=?|[@^=]/i,{pattern:/(^|(?!&)[\s\S])\b(?:and|as|div|exclude|in|include|is|mod|not|or|shl|shr|xor)\b/,lookbehind:!0}],punctuation:/\(\.|\.\)|[()\[\]:;,.]/}; \ No newline at end of file From d9c69cbd24f04dc3aedc34092513ff45dde7f890 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 4 Jan 2015 14:14:54 +0100 Subject: [PATCH 113/137] Add examples for AutoHotkey, Haskell, Pascal, R, Scala --- examples/prism-autohotkey.html | 71 +++++++++++++++++++++ examples/prism-haskell.html | 93 ++++++++++++++++++++++++++++ examples/prism-pascal.html | 68 ++++++++++++++++++++ examples/prism-r.html | 41 +++++++++++++ examples/prism-scala.html | 109 +++++++++++++++++++++++++++++++++ 5 files changed, 382 insertions(+) create mode 100644 examples/prism-autohotkey.html create mode 100644 examples/prism-haskell.html create mode 100644 examples/prism-pascal.html create mode 100644 examples/prism-r.html create mode 100644 examples/prism-scala.html diff --git a/examples/prism-autohotkey.html b/examples/prism-autohotkey.html new file mode 100644 index 0000000000..e7afbbc236 --- /dev/null +++ b/examples/prism-autohotkey.html @@ -0,0 +1,71 @@ +

AutoHotkey

+

To use this language, use the class "language-autohotkey".

+ +

Comments

+
; This is a comment
+ +

Strings

+
"foo ""bar"" baz"
+ +

Numbers

+
123
+123.456
+123.456e789
+0xAF
+ +

Full example

+
;----Open the selected favorite
+f_OpenFavorite:
+; Fetch the array element that corresponds to the selected menu item:
+StringTrimLeft, f_path, f_path%A_ThisMenuItemPos%, 0
+if f_path =
+    return
+if f_class = #32770    ; It's a dialog.
+{
+    if f_Edit1Pos <>   ; And it has an Edit1 control.
+    {
+        ; Activate the window so that if the user is middle-clicking
+        ; outside the dialog, subsequent clicks will also work:
+        WinActivate ahk_id %f_window_id%
+        ; Retrieve any filename that might already be in the field so
+        ; that it can be restored after the switch to the new folder:
+        ControlGetText, f_text, Edit1, ahk_id %f_window_id%
+        ControlSetText, Edit1, %f_path%, ahk_id %f_window_id%
+        ControlSend, Edit1, {Enter}, ahk_id %f_window_id%
+        Sleep, 100  ; It needs extra time on some dialogs or in some cases.
+        ControlSetText, Edit1, %f_text%, ahk_id %f_window_id%
+        return
+    }
+    ; else fall through to the bottom of the subroutine to take standard action.
+}
+else if f_class in ExploreWClass,CabinetWClass  ; In Explorer, switch folders.
+{
+    if f_Edit1Pos <>   ; And it has an Edit1 control.
+    {
+        ControlSetText, Edit1, %f_path%, ahk_id %f_window_id%
+        ; Tekl reported the following: "If I want to change to Folder L:\folder
+        ; then the addressbar shows http://www.L:\folder.com. To solve this,
+        ; I added a {right} before {Enter}":
+        ControlSend, Edit1, {Right}{Enter}, ahk_id %f_window_id%
+        return
+    }
+    ; else fall through to the bottom of the subroutine to take standard action.
+}
+else if f_class = ConsoleWindowClass ; In a console window, CD to that directory
+{
+    WinActivate, ahk_id %f_window_id% ; Because sometimes the mclick deactivates it.
+    SetKeyDelay, 0  ; This will be in effect only for the duration of this thread.
+    IfInString, f_path, :  ; It contains a drive letter
+    {
+        StringLeft, f_path_drive, f_path, 1
+        Send %f_path_drive%:{enter}
+    }
+    Send, cd %f_path%{Enter}
+    return
+}
+; Since the above didn't return, one of the following is true:
+; 1) It's an unsupported window type but f_AlwaysShowMenu is y (yes).
+; 2) It's a supported type but it lacks an Edit1 control to facilitate the custom
+;    action, so instead do the default action below.
+Run, Explorer %f_path%  ; Might work on more systems without double quotes.
+return
\ No newline at end of file diff --git a/examples/prism-haskell.html b/examples/prism-haskell.html new file mode 100644 index 0000000000..a1423182f4 --- /dev/null +++ b/examples/prism-haskell.html @@ -0,0 +1,93 @@ +

Haskell

+

To use this language, use the class "language-haskell".

+ +

Comments

+
-- Single line comment
+{- Multi-line
+comment -}
+ +

Strings and characters

+
'a'
+'\n'
+'\^A'
+'\^]'
+'\NUL'
+'\23'
+'\o75'
+'\xFE'
+"Here is a backslant \\ as well as \137, \
+    \a numeric escape character, and \^X, a control character."
+ +

Numbers

+
42
+123.456
+123.456e-789
+1e+3
+0o74
+0XAF
+ +

Full example

+
hGetLine h =
+  wantReadableHandle_ "Data.ByteString.hGetLine" h $
+    \ h_@Handle__{haByteBuffer} -> do
+      flushCharReadBuffer h_
+      buf <- readIORef haByteBuffer
+      if isEmptyBuffer buf
+         then fill h_ buf 0 []
+         else haveBuf h_ buf 0 []
+ where
+
+  fill h_@Handle__{haByteBuffer,haDevice} buf len xss =
+    len `seq` do
+    (r,buf') <- Buffered.fillReadBuffer haDevice buf
+    if r == 0
+       then do writeIORef haByteBuffer buf{ bufR=0, bufL=0 }
+               if len > 0
+                  then mkBigPS len xss
+                  else ioe_EOF
+       else haveBuf h_ buf' len xss
+
+  haveBuf h_@Handle__{haByteBuffer}
+          buf@Buffer{ bufRaw=raw, bufR=w, bufL=r }
+          len xss =
+    do
+        off <- findEOL r w raw
+        let new_len = len + off - r
+        xs <- mkPS raw r off
+
+      -- if eol == True, then off is the offset of the '\n'
+      -- otherwise off == w and the buffer is now empty.
+        if off /= w
+            then do if (w == off + 1)
+                            then writeIORef haByteBuffer buf{ bufL=0, bufR=0 }
+                            else writeIORef haByteBuffer buf{ bufL = off + 1 }
+                    mkBigPS new_len (xs:xss)
+            else do
+                 fill h_ buf{ bufL=0, bufR=0 } new_len (xs:xss)
+
+  -- find the end-of-line character, if there is one
+  findEOL r w raw
+        | r == w = return w
+        | otherwise =  do
+            c <- readWord8Buf raw r
+            if c == fromIntegral (ord '\n')
+                then return r -- NB. not r+1: don't include the '\n'
+                else findEOL (r+1) w raw
+
+mkPS :: RawBuffer Word8 -> Int -> Int -> IO ByteString
+mkPS buf start end =
+ create len $ \p ->
+   withRawBuffer buf $ \pbuf -> do
+   copyBytes p (pbuf `plusPtr` start) len
+ where
+   len = end - start
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Comment-like substrings

+
"foo {- bar -} baz"; "foo -- bar";
\ No newline at end of file diff --git a/examples/prism-pascal.html b/examples/prism-pascal.html new file mode 100644 index 0000000000..7fd7997d79 --- /dev/null +++ b/examples/prism-pascal.html @@ -0,0 +1,68 @@ +

Pascal

+

To use this language, use the class "language-pascal".

+ +

Comments

+
(* This is an
+old style comment *)
+{ This is a
+Turbo Pascal comment }
+// This is a Delphi comment.
+ +

Strings and characters

+
'This is a pascal string'
+''
+'a'
+^G
+#7
+#$f4
+'A tabulator character: '#9' is easy to embed'
+ +

Numbers

+
123
+123.456
+132.456e-789
+132.456e+789
+$7aff
+&17
+%11110101
+ +

Full example

+
Type
+    Str25    = String[25];
+    TBookRec = Record
+                Title, Author,
+                ISBN  : Str25;
+                Price : Real;
+               End;
+
+Procedure EnterNewBook(var newBook : TBookRec);
+Begin
+ Writeln('Please enter the book details: ');
+ Write('Book Name: ');
+ Readln(newBook.Title);
+ Write('Author: ');
+ Readln(newBook.Author);
+ Write('ISBN: ');
+ Readln(newBook.ISBN);
+ Write('Price: ');
+ Readln(newBook.Price);
+End;
+
+Var
+    bookRecArray : Array[1..10] of TBookRec;
+    i            : 1..10;
+
+Begin
+ For i := 1 to 10 do
+  EnterNewBook(bookRecArray[i]);
+ Writeln('Thanks for entering the book details');
+ Write('Now choose a record to display from 1 to 10: ');
+ Readln(i);
+ Writeln('Here are the book details of record #',i,':');
+ Writeln;
+ Writeln('Title:  ', bookRecArray[i].Title);
+ Writeln('Author: ', bookRecArray[i].Author);
+ Writeln('ISBN:   ', bookRecArray[i].ISBN);
+ Writeln('Price:  ', bookRecArray[i].Price);
+ Readln;
+End.
\ No newline at end of file diff --git a/examples/prism-r.html b/examples/prism-r.html new file mode 100644 index 0000000000..8e33ac7c9b --- /dev/null +++ b/examples/prism-r.html @@ -0,0 +1,41 @@ +

R

+

To use this language, use the class "language-r".

+ +

Comments

+
# This is a comment
+ +

Strings

+
"foo \"bar\" baz"
+'foo \'bar\' baz'
+ +

Full example

+
# Goal: To make a latex table with results of an OLS regression.
+
+# Get an OLS --
+x1 = runif(100)
+x2 = runif(100, 0, 2)
+y = 2 + 3*x1 + 4*x2 + rnorm(100)
+m = lm(y ~ x1 + x2)
+
+# and print it out prettily --
+library(xtable)
+# Bare --
+xtable(m)
+xtable(anova(m))
+
+# Better --
+print.xtable(xtable(m, caption="My regression",
+                    label="t:mymodel",
+                    digits=c(0,3,2,2,3)),
+             type="latex",
+             file="xtable_demo_ols.tex",
+             table.placement = "tp",
+             latex.environments=c("center", "footnotesize"))
+
+print.xtable(xtable(anova(m),
+                    caption="ANOVA of my regression",
+                    label="t:anova_mymodel"),
+             type="latex",
+             file="xtable_demo_anova.tex",
+             table.placement = "tp",
+             latex.environments=c("center", "footnotesize"))
\ No newline at end of file diff --git a/examples/prism-scala.html b/examples/prism-scala.html new file mode 100644 index 0000000000..9adbebad33 --- /dev/null +++ b/examples/prism-scala.html @@ -0,0 +1,109 @@ +

Scala

+

To use this language, use the class "language-scala".

+ +

Comments

+
// Single line comment
+/* Mutli-line
+comment */
+ +

Strings and characters

+
'a'
+"foo \"bar\" baz"
+"""Multi-line
+string"""
+ +

Numbers

+
0
+21
+0xFFFFFFFF
+-42L
+0.0
+1e30f
+3.14159f
+1.0e-100
+.1
+
+ +

Symbols

+
'x
+'identifier
+ +

Full example

+
// Contributed by John Williams
+package examples
+
+object lazyLib {
+
+  /** Delay the evaluation of an expression until it is needed. */
+  def delay[A](value: => A): Susp[A] = new SuspImpl[A](value)
+
+  /** Get the value of a delayed expression. */
+  implicit def force[A](s: Susp[A]): A = s()
+
+  /**
+   * Data type of suspended computations. (The name froms from ML.)
+   */
+  abstract class Susp[+A] extends Function0[A]
+
+  /**
+   * Implementation of suspended computations, separated from the
+   * abstract class so that the type parameter can be invariant.
+   */
+  class SuspImpl[A](lazyValue: => A) extends Susp[A] {
+    private var maybeValue: Option[A] = None
+
+    override def apply() = maybeValue match {
+      case None =>
+        val value = lazyValue
+        maybeValue = Some(value)
+        value
+	  case Some(value) =>
+        value
+    }
+
+    override def toString() = maybeValue match {
+      case None => "Susp(?)"
+      case Some(value) => "Susp(" + value + ")"
+    }
+  }
+}
+
+object lazyEvaluation {
+  import lazyLib._
+
+  def main(args: Array[String]) = {
+    val s: Susp[Int] = delay { println("evaluating..."); 3 }
+
+    println("s     = " + s)       // show that s is unevaluated
+    println("s()   = " + s())     // evaluate s
+    println("s     = " + s)       // show that the value is saved
+    println("2 + s = " + (2 + s)) // implicit call to force()
+
+    val sl = delay { Some(3) }
+    val sl1: Susp[Some[Int]] = sl
+    val sl2: Susp[Option[Int]] = sl1   // the type is covariant
+
+    println("sl2   = " + sl2)
+    println("sl2() = " + sl2())
+    println("sl2   = " + sl2)
+  }
+}
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Nested block comments

+
/* Nested block
+	/* comments
+	are */
+not supported */
+ +

Comment-like substrings

+
"foo /* bar */ baz"; "foo // bar";
+ +

Escaped characters

+
'\u0041'
\ No newline at end of file From 2c8ca95df30cb63d13865e097191aa8ad0d4879a Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 4 Jan 2015 14:19:45 +0100 Subject: [PATCH 114/137] Fix broken example in Scala --- examples/prism-scala.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/prism-scala.html b/examples/prism-scala.html index 9adbebad33..f8649d55c7 100644 --- a/examples/prism-scala.html +++ b/examples/prism-scala.html @@ -8,7 +8,7 @@

Comments

Strings and characters

'a'
-"foo \"bar\" baz"
+"foo bar baz"
 """Multi-line
 string"""
From 4312042abd94f428c5cd96fdaafd1de620cea81e Mon Sep 17 00:00:00 2001 From: Vivek Kumar Bansal Date: Sun, 4 Jan 2015 20:52:56 +0530 Subject: [PATCH 115/137] make comment non-greedy --- components/prism-handlebars.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/prism-handlebars.js b/components/prism-handlebars.js index 09717949b1..031896b1e9 100644 --- a/components/prism-handlebars.js +++ b/components/prism-handlebars.js @@ -35,7 +35,7 @@ // surround markup Prism.languages.insertBefore('handlebars', 'tag', { 'handlebars-comment': { - pattern: /\{\{![\w\W]*\}\}/g, + pattern: /\{\{![\w\W]*?\}\}/g, alias: ['handlebars','comment'] } }); @@ -79,4 +79,4 @@ env.element.innerHTML = env.highlightedCode; }); -}(Prism)); \ No newline at end of file +}(Prism)); From d9da5f9b90a913f2f75efe3278df77ff26dc9c71 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 4 Jan 2015 17:02:43 +0100 Subject: [PATCH 116/137] Run gulp tasks --- components/prism-handlebars.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-handlebars.min.js b/components/prism-handlebars.min.js index 555c80447d..bd39e03914 100644 --- a/components/prism-handlebars.min.js +++ b/components/prism-handlebars.min.js @@ -1 +1 @@ -!function(e){var a=/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g;e.languages.handlebars=e.languages.extend("markup",{handlebars:{pattern:a,inside:{delimiter:{pattern:/^\{\{\{?|\}\}\}?$/gi,alias:"punctuation"},string:/(["'])(\\?.)+?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,"boolean":/\b(true|false)\b/g,block:{pattern:/^(\s*~?\s*)[#\/]\w+/gi,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/g,variable:/[\w\W]+/g}},punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g}}}),e.languages.insertBefore("handlebars","tag",{"handlebars-comment":{pattern:/\{\{![\w\W]*\}\}/g,alias:["handlebars","comment"]}}),e.hooks.add("before-highlight",function(e){"handlebars"===e.language&&(e.tokenStack=[],e.backupCode=e.code,e.code=e.code.replace(a,function(a){return e.tokenStack.push(a),"___HANDLEBARS"+e.tokenStack.length+"___"}))}),e.hooks.add("before-insert",function(e){"handlebars"===e.language&&(e.code=e.backupCode,delete e.backupCode)}),e.hooks.add("after-highlight",function(a){if("handlebars"===a.language){for(var n,t=0;n=a.tokenStack[t];t++)a.highlightedCode=a.highlightedCode.replace("___HANDLEBARS"+(t+1)+"___",e.highlight(n,a.grammar,"handlebars"));a.element.innerHTML=a.highlightedCode}})}(Prism); \ No newline at end of file +!function(e){var a=/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g;e.languages.handlebars=e.languages.extend("markup",{handlebars:{pattern:a,inside:{delimiter:{pattern:/^\{\{\{?|\}\}\}?$/gi,alias:"punctuation"},string:/(["'])(\\?.)+?\1/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,"boolean":/\b(true|false)\b/g,block:{pattern:/^(\s*~?\s*)[#\/]\w+/gi,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/g,variable:/[\w\W]+/g}},punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/g,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/g}}}),e.languages.insertBefore("handlebars","tag",{"handlebars-comment":{pattern:/\{\{![\w\W]*?\}\}/g,alias:["handlebars","comment"]}}),e.hooks.add("before-highlight",function(e){"handlebars"===e.language&&(e.tokenStack=[],e.backupCode=e.code,e.code=e.code.replace(a,function(a){return e.tokenStack.push(a),"___HANDLEBARS"+e.tokenStack.length+"___"}))}),e.hooks.add("before-insert",function(e){"handlebars"===e.language&&(e.code=e.backupCode,delete e.backupCode)}),e.hooks.add("after-highlight",function(a){if("handlebars"===a.language){for(var n,t=0;n=a.tokenStack[t];t++)a.highlightedCode=a.highlightedCode.replace("___HANDLEBARS"+(t+1)+"___",e.highlight(n,a.grammar,"handlebars"));a.element.innerHTML=a.highlightedCode}})}(Prism); \ No newline at end of file From 3eeaff11ed1580bdae182242f9f9c9d5bc7bcdd5 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sun, 4 Jan 2015 17:18:15 +0100 Subject: [PATCH 117/137] Add example/test code for #452 --- examples/prism-handlebars.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/prism-handlebars.html b/examples/prism-handlebars.html index dc67ceb81a..ec7d31d4f0 100644 --- a/examples/prism-handlebars.html +++ b/examples/prism-handlebars.html @@ -2,12 +2,13 @@

Handlebars

To use this language, use the class "language-handlebars".

Comments

-
{{! This is a comment with <p>some markup</p> in it }}
+
{{! This is a comment with <p>some markup</p> in it }}
+{{! This is a comment }} {{ this_is_not }}

Variables

<p>{{ text }}</p>
 <h1>{{article.title}}</h1>
-{{{ triple_slash_is_supported }}}
+{{{ triple_stash_is_supported }}}
 {{articles.[10].[#comments]}}

Strings, numbers and booleans

From dc0599cb4ed6c6be04e71fe2f9fcb0400d4ad6cb Mon Sep 17 00:00:00 2001 From: Golmote Date: Mon, 5 Jan 2015 09:01:17 +0100 Subject: [PATCH 118/137] Example for NASM --- components.js | 2 +- examples/prism-nasm.html | 76 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 examples/prism-nasm.html diff --git a/components.js b/components.js index 8d48e5fe46..09e7284699 100644 --- a/components.js +++ b/components.js @@ -201,7 +201,7 @@ var components = { "owner" : "bacchus123" }, "nasm": { - "title": "nasm", + "title": "NASM", "owner": "rbmj" }, "perl": { diff --git a/examples/prism-nasm.html b/examples/prism-nasm.html new file mode 100644 index 0000000000..192e90c676 --- /dev/null +++ b/examples/prism-nasm.html @@ -0,0 +1,76 @@ +

NASM

+

To use this language, use the class "language-nasm".

+ +

Comments

+
; This is a comment
+ +

Labels

+
label1:     ; a non-local label
+.local:     ; this is really label1.local
+..@foo:     ; this is a special symbol
+label2:     ; another non-local label
+.local:     ; this is really label2.local
+
+ +

Registers

+
st0
+st1
+ax
+rax
+zmm4
+ +

Strings

+

+mov eax,'abcd'
+
+db    'hello'               ; string constant
+db    'h','e','l','l','o'   ; equivalent character constants
+dd    'ninechars'           ; doubleword string constant
+dd    'nine','char','s'     ; becomes three doublewords
+db    'ninechars',0,0,0     ; and really looks like this
+
+db `\u263a`            ; UTF-8 smiley face
+db `\xe2\x98\xba`      ; UTF-8 smiley face
+db 0E2h, 098h, 0BAh    ; UTF-8 smiley face
+
+ +

Numbers

+
mov     ax,200          ; decimal
+mov     ax,0200         ; still decimal
+mov     ax,0200d        ; explicitly decimal
+mov     ax,0d200        ; also decimal
+mov     ax,0c8h         ; hex
+mov     ax,$0c8         ; hex again: the 0 is required
+mov     ax,0xc8         ; hex yet again
+mov     ax,0hc8         ; still hex
+mov     ax,310q         ; octal
+mov     ax,310o         ; octal again
+mov     ax,0o310        ; octal yet again
+mov     ax,0q310        ; octal yet again
+mov     ax,11001000b    ; binary
+
+db    -0.2                    ; "Quarter precision"
+dw    -0.5                    ; IEEE 754r/SSE5 half precision
+dd    1.2                     ; an easy one
+dd    1.222_222_222           ; underscores are permitted
+dd    0x1p+2                  ; 1.0x2^2 = 4.0
+dq    0x1p+32                 ; 1.0x2^32 = 4 294 967 296.0
+dq    1.e10                   ; 10 000 000 000.0
+dq    1.e+10                  ; synonymous with 1.e10
+dq    1.e-10                  ; 0.000 000 000 1
+dt    3.141592653589793238462 ; pi
+do    1.e+4000                ; IEEE 754r quad precision
+
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Numbers with underscores

+
mov     ax,1100_1000b
+mov     ax,1100_1000y
+mov     ax,0b1100_1000
+mov     ax,0y1100_1000
\ No newline at end of file From cc59da8a4dbcee6181681db9bb131be1c97f8c40 Mon Sep 17 00:00:00 2001 From: Golmote Date: Mon, 5 Jan 2015 09:13:06 +0100 Subject: [PATCH 119/137] Improved floating-point numbers in NASM --- components/prism-nasm.js | 4 ++-- components/prism-nasm.min.js | 2 +- examples/prism-nasm.html | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/prism-nasm.js b/components/prism-nasm.js index cf39852329..96e8811380 100644 --- a/components/prism-nasm.js +++ b/components/prism-nasm.js @@ -9,12 +9,12 @@ Prism.languages.nasm = { /\[?BITS (16|32|64)\]?/m, /^\s*section\s*[a-zA-Z\.]+:?/im, /(?:extern|global)[^;]*/im, - /(?:CPU|FLOAT|DEFAULT).*$/m, + /(?:CPU|FLOAT|DEFAULT).*$/m ], 'register': { pattern: /\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(bp|sp|si|di)|[cdefgs]s)\b/gi, alias: 'variable' }, - 'number': /(\b|-|(?=\$))(0[hHxX][\dA-Fa-f]*\.?[\dA-Fa-f]+([pP][+-]?\d+)?|\d[\dA-Fa-f]+[hHxX]|\$\d[\dA-Fa-f]*|0[oOqQ][0-7]+|[0-7]+[oOqQ]|0[bByY][01]+|[01]+[bByY]|0[dDtT]\d+|\d+[dDtT]?|\d*\.?\d+([Ee][+-]?\d+)?)\b/g, + 'number': /(\b|-|(?=\$))(0[hHxX][\dA-Fa-f]*\.?[\dA-Fa-f]+([pP][+-]?\d+)?|\d[\dA-Fa-f]+[hHxX]|\$\d[\dA-Fa-f]*|0[oOqQ][0-7]+|[0-7]+[oOqQ]|0[bByY][01]+|[01]+[bByY]|0[dDtT]\d+|\d*\.?\d+(\.?[Ee][+-]?\d+)?[dDtT]?)\b/g, 'operator': /[\[\]\*+\-\/%<>=&|\$!]/gm }; diff --git a/components/prism-nasm.min.js b/components/prism-nasm.min.js index 6ad6587b58..c5020e41d8 100644 --- a/components/prism-nasm.min.js +++ b/components/prism-nasm.min.js @@ -1 +1 @@ -Prism.languages.nasm={comment:/;.*$/m,string:/("|'|`)(\\?.)*?\1/gm,label:{pattern:/^\s*[A-Za-z\._\?\$][\w\.\?\$@~#]*:/m,alias:"function"},keyword:[/\[?BITS (16|32|64)\]?/m,/^\s*section\s*[a-zA-Z\.]+:?/im,/(?:extern|global)[^;]*/im,/(?:CPU|FLOAT|DEFAULT).*$/m],register:{pattern:/\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(bp|sp|si|di)|[cdefgs]s)\b/gi,alias:"variable"},number:/(\b|-|(?=\$))(0[hHxX][\dA-Fa-f]*\.?[\dA-Fa-f]+([pP][+-]?\d+)?|\d[\dA-Fa-f]+[hHxX]|\$\d[\dA-Fa-f]*|0[oOqQ][0-7]+|[0-7]+[oOqQ]|0[bByY][01]+|[01]+[bByY]|0[dDtT]\d+|\d+[dDtT]?|\d*\.?\d+([Ee][+-]?\d+)?)\b/g,operator:/[\[\]\*+\-\/%<>=&|\$!]/gm}; \ No newline at end of file +Prism.languages.nasm={comment:/;.*$/m,string:/("|'|`)(\\?.)*?\1/gm,label:{pattern:/^\s*[A-Za-z\._\?\$][\w\.\?\$@~#]*:/m,alias:"function"},keyword:[/\[?BITS (16|32|64)\]?/m,/^\s*section\s*[a-zA-Z\.]+:?/im,/(?:extern|global)[^;]*/im,/(?:CPU|FLOAT|DEFAULT).*$/m],register:{pattern:/\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(bp|sp|si|di)|[cdefgs]s)\b/gi,alias:"variable"},number:/(\b|-|(?=\$))(0[hHxX][\dA-Fa-f]*\.?[\dA-Fa-f]+([pP][+-]?\d+)?|\d[\dA-Fa-f]+[hHxX]|\$\d[\dA-Fa-f]*|0[oOqQ][0-7]+|[0-7]+[oOqQ]|0[bByY][01]+|[01]+[bByY]|0[dDtT]\d+|\d*\.?\d+(\.?[Ee][+-]?\d+)?[dDtT]?)\b/g,operator:/[\[\]\*+\-\/%<>=&|\$!]/gm}; \ No newline at end of file diff --git a/examples/prism-nasm.html b/examples/prism-nasm.html index 192e90c676..5d20ceb33d 100644 --- a/examples/prism-nasm.html +++ b/examples/prism-nasm.html @@ -52,7 +52,6 @@

Numbers

db -0.2 ; "Quarter precision" dw -0.5 ; IEEE 754r/SSE5 half precision dd 1.2 ; an easy one -dd 1.222_222_222 ; underscores are permitted dd 0x1p+2 ; 1.0x2^2 = 4.0 dq 0x1p+32 ; 1.0x2^32 = 4 294 967 296.0 dq 1.e10 ; 10 000 000 000.0 @@ -73,4 +72,6 @@

Numbers with underscores

mov     ax,1100_1000b
 mov     ax,1100_1000y
 mov     ax,0b1100_1000
-mov     ax,0y1100_1000
\ No newline at end of file +mov ax,0y1100_1000 + +dd 1.222_222_222
\ No newline at end of file From 72cde69424eed49e16f222891bad8840c06e6e7e Mon Sep 17 00:00:00 2001 From: Golmote Date: Tue, 6 Jan 2015 20:22:24 +0100 Subject: [PATCH 120/137] Groovy fix : added support for shebang, fixed single-line strings and updated example page --- components/prism-groovy.js | 9 ++- components/prism-groovy.min.js | 2 +- examples/prism-groovy.html | 103 +++++++++++++++++---------------- 3 files changed, 62 insertions(+), 52 deletions(-) diff --git a/components/prism-groovy.js b/components/prism-groovy.js index ba484c7877..b8112e29d6 100644 --- a/components/prism-groovy.js +++ b/components/prism-groovy.js @@ -1,6 +1,6 @@ Prism.languages.groovy = Prism.languages.extend('clike', { 'keyword': /\b(as|def|in|abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while)\b/g, - 'string': /("""|''')[\W\w]*?\1|("|'|\/)[\W\w]*?\2|(\$\/)(\$\/\$|[\W\w])*?\/\$/g, + 'string': /("""|''')[\W\w]*?\1|("|'|\/)(?:\\?.)*?\2|(\$\/)(\$\/\$|[\W\w])*?\/\$/g, 'number': /\b0b[01_]+\b|\b0x[\da-f_]+(\.[\da-f_p\-]+)?\b|\b[\d_]+(\.[\d_]+[e]?[\d]*)?[glidf]\b|[\d_]+(\.[\d_]+)?\b/gi, 'operator': { pattern: /(^|[^.])(={0,2}~|\?\.|\*?\.@|\.&|\.{1,2}(?!\.)|\.{2}|\?:|[-+]{1,2}|!|<=>|>{1,3}|<{1,2}|={1,2}|&{1,2}|\|{1,2}|\?|\*{1,2}|\/|\^|%)/g, @@ -9,6 +9,13 @@ Prism.languages.groovy = Prism.languages.extend('clike', { 'punctuation': /\.+|[{}[\];(),:$]/g }); +Prism.languages.insertBefore('groovy', 'string', { + 'shebang': { + pattern: /#!.+/, + alias: 'comment' + } +}); + Prism.languages.insertBefore('groovy', 'punctuation', { 'spock-block': /\b(setup|given|when|then|and|cleanup|expect|where):/g }); diff --git a/components/prism-groovy.min.js b/components/prism-groovy.min.js index bc74e97c69..cfe0b58deb 100644 --- a/components/prism-groovy.min.js +++ b/components/prism-groovy.min.js @@ -1 +1 @@ -Prism.languages.groovy=Prism.languages.extend("clike",{keyword:/\b(as|def|in|abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while)\b/g,string:/("""|''')[\W\w]*?\1|("|'|\/)[\W\w]*?\2|(\$\/)(\$\/\$|[\W\w])*?\/\$/g,number:/\b0b[01_]+\b|\b0x[\da-f_]+(\.[\da-f_p\-]+)?\b|\b[\d_]+(\.[\d_]+[e]?[\d]*)?[glidf]\b|[\d_]+(\.[\d_]+)?\b/gi,operator:{pattern:/(^|[^.])(={0,2}~|\?\.|\*?\.@|\.&|\.{1,2}(?!\.)|\.{2}|\?:|[-+]{1,2}|!|<=>|>{1,3}|<{1,2}|={1,2}|&{1,2}|\|{1,2}|\?|\*{1,2}|\/|\^|%)/g,lookbehind:!0},punctuation:/\.+|[{}[\];(),:$]/g}),Prism.languages.insertBefore("groovy","punctuation",{"spock-block":/\b(setup|given|when|then|and|cleanup|expect|where):/g}),Prism.languages.insertBefore("groovy","function",{annotation:{pattern:/(^|[^.])@\w+/,lookbehind:!0}}),Prism.hooks.add("wrap",function(e){if("groovy"===e.language&&"string"===e.type){var t=e.content[0];if("'"!=t){var n=/([^\\])(\$(\{.*?\}|[\w\.]+))/;"$"===t&&(n=/([^\$])(\$(\{.*?\}|[\w\.]+))/),e.content=Prism.highlight(e.content,{expression:{pattern:n,lookbehind:!0,inside:Prism.languages.groovy}}),e.classes.push("/"===t?"regex":"gstring")}}}); \ No newline at end of file +Prism.languages.groovy=Prism.languages.extend("clike",{keyword:/\b(as|def|in|abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while)\b/g,string:/("""|''')[\W\w]*?\1|("|'|\/)(?:\\?.)*?\2|(\$\/)(\$\/\$|[\W\w])*?\/\$/g,number:/\b0b[01_]+\b|\b0x[\da-f_]+(\.[\da-f_p\-]+)?\b|\b[\d_]+(\.[\d_]+[e]?[\d]*)?[glidf]\b|[\d_]+(\.[\d_]+)?\b/gi,operator:{pattern:/(^|[^.])(={0,2}~|\?\.|\*?\.@|\.&|\.{1,2}(?!\.)|\.{2}|\?:|[-+]{1,2}|!|<=>|>{1,3}|<{1,2}|={1,2}|&{1,2}|\|{1,2}|\?|\*{1,2}|\/|\^|%)/g,lookbehind:!0},punctuation:/\.+|[{}[\];(),:$]/g}),Prism.languages.insertBefore("groovy","string",{shebang:{pattern:/#!.+/,alias:"comment"}}),Prism.languages.insertBefore("groovy","punctuation",{"spock-block":/\b(setup|given|when|then|and|cleanup|expect|where):/g}),Prism.languages.insertBefore("groovy","function",{annotation:{pattern:/(^|[^.])@\w+/,lookbehind:!0}}),Prism.hooks.add("wrap",function(e){if("groovy"===e.language&&"string"===e.type){var t=e.content[0];if("'"!=t){var n=/([^\\])(\$(\{.*?\}|[\w\.]+))/;"$"===t&&(n=/([^\$])(\$(\{.*?\}|[\w\.]+))/),e.content=Prism.highlight(e.content,{expression:{pattern:n,lookbehind:!0,inside:Prism.languages.groovy}}),e.classes.push("/"===t?"regex":"gstring")}}}); \ No newline at end of file diff --git a/examples/prism-groovy.html b/examples/prism-groovy.html index d4f0f8f498..596e74f4a3 100644 --- a/examples/prism-groovy.html +++ b/examples/prism-groovy.html @@ -28,59 +28,62 @@

Interpolation inside GStrings and regex

'No interpolation here : ${21*2}'

Full example

-
/*
-    The input string to parse is from...
-    <...the rest of the header comment from above...>
-*/
-boolean debugging = true
-
-if (debugging) {
-    // Test data
-    dfkOutput = '''
-Filesystem           1K-blocks      Used Available Use% Mounted on
-/dev/sda1              4185956   1206996   2762888  31% /
-/dev/sda11            30679784  28324040    772140  98% /extra
-fas3050c-1-2.b:/vol/canis
-                      10485760   6599936   3885824  63% /nfs/data_d2/dog_data
-fas6070-1-1.b:/vol/felis
-                     314572800  54889600 259683200  18% /nfs/DATA-1/cat_data
-'''
-} else {
-    // Real data
-    dfkOutput = 'df -k'.execute().text
-}
-
-long kbAvail = 0
-
-regex =  '''(?ix)      # enable case-insensitive matches, extended patterns
-            (\\d+)     # 1: The disk space we want
-            \\s+       # some whitespace
-            \\d+%      # a number followed by??%
-            \\s+       # some more whitespace
-            (/nfs/data.*)  # 2: partition name'''
+
#!/usr/bin/env groovy
+package model
 
-pattern = ~regex
-matcher = pattern.matcher(dfkOutput)
+import groovy.transform.CompileStatic
+import java.util.List as MyList
 
-if (debugging) {
-    println """matcher pattern:
-/---------------------------------\\
-${matcher.pattern()}
-\\---------------------------------/"""
-
-    println "match count=${matcher.getCount()}"
+trait Distributable {
+    void distribute(String version) {}
 }
 
-for (i=0; i < matcher.getCount(); i++) {
-    if (debugging) {
-        println "    text matched in matcher[${i}]: '" + matcher[i][0] + "'"
-        println "        free space in  (group 1): '" + matcher[i][1] + "'"
-        println "        partition name (group 2): '" + matcher[i][2] + "'"
+@CompileStatic
+class Distribution implements Distributable {
+    double number = 1234.234 / 567
+    def otherNumber = 3 / 4
+    boolean archivable = condition ?: true
+    def ternary = a ? b : c
+    String name = "Guillaume"
+    Closure description = null
+    List<DownloadPackage> packages = []
+    String regex = ~/.*foo.*/
+    String multi = '''
+        multi line string
+    ''' + """
+        now with double quotes and ${gstring}
+    """ + $/
+        even with dollar slashy strings
+    /$
+
+    /**
+     * description method
+     * @param cl the closure
+     */
+    void description(Closure cl) { this.description = cl }
+
+    void version(String name, Closure versionSpec) {
+        def closure = { println "hi" } as Runnable
+
+        MyList ml = [1, 2, [a: 1, b:2,c :3]]
+        for (ch in "name") {}
+
+        // single line comment
+        DownloadPackage pkg = new DownloadPackage(version: name)
+
+        check that: true
+
+        label:
+        def clone = versionSpec.rehydrate(pkg, pkg, pkg)
+        /*
+            now clone() in a multiline comment
+        */
+        clone()
+        packages.add(pkg)
+
+        assert 4 / 2 == 2
     }
-    kbAvail += matcher[i][1].toLong()
-}
-
-println "KB available=${kbAvail}"
+}

Known failures

There are certain edge cases where Prism will fail. @@ -92,5 +95,5 @@

Known failures

Comment-like substrings

"foo /* bar */ baz"; "foo // bar";
-

Slashy strings containing (escaped) slashes

-
/foo\/bar/
\ No newline at end of file +

Two divisions on the same line

+
2 / 3 / 4
\ No newline at end of file From 7830e25ad83272a8a9116cfe36220565316d1156 Mon Sep 17 00:00:00 2001 From: Golmote Date: Wed, 7 Jan 2015 00:33:16 +0100 Subject: [PATCH 121/137] Added missing dependency --- components.js | 1 + 1 file changed, 1 insertion(+) diff --git a/components.js b/components.js index 679e8322ec..071d507324 100644 --- a/components.js +++ b/components.js @@ -271,6 +271,7 @@ var components = { }, "smarty": { "title": "Smarty", + "require": "markup", "owner": "Golmote" }, "actionscript": { From 77815a153c3f01ded971143fabd1bfad016e7d1d Mon Sep 17 00:00:00 2001 From: Golmote Date: Wed, 7 Jan 2015 01:04:18 +0100 Subject: [PATCH 122/137] Added Smarty and ActionScript examples --- components/prism-smarty.js | 2 +- examples/prism-actionscript.html | 115 +++++++++++++++++++++++++++++++ examples/prism-smarty.html | 84 ++++++++++++++++++++++ 3 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 examples/prism-actionscript.html create mode 100644 examples/prism-smarty.html diff --git a/components/prism-smarty.js b/components/prism-smarty.js index 4466b2e07b..b39525a66b 100644 --- a/components/prism-smarty.js +++ b/components/prism-smarty.js @@ -57,7 +57,7 @@ /\bis\s+(?:not\s+)?(?:div|even|odd)(?:\s+by)?\b/, /\b(?:eq|neq?|gt|lt|gt?e|lt?e|not|mod|or|and)\b/g ], - 'keyword': /\b(?:false|off|on|no|true|yes)\b/g, + 'keyword': /\b(?:false|off|on|no|true|yes)\b/g } } }); diff --git a/examples/prism-actionscript.html b/examples/prism-actionscript.html new file mode 100644 index 0000000000..cf4e33462e --- /dev/null +++ b/examples/prism-actionscript.html @@ -0,0 +1,115 @@ +

ActionScript

+

To use this language, use the class "language-actionscript".

+ +

Comments

+
// Single line comment
+/* Multi-line
+comment */
+ +

Literal values

+
17
+"hello"
+-3
+9.4
+null
+true
+false
+ +

Classes

+
class A {}
+class B extends A {}
+ +

Full example

+
package {
+  import flash.display.*;
+  import flash.events.*;
+  import flash.filters.BlurFilter;
+  import flash.geom.*;
+  import flash.ui.*;
+  public class ch23ex2 extends Sprite {
+    protected const BMP_SCALE:Number = 1/2;
+    protected const D:Number = 1.015;
+    protected const DIM_EFFECT:ColorTransform = new ColorTransform(D, D, D);
+    protected const B:int = 16;
+    protected const BLUR_EFFECT:BlurFilter = new BlurFilter(B, B, 1);
+    protected var RLUT:Array, GLUT:Array, BLUT:Array;
+    protected var sourceBmp:BitmapData;
+    protected var colorBmp:BitmapData;
+    protected var touches:Array = new Array();
+    protected var fingerShape:Shape = new Shape();
+    public function ch23ex2() {
+      try {
+        var test:Class = Multitouch;
+        if (Multitouch.supportsTouchEvents) {
+          Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
+          init();
+        } else {
+          trace("Sorry, this example requires multitouch.");
+        }
+      } catch (error:ReferenceError) {
+        trace("Sorry, but multitouch is not supported in this runtime.");
+      }
+    }
+    protected function init():void {
+      //create a black-and-white bitmap and a color bitmap, only show the color
+      sourceBmp = new BitmapData(
+        stage.stageWidth*BMP_SCALE, stage.stageHeight*BMP_SCALE, false, 0);
+      colorBmp = sourceBmp.clone();
+      var bitmap:Bitmap = new Bitmap(colorBmp, PixelSnapping.ALWAYS, true);
+      bitmap.width = stage.stageWidth; bitmap.height = stage.stageHeight;
+      addChild(bitmap);
+
+      //create finger shape to paste onto the bitmap under your touches
+      fingerShape.graphics.beginFill(0xffffff, 0.1);
+      fingerShape.graphics.drawEllipse(-15, -20, 30, 40);
+      fingerShape.graphics.endFill();
+
+      //create the palette map from a gradient
+      var gradient:Shape = new Shape();
+      var m:Matrix = new Matrix();
+      m.createGradientBox(256, 10);
+      gradient.graphics.beginGradientFill(GradientType.LINEAR,
+        [0x313ad8, 0x2dce4a, 0xdae234, 0x7a1c1c, 0x0f0303],
+        [1, 1, 1, 1, 1], [0, 0.4*256, 0.75*256, 0.9*256, 255], m);
+      gradient.graphics.drawRect(0, 0, 256, 10);
+      var gradientBmp:BitmapData = new BitmapData(256, 10, false, 0);
+      gradientBmp.draw(gradient);
+      RLUT = new Array(); GLUT = new Array(); BLUT = new Array();
+      for (var i:int = 0; i < 256; i++) {
+        var pixelColor:uint = gradientBmp.getPixel(i, 0);
+        //I drew the gradient backwards, so sue me
+        RLUT[256-i] = pixelColor & 0xff0000;
+        GLUT[256-i] = pixelColor & 0x00ff00;
+        BLUT[256-i] = pixelColor & 0x0000ff;
+      }
+
+      stage.addEventListener(TouchEvent.TOUCH_BEGIN, assignTouch);
+      stage.addEventListener(TouchEvent.TOUCH_MOVE, assignTouch);
+      stage.addEventListener(TouchEvent.TOUCH_END, removeTouch);
+      stage.addEventListener(Event.ENTER_FRAME, onEnterFrame);
+    }
+    protected function assignTouch(event:TouchEvent):void {
+      touches[event.touchPointID] = event;
+    }
+    protected function removeTouch(event:TouchEvent):void {
+      delete touches[event.touchPointID];
+    }
+    protected function onEnterFrame(event:Event):void {
+      for (var key:String in touches) {
+        var touch:TouchEvent = touches[key] as TouchEvent;
+        if (touch) {
+          //plaster the finger image under your finger
+          var m:Matrix = new Matrix();
+          m.translate(touch.stageX*BMP_SCALE, touch.stageY*BMP_SCALE);
+          sourceBmp.draw(fingerShape, m, null, BlendMode.ADD);
+        }
+      }
+      var O:Point = new Point(0, 0);
+      //blur and ever-so-slightly brighten the image to make the color last
+      sourceBmp.applyFilter(sourceBmp, sourceBmp.rect, O, BLUR_EFFECT);
+      sourceBmp.colorTransform(sourceBmp.rect, DIM_EFFECT);
+      //we've calculated the image in grayscale brightnesses, now make it color
+      colorBmp.paletteMap(sourceBmp, sourceBmp.rect, O, RLUT, GLUT, BLUT, null);
+    }
+  }
+}
\ No newline at end of file diff --git a/examples/prism-smarty.html b/examples/prism-smarty.html new file mode 100644 index 0000000000..47f62d665e --- /dev/null +++ b/examples/prism-smarty.html @@ -0,0 +1,84 @@ +

Smarty

+

To use this language, use the class "language-smarty".

+ +

Comments

+
{* This is a comment with <p>some markup</p> in it *}
+{* Multi-line
+comment *}
+ +

Variables

+
{$foo}
+{$foo.bar}
+{$foo.$bar}
+{$foo[$bar]}
+{$foo->bar}
+{$foo->bar()}
+{#foo#}
+{$smarty.config.foo}
+{$foo[bar]}
+
+ +

Strings and numbers

+
{$foo[4]}
+{$foo['bar']}
+ +

Tags and filters

+
{assign var=foo value='baa'}
+{include file='header.tpl'}
+{$smarty.now|date_format:'%Y-%m-%d %H:%M:%S'}
+{$title|truncate:40:'...'}
+{$myArray|@count}
+
+{math equation="height * width / division"
+   height=$row_height
+   width=$row_width
+   division=#col_div#}
+ +

Control flow

+ +
{if ( $amount < 0 or $amount > 1000 ) and $volume >= #minVolAmt#}
+   ...
+{/if}
+{if count($var) gt 0}{/if}
+{if $var is even by 3}
+   ...
+{/if}
+
+{foreach from=$myArray item=i name=foo}
+	{$smarty.foreach.foo.index}|{$smarty.foreach.foo.iteration},
+{/foreach}
+
+<ul>
+{foreach from=$items key=myId item=i}
+  <li><a href="item.php?id={$myId}">{$i.no}: {$i.label}</li>
+{/foreach}
+</ul>
+
+ +

Literal section

+
{literal}
+	<script>
+		(function() { /* This is JS, not Smarty */ } ());
+	</script>
+{/literal}
+
+<style type="text/css">
+{literal}
+/* this is an intersting idea for this section */
+.madIdea{
+    border: 3px outset #ffffff;
+    margin: 2 3 4 5px;
+    background-color: #001122;
+}
+{/literal}
+</style>
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Smarty tag in the middle of an HTML tag

+
<div{if $test} class="test"{/if}></div>
\ No newline at end of file From eaf8ac0c61830de62f4acb2c021f520d0dea2ab8 Mon Sep 17 00:00:00 2001 From: Golmote Date: Wed, 7 Jan 2015 19:48:29 +0100 Subject: [PATCH 123/137] Improved Markdown + added example --- components/prism-markdown.js | 86 +++++++++++++++++++------------- components/prism-markdown.min.js | 2 +- examples/prism-markdown.html | 72 ++++++++++++++++++++++++++ themes/prism-coy.css | 7 +++ themes/prism-dark.css | 6 ++- themes/prism-funky.css | 6 ++- themes/prism-okaidia.css | 6 ++- themes/prism-tomorrow.css | 6 ++- themes/prism-twilight.css | 6 ++- themes/prism.css | 6 ++- 10 files changed, 161 insertions(+), 42 deletions(-) create mode 100644 examples/prism-markdown.html diff --git a/components/prism-markdown.js b/components/prism-markdown.js index 6f89eeb1ca..f58bcc5525 100644 --- a/components/prism-markdown.js +++ b/components/prism-markdown.js @@ -3,7 +3,7 @@ Prism.languages.markdown = Prism.languages.extend('markup', { // > ... pattern: /(^|\n)>(?:[\t ]*>)*/, lookbehind: true, - alias: 'operator' + alias: 'punctuation' }, 'code': [ { @@ -27,14 +27,20 @@ Prism.languages.markdown = Prism.languages.extend('markup', { // title 2 // ------- pattern: /\w+.*\n(?:==+|--+)/, - alias: 'important' + alias: 'important', + inside: { + punctuation: /==+$|--+$/ + } }, { // # title 1 // ###### title 6 pattern: /((?:^|\n)\s*)#+.+/, lookbehind: true, - alias: 'important' + alias: 'important', + inside: { + punctuation: /^#+|#+$/ + } } ], 'hr': { @@ -42,7 +48,8 @@ Prism.languages.markdown = Prism.languages.extend('markup', { // --- // * * * // ----------- - pattern: /([*-])([\t ]*\1){2,}/, + pattern: /((?:^|\n)\s*)([*-])([\t ]*\2){2,}(?=\s*(?:\n|$))/, + lookbehind: true, alias: 'punctuation' }, 'list': { @@ -50,55 +57,64 @@ Prism.languages.markdown = Prism.languages.extend('markup', { // + item // - item // 1. item - pattern: /(?:[*+-]|\d+\.)(?=[\t ].)/, - alias: 'operator' + pattern: /((?:^|\n)\s*)(?:[*+-]|\d+\.)(?=[\t ].)/, + lookbehind: true, + alias: 'punctuation' }, - 'link-reference': { + 'url-reference': { // [id]: http://example.com "Optional title" // [id]: http://example.com 'Optional title' // [id]: http://example.com (Optional title) // [id]: "Optional title" pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:[^>]|\\>)+>)(?:[\t ]+(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\)))?/, - alias: 'symbol namespace' - }, - 'link': [ - { - // [example](http://example.com "Optional title") - pattern: /!?\[[^\]]+\]\([^\s)]+(?:[\t ]+"(?:[^"]|\\")*")?\)/, - alias: 'symbol' + inside: { + 'variable': { + pattern: /^(!?\[)[^\]]+/, + lookbehind: true + }, + 'string': /(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\))$/, + 'punctuation': /[[\]\(\)<>:]/ }, - { - // [example] [id] - pattern: /!?\[[^\]]+\] ?\[[^\]\n]*\]/, - alias: 'symbol' + alias: 'url' + }, + 'url': { + // [example](http://example.com "Optional title") + // [example] [id] + pattern: /!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:[^"]|\\")*")?\)| ?\[[^\]\n]*\])/, + inside: { + 'variable': { + pattern: /(!?\[)[^\]]+(?=\]$)/, + lookbehind: true + }, + 'string': { + pattern: /"(?:[^"]|\\")*"(?=\)$)/ + } } - ], - 'strong': [ + }, + 'bold': [ { // **strong** // __strong__ - pattern: /(^|[^\\])\*\*[\s\S]+?\*\*/, - lookbehind: true, - alias: 'string' - }, - { - pattern: /(^|[^\\])__[\s\S]+?__/, + + // Allow only one line break + pattern: /(^|[^\\])(\*\*|__)(?:\n(?!\n)|.)+?\2/, lookbehind: true, - alias: 'string' + inside: { + 'punctuation': /^\*\*|^__|\*\*\s*$|__\s*$/ + } } ], - 'em': [ + 'italic': [ { // *em* - pattern: /(^|[^\\])\*[^*\t ][^*]*\*/, - lookbehind: true, - alias: 'string' - }, - { // _em_ - pattern: /(^|[^\\])_[^_]+_/, + + // Allow only one line break + pattern: /(^|[^\\])(?:\*(?:\n(?!\n)|.)+?\*|_(?:\n(?!\n)|.)+?_)/, lookbehind: true, - alias: 'string' + inside: { + 'punctuation': /^[*_]|[*_]$/ + } } ] }); \ No newline at end of file diff --git a/components/prism-markdown.min.js b/components/prism-markdown.min.js index ff36a05e51..c0ea219521 100644 --- a/components/prism-markdown.min.js +++ b/components/prism-markdown.min.js @@ -1 +1 @@ -Prism.languages.markdown=Prism.languages.extend("markup",{blockquote:{pattern:/(^|\n)>(?:[\t ]*>)*/,lookbehind:!0,alias:"operator"},code:[{pattern:/(^|\n)(?: {4}|\t).+/,lookbehind:!0,alias:"keyword"},{pattern:/``.+?``|`[^`\n]+`/,alias:"keyword"}],title:[{pattern:/\w+.*\n(?:==+|--+)/,alias:"important"},{pattern:/((?:^|\n)\s*)#+.+/,lookbehind:!0,alias:"important"}],hr:{pattern:/([*-])([\t ]*\1){2,}/,alias:"punctuation"},list:{pattern:/(?:[*+-]|\d+\.)(?=[\t ].)/,alias:"operator"},"link-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:[^>]|\\>)+>)(?:[\t ]+(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\)))?/,alias:"symbol namespace"},link:[{pattern:/!?\[[^\]]+\]\([^\s)]+(?:[\t ]+"(?:[^"]|\\")*")?\)/,alias:"symbol"},{pattern:/!?\[[^\]]+\] ?\[[^\]\n]*\]/,alias:"symbol"}],strong:[{pattern:/(^|[^\\])\*\*[\s\S]+?\*\*/,lookbehind:!0,alias:"string"},{pattern:/(^|[^\\])__[\s\S]+?__/,lookbehind:!0,alias:"string"}],em:[{pattern:/(^|[^\\])\*[^*\t ][^*]*\*/,lookbehind:!0,alias:"string"},{pattern:/(^|[^\\])_[^_]+_/,lookbehind:!0,alias:"string"}]}); \ No newline at end of file +Prism.languages.markdown=Prism.languages.extend("markup",{blockquote:{pattern:/(^|\n)>(?:[\t ]*>)*/,lookbehind:!0,alias:"punctuation"},code:[{pattern:/(^|\n)(?: {4}|\t).+/,lookbehind:!0,alias:"keyword"},{pattern:/``.+?``|`[^`\n]+`/,alias:"keyword"}],title:[{pattern:/\w+.*\n(?:==+|--+)/,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/((?:^|\n)\s*)#+.+/,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/((?:^|\n)\s*)([*-])([\t ]*\2){2,}(?=\s*(?:\n|$))/,lookbehind:!0,alias:"punctuation"},list:{pattern:/((?:^|\n)\s*)(?:[*+-]|\d+\.)(?=[\t ].)/,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:[^>]|\\>)+>)(?:[\t ]+(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\))$/,punctuation:/[[\]\(\)<>:]/},alias:"url"},url:{pattern:/!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:[^"]|\\")*")?\)| ?\[[^\]\n]*\])/,inside:{variable:{pattern:/(!?\[)[^\]]+(?=\]$)/,lookbehind:!0},string:{pattern:/"(?:[^"]|\\")*"(?=\)$)/}}},bold:[{pattern:/(^|[^\\])(\*\*|__)(?:\n(?!\n)|.)+?\2/,lookbehind:!0,inside:{punctuation:/^\*\*|^__|\*\*\s*$|__\s*$/}}],italic:[{pattern:/(^|[^\\])(?:\*(?:\n(?!\n)|.)+?\*|_(?:\n(?!\n)|.)+?_)/,lookbehind:!0,inside:{punctuation:/^[*_]|[*_]$/}}]}); \ No newline at end of file diff --git a/examples/prism-markdown.html b/examples/prism-markdown.html new file mode 100644 index 0000000000..ac013b321f --- /dev/null +++ b/examples/prism-markdown.html @@ -0,0 +1,72 @@ +

Markdown

+

To use this language, use the class "language-markdown".

+ +

Titles

+
Title 1
+==
+
+Title 2
+-------
+
+# Title 1
+## Title 2
+### Title 3
+#### Title 4
+##### Title 5
+###### Title 6
+
+ +

Bold and italic

+
* Italic *
+** Bold on
+multiple lines **
+* Italic on
+multiple lines too *
+__ It also works with underscores __
+_ It also works with underscores _
+
+__ An empty line
+
+is not allowed __
+
+ +

Links

+
[Prism](http://www.prismjs.com)
+[Prism](http://www.prismjs.com "Prism")
+
+[prism link]: http://www.prismjs.com (Prism)
+[Prism] [prism link]
+
+ +

Lists and quotes

+
* This is
+* an unordered list
+
+1. This is an
+2. ordered list
+
+* *List item in italic*
+* **List item in bold**
+* [List item as a link](http://example.com "This is an example")
+
+> This is a quotation
+>> With another quotation inside
+> _italic here_, __bold there__
+> And a [link](http://example.com)
+
+ +

Known failures

+

There are certain edge cases where Prism will fail. + There are always such cases in every regex-based syntax highlighter. + However, Prism dares to be open and honest about them. + If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug. +

+ +

Nested elements

+
_ **bold** inside italic _
+
+__ *italic* inside bold __
+
+__ [Bold link?](http://example.com) __
+
+[Link in *italic*](http://example.com)
\ No newline at end of file diff --git a/themes/prism-coy.css b/themes/prism-coy.css index f8954bb1a2..831d03fc35 100644 --- a/themes/prism-coy.css +++ b/themes/prism-coy.css @@ -170,6 +170,13 @@ pre[class*="language-"]:after { font-weight: normal; } +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + .token.entity { cursor: help; } diff --git a/themes/prism-dark.css b/themes/prism-dark.css index 5cabfa72de..a8047fce6e 100644 --- a/themes/prism-dark.css +++ b/themes/prism-dark.css @@ -109,9 +109,13 @@ pre[class*="language-"] { color: #e90; } -.token.important { +.token.important, +.token.bold { font-weight: bold; } +.token.italic { + font-style: italic; +} .token.entity { cursor: help; diff --git a/themes/prism-funky.css b/themes/prism-funky.css index d2138254b7..f2614d1573 100644 --- a/themes/prism-funky.css +++ b/themes/prism-funky.css @@ -98,9 +98,13 @@ code[class*="language-"] { color: orange; } -.token.important { +.token.important, +.token.bold { font-weight: bold; } +.token.italic { + font-style: italic; +} .token.entity { cursor: help; diff --git a/themes/prism-okaidia.css b/themes/prism-okaidia.css index 8be4b0bdbf..d64cde3852 100644 --- a/themes/prism-okaidia.css +++ b/themes/prism-okaidia.css @@ -105,9 +105,13 @@ pre[class*="language-"] { color: #fd971f; } -.token.important { +.token.important, +.token.bold { font-weight: bold; } +.token.italic { + font-style: italic; +} .token.entity { cursor: help; diff --git a/themes/prism-tomorrow.css b/themes/prism-tomorrow.css index e41de8da82..c998fb22cb 100644 --- a/themes/prism-tomorrow.css +++ b/themes/prism-tomorrow.css @@ -102,9 +102,13 @@ pre[class*="language-"] { color: #67cdcc; } -.token.important { +.token.important, +.token.bold { font-weight: bold; } +.token.italic { + font-style: italic; +} .token.entity { cursor: help; diff --git a/themes/prism-twilight.css b/themes/prism-twilight.css index aa7b901fd6..89dbe848b4 100644 --- a/themes/prism-twilight.css +++ b/themes/prism-twilight.css @@ -125,9 +125,13 @@ code[class*="language-"]::selection, code[class*="language-"] ::selection { color: hsl(42, 75%, 65%); /* #E9C062 */ } -.token.important { +.token.important, +.token.bold { font-weight: bold; } +.token.italic { + font-style: italic; +} .token.entity { cursor: help; diff --git a/themes/prism.css b/themes/prism.css index 3a9a1e6049..a04c82c89c 100644 --- a/themes/prism.css +++ b/themes/prism.css @@ -122,9 +122,13 @@ pre[class*="language-"] { color: #e90; } -.token.important { +.token.important, +.token.bold { font-weight: bold; } +.token.italic { + font-style: italic; +} .token.entity { cursor: help; From 93c82ca2d254385254a0b3ef119133fe7fb26f19 Mon Sep 17 00:00:00 2001 From: Golmote Date: Wed, 7 Jan 2015 19:55:56 +0100 Subject: [PATCH 124/137] Fixed example --- examples/prism-markdown.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/prism-markdown.html b/examples/prism-markdown.html index ac013b321f..5622622fe4 100644 --- a/examples/prism-markdown.html +++ b/examples/prism-markdown.html @@ -17,17 +17,17 @@

Titles

Bold and italic

-
* Italic *
-** Bold on
-multiple lines **
-* Italic on
-multiple lines too *
-__ It also works with underscores __
-_ It also works with underscores _
+
*Italic*
+**Bold on
+multiple lines**
+*Italic on
+multiple lines too*
+__It also works with underscores__
+_It also works with underscores_
 
-__ An empty line
+__An empty line
 
-is not allowed __
+is not allowed__
 

Links

From c38c2447f226a6a286c4b986a6dd7731517ee7de Mon Sep 17 00:00:00 2001 From: Golmote Date: Wed, 7 Jan 2015 20:07:14 +0100 Subject: [PATCH 125/137] Fixed example --- examples/prism-markdown.html | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/examples/prism-markdown.html b/examples/prism-markdown.html index 5622622fe4..409df27270 100644 --- a/examples/prism-markdown.html +++ b/examples/prism-markdown.html @@ -55,6 +55,22 @@

Lists and quotes

> And a [link](http://example.com)
+

Code

+
Inline code between backticks `some_code()`
+
+    some_code(); /* Indented
+    with four spaces */
+
+	some_code(); /* Indented
+	with a tab */
+
+ +

Raw HTML

+
> This is a quotation
+> Containing <strong>raw HTML</strong>
+
+<p>*Italic text inside HTML tag*</p>
+

Known failures

There are certain edge cases where Prism will fail. There are always such cases in every regex-based syntax highlighter. @@ -62,11 +78,17 @@

Known failures

If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug.

-

Nested elements

+

Nested elements are not supported

_ **bold** inside italic _
 
 __ *italic* inside bold __
 
 __ [Bold link?](http://example.com) __
 
-[Link in *italic*](http://example.com)
\ No newline at end of file +[Link in *italic*](http://example.com) + +

HTML inside code blocks is not highlighted as code

+
Some `<html>`
+
+    Block of <strong>HTML</strong>
+    which is <em>not</em> highlighted as code.
\ No newline at end of file From a1ea012383bc9a3628e12a8f962dd0e6e4d7d4f3 Mon Sep 17 00:00:00 2001 From: Golmote Date: Wed, 7 Jan 2015 20:37:24 +0100 Subject: [PATCH 126/137] Add support for some nesting, give priority to Markdown over Markup, fixed example --- components/prism-markdown.js | 58 +++++++++++++++++--------------- components/prism-markdown.min.js | 2 +- examples/prism-markdown.html | 21 ++++++------ 3 files changed, 41 insertions(+), 40 deletions(-) diff --git a/components/prism-markdown.js b/components/prism-markdown.js index f58bcc5525..89ec0c2467 100644 --- a/components/prism-markdown.js +++ b/components/prism-markdown.js @@ -1,4 +1,5 @@ -Prism.languages.markdown = Prism.languages.extend('markup', { +Prism.languages.markdown = Prism.languages.extend('markup', {}); +Prism.languages.insertBefore('markdown', 'prolog', { 'blockquote': { // > ... pattern: /(^|\n)>(?:[\t ]*>)*/, @@ -77,6 +78,28 @@ Prism.languages.markdown = Prism.languages.extend('markup', { }, alias: 'url' }, + 'bold': { + // **strong** + // __strong__ + + // Allow only one line break + pattern: /(^|[^\\])(\*\*|__)(?:\n(?!\n)|.)+?\2/, + lookbehind: true, + inside: { + 'punctuation': /^\*\*|^__|\*\*\s*$|__\s*$/ + } + }, + 'italic': { + // *em* + // _em_ + + // Allow only one line break + pattern: /(^|[^\\])(?:\*(?:\n(?!\n)|.)+?\*|_(?:\n(?!\n)|.)+?_)/, + lookbehind: true, + inside: { + 'punctuation': /^[*_]|[*_]$/ + } + }, 'url': { // [example](http://example.com "Optional title") // [example] [id] @@ -90,31 +113,10 @@ Prism.languages.markdown = Prism.languages.extend('markup', { pattern: /"(?:[^"]|\\")*"(?=\)$)/ } } - }, - 'bold': [ - { - // **strong** - // __strong__ + } +}); - // Allow only one line break - pattern: /(^|[^\\])(\*\*|__)(?:\n(?!\n)|.)+?\2/, - lookbehind: true, - inside: { - 'punctuation': /^\*\*|^__|\*\*\s*$|__\s*$/ - } - } - ], - 'italic': [ - { - // *em* - // _em_ - - // Allow only one line break - pattern: /(^|[^\\])(?:\*(?:\n(?!\n)|.)+?\*|_(?:\n(?!\n)|.)+?_)/, - lookbehind: true, - inside: { - 'punctuation': /^[*_]|[*_]$/ - } - } - ] -}); \ No newline at end of file +Prism.languages.markdown['bold'].inside['url'] = Prism.languages.markdown['url']; +Prism.languages.markdown['italic'].inside['url'] = Prism.languages.markdown['url']; +Prism.languages.markdown['bold'].inside['italic'] = Prism.languages.markdown['italic']; +Prism.languages.markdown['italic'].inside['bold'] = Prism.languages.markdown['bold']; \ No newline at end of file diff --git a/components/prism-markdown.min.js b/components/prism-markdown.min.js index c0ea219521..684293835d 100644 --- a/components/prism-markdown.min.js +++ b/components/prism-markdown.min.js @@ -1 +1 @@ -Prism.languages.markdown=Prism.languages.extend("markup",{blockquote:{pattern:/(^|\n)>(?:[\t ]*>)*/,lookbehind:!0,alias:"punctuation"},code:[{pattern:/(^|\n)(?: {4}|\t).+/,lookbehind:!0,alias:"keyword"},{pattern:/``.+?``|`[^`\n]+`/,alias:"keyword"}],title:[{pattern:/\w+.*\n(?:==+|--+)/,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/((?:^|\n)\s*)#+.+/,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/((?:^|\n)\s*)([*-])([\t ]*\2){2,}(?=\s*(?:\n|$))/,lookbehind:!0,alias:"punctuation"},list:{pattern:/((?:^|\n)\s*)(?:[*+-]|\d+\.)(?=[\t ].)/,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:[^>]|\\>)+>)(?:[\t ]+(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\))$/,punctuation:/[[\]\(\)<>:]/},alias:"url"},url:{pattern:/!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:[^"]|\\")*")?\)| ?\[[^\]\n]*\])/,inside:{variable:{pattern:/(!?\[)[^\]]+(?=\]$)/,lookbehind:!0},string:{pattern:/"(?:[^"]|\\")*"(?=\)$)/}}},bold:[{pattern:/(^|[^\\])(\*\*|__)(?:\n(?!\n)|.)+?\2/,lookbehind:!0,inside:{punctuation:/^\*\*|^__|\*\*\s*$|__\s*$/}}],italic:[{pattern:/(^|[^\\])(?:\*(?:\n(?!\n)|.)+?\*|_(?:\n(?!\n)|.)+?_)/,lookbehind:!0,inside:{punctuation:/^[*_]|[*_]$/}}]}); \ No newline at end of file +Prism.languages.markdown=Prism.languages.extend("markup",{}),Prism.languages.insertBefore("markdown","prolog",{blockquote:{pattern:/(^|\n)>(?:[\t ]*>)*/,lookbehind:!0,alias:"punctuation"},code:[{pattern:/(^|\n)(?: {4}|\t).+/,lookbehind:!0,alias:"keyword"},{pattern:/``.+?``|`[^`\n]+`/,alias:"keyword"}],title:[{pattern:/\w+.*\n(?:==+|--+)/,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/((?:^|\n)\s*)#+.+/,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/((?:^|\n)\s*)([*-])([\t ]*\2){2,}(?=\s*(?:\n|$))/,lookbehind:!0,alias:"punctuation"},list:{pattern:/((?:^|\n)\s*)(?:[*+-]|\d+\.)(?=[\t ].)/,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:[^>]|\\>)+>)(?:[\t ]+(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:[^"]|\\")*"|'(?:[^']|\\')*'|\((?:[^)]|\\\))*\))$/,punctuation:/[[\]\(\)<>:]/},alias:"url"},bold:{pattern:/(^|[^\\])(\*\*|__)(?:\n(?!\n)|.)+?\2/,lookbehind:!0,inside:{punctuation:/^\*\*|^__|\*\*\s*$|__\s*$/}},italic:{pattern:/(^|[^\\])(?:\*(?:\n(?!\n)|.)+?\*|_(?:\n(?!\n)|.)+?_)/,lookbehind:!0,inside:{punctuation:/^[*_]|[*_]$/}},url:{pattern:/!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:[^"]|\\")*")?\)| ?\[[^\]\n]*\])/,inside:{variable:{pattern:/(!?\[)[^\]]+(?=\]$)/,lookbehind:!0},string:{pattern:/"(?:[^"]|\\")*"(?=\)$)/}}}}),Prism.languages.markdown.bold.inside.url=Prism.languages.markdown.url,Prism.languages.markdown.italic.inside.url=Prism.languages.markdown.url,Prism.languages.markdown.bold.inside.italic=Prism.languages.markdown.italic,Prism.languages.markdown.italic.inside.bold=Prism.languages.markdown.bold; \ No newline at end of file diff --git a/examples/prism-markdown.html b/examples/prism-markdown.html index 409df27270..b000aef89c 100644 --- a/examples/prism-markdown.html +++ b/examples/prism-markdown.html @@ -56,7 +56,7 @@

Lists and quotes

Code

-
Inline code between backticks `some_code()`
+
Inline code between backticks `<p>Paragraph</p>`
 
     some_code(); /* Indented
     with four spaces */
@@ -78,17 +78,16 @@ 

Known failures

If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug.

-

Nested elements are not supported

-
_ **bold** inside italic _
+

Nesting of elements is not fully supported

+
_ **bold** inside italic does not work _
 
-__ *italic* inside bold __
+__ *italic* inside bold does work __
 
-__ [Bold link?](http://example.com) __
+_ [Italic link does work](http://example.com) _
+__ [Bold link does work](http://example.com) __
 
-[Link in *italic*](http://example.com)
+[Link partially *italic* does not work](http://example.com) +[Link partially **bold** does not work](http://example.com)
-

HTML inside code blocks is not highlighted as code

-
Some `<html>`
-
-    Block of <strong>HTML</strong>
-    which is <em>not</em> highlighted as code.
\ No newline at end of file +

Markdown-like HTML attribute

+
<p class="_test_"></p>
\ No newline at end of file From fb6e3e4b630b5b3d3f06744ea77bd94d07db2f24 Mon Sep 17 00:00:00 2001 From: Golmote Date: Wed, 7 Jan 2015 20:50:48 +0100 Subject: [PATCH 127/137] Make nesting failures more clear --- examples/prism-markdown.html | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/examples/prism-markdown.html b/examples/prism-markdown.html index b000aef89c..6eea73d741 100644 --- a/examples/prism-markdown.html +++ b/examples/prism-markdown.html @@ -79,15 +79,14 @@

Known failures

Nesting of elements is not fully supported

-
_ **bold** inside italic does not work _
+
_ **bold** inside italic DOESN'T work _
+__ but *italic* inside bold DOES work __
 
-__ *italic* inside bold does work __
+[Link partially *italic* DOESN'T work](http://example.com)
+_ [But link inside italic DOES work](http://example.com) _
 
-_ [Italic link does work](http://example.com) _
-__ [Bold link does work](http://example.com) __
-
-[Link partially *italic* does not work](http://example.com)
-[Link partially **bold** does not work](http://example.com)
+[Link partially **bold** DOESN'T work](http://example.com) +__ [But link inside bold DOES work](http://example.com) __

Markdown-like HTML attribute

<p class="_test_"></p>
\ No newline at end of file From 2d5089edf5f21eab32a1caf4e5af9c0978f34bc6 Mon Sep 17 00:00:00 2001 From: Golmote Date: Thu, 8 Jan 2015 08:55:24 +0100 Subject: [PATCH 128/137] Remove leading line break Fixes #455 --- components/prism-core.js | 2 ++ components/prism-core.min.js | 2 +- prism.js | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/components/prism-core.js b/components/prism-core.js index fc4662e5bc..bda0d0dbad 100644 --- a/components/prism-core.js +++ b/components/prism-core.js @@ -181,6 +181,8 @@ var _ = self.Prism = { return; } + code = code.replace(/^\n/,''); + var env = { element: element, language: language, diff --git a/components/prism-core.min.js b/components/prism-core.min.js index 8adebed4c3..9783f8fd14 100644 --- a/components/prism-core.min.js +++ b/components/prism-core.min.js @@ -1 +1 @@ -self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{};var Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&").replace(/e.length)break e;if(!(d instanceof a)){g.lastIndex=0;var m=g.exec(d);if(m){c&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,k=y+v,b=d.slice(0,y+1),w=d.slice(k+1),O=[p,1];b&&O.push(b);var N=new a(l,u?t.tokenize(m,u):m,h);O.push(N),w&&O.push(w),Array.prototype.splice.apply(r,O)}}}}}return r},hooks:{all:{},add:function(e,n){var a=t.hooks.all;a[e]=a[e]||[],a[e].push(n)},run:function(e,n){var a=t.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(n)}}},n=t.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(n.stringify=function(e,a,r){if("string"==typeof e)return e;if("[object Array]"==Object.prototype.toString.call(e))return e.map(function(t){return n.stringify(t,a,e)}).join("");var i={type:e.type,content:n.stringify(e.content,a,r),tag:"span",classes:["token",e.type],attributes:{},language:a,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}t.hooks.run("wrap",i);var s="";for(var o in i.attributes)s+=o+'="'+(i.attributes[o]||"")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'" '+s+">"+i.content+""},!self.document)return self.addEventListener?(self.addEventListener("message",function(e){var n=JSON.parse(e.data),a=n.language,r=n.code;self.postMessage(JSON.stringify(t.util.encode(t.tokenize(r,t.languages[a])))),self.close()},!1),self.Prism):self.Prism;var a=document.getElementsByTagName("script");return a=a[a.length-1],a&&(t.filename=a.src,document.addEventListener&&!a.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)),self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism); \ No newline at end of file +self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{};var Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&").replace(/e.length)break e;if(!(d instanceof a)){g.lastIndex=0;var m=g.exec(d);if(m){u&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,k=y+v,b=d.slice(0,y+1),w=d.slice(k+1),O=[p,1];b&&O.push(b);var N=new a(l,c?t.tokenize(m,c):m,h);O.push(N),w&&O.push(w),Array.prototype.splice.apply(r,O)}}}}}return r},hooks:{all:{},add:function(e,n){var a=t.hooks.all;a[e]=a[e]||[],a[e].push(n)},run:function(e,n){var a=t.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(n)}}},n=t.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(n.stringify=function(e,a,r){if("string"==typeof e)return e;if("[object Array]"==Object.prototype.toString.call(e))return e.map(function(t){return n.stringify(t,a,e)}).join("");var i={type:e.type,content:n.stringify(e.content,a,r),tag:"span",classes:["token",e.type],attributes:{},language:a,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}t.hooks.run("wrap",i);var s="";for(var o in i.attributes)s+=o+'="'+(i.attributes[o]||"")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'" '+s+">"+i.content+""},!self.document)return self.addEventListener?(self.addEventListener("message",function(e){var n=JSON.parse(e.data),a=n.language,r=n.code;self.postMessage(JSON.stringify(t.util.encode(t.tokenize(r,t.languages[a])))),self.close()},!1),self.Prism):self.Prism;var a=document.getElementsByTagName("script");return a=a[a.length-1],a&&(t.filename=a.src,document.addEventListener&&!a.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)),self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism); \ No newline at end of file diff --git a/prism.js b/prism.js index cdb04d2c4c..551610c156 100644 --- a/prism.js +++ b/prism.js @@ -186,6 +186,8 @@ var _ = self.Prism = { return; } + code = code.replace(/^\n/,''); + var env = { element: element, language: language, From 36999ddf3e65b853b7e50a435a0cb27acb632fc5 Mon Sep 17 00:00:00 2001 From: Golmote Date: Thu, 8 Jan 2015 19:51:55 +0100 Subject: [PATCH 129/137] Handle trailing \r\n and \r --- components/prism-core.js | 2 +- components/prism-core.min.js | 2 +- prism.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/prism-core.js b/components/prism-core.js index bda0d0dbad..166f104cf8 100644 --- a/components/prism-core.js +++ b/components/prism-core.js @@ -181,7 +181,7 @@ var _ = self.Prism = { return; } - code = code.replace(/^\n/,''); + code = code.replace(/^(?:\r\n|\r|\n)/,''); var env = { element: element, diff --git a/components/prism-core.min.js b/components/prism-core.min.js index 9783f8fd14..7f23ccca29 100644 --- a/components/prism-core.min.js +++ b/components/prism-core.min.js @@ -1 +1 @@ -self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{};var Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&").replace(/e.length)break e;if(!(d instanceof a)){g.lastIndex=0;var m=g.exec(d);if(m){u&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,k=y+v,b=d.slice(0,y+1),w=d.slice(k+1),O=[p,1];b&&O.push(b);var N=new a(l,c?t.tokenize(m,c):m,h);O.push(N),w&&O.push(w),Array.prototype.splice.apply(r,O)}}}}}return r},hooks:{all:{},add:function(e,n){var a=t.hooks.all;a[e]=a[e]||[],a[e].push(n)},run:function(e,n){var a=t.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(n)}}},n=t.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(n.stringify=function(e,a,r){if("string"==typeof e)return e;if("[object Array]"==Object.prototype.toString.call(e))return e.map(function(t){return n.stringify(t,a,e)}).join("");var i={type:e.type,content:n.stringify(e.content,a,r),tag:"span",classes:["token",e.type],attributes:{},language:a,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}t.hooks.run("wrap",i);var s="";for(var o in i.attributes)s+=o+'="'+(i.attributes[o]||"")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'" '+s+">"+i.content+""},!self.document)return self.addEventListener?(self.addEventListener("message",function(e){var n=JSON.parse(e.data),a=n.language,r=n.code;self.postMessage(JSON.stringify(t.util.encode(t.tokenize(r,t.languages[a])))),self.close()},!1),self.Prism):self.Prism;var a=document.getElementsByTagName("script");return a=a[a.length-1],a&&(t.filename=a.src,document.addEventListener&&!a.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)),self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism); \ No newline at end of file +self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{};var Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&").replace(/e.length)break e;if(!(d instanceof a)){g.lastIndex=0;var m=g.exec(d);if(m){u&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,k=y+v,b=d.slice(0,y+1),w=d.slice(k+1),O=[p,1];b&&O.push(b);var N=new a(l,c?t.tokenize(m,c):m,h);O.push(N),w&&O.push(w),Array.prototype.splice.apply(r,O)}}}}}return r},hooks:{all:{},add:function(e,n){var a=t.hooks.all;a[e]=a[e]||[],a[e].push(n)},run:function(e,n){var a=t.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(n)}}},n=t.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(n.stringify=function(e,a,r){if("string"==typeof e)return e;if("[object Array]"==Object.prototype.toString.call(e))return e.map(function(t){return n.stringify(t,a,e)}).join("");var i={type:e.type,content:n.stringify(e.content,a,r),tag:"span",classes:["token",e.type],attributes:{},language:a,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}t.hooks.run("wrap",i);var s="";for(var o in i.attributes)s+=o+'="'+(i.attributes[o]||"")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'" '+s+">"+i.content+""},!self.document)return self.addEventListener?(self.addEventListener("message",function(e){var n=JSON.parse(e.data),a=n.language,r=n.code;self.postMessage(JSON.stringify(t.util.encode(t.tokenize(r,t.languages[a])))),self.close()},!1),self.Prism):self.Prism;var a=document.getElementsByTagName("script");return a=a[a.length-1],a&&(t.filename=a.src,document.addEventListener&&!a.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)),self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism); \ No newline at end of file diff --git a/prism.js b/prism.js index 551610c156..50c3356804 100644 --- a/prism.js +++ b/prism.js @@ -186,7 +186,7 @@ var _ = self.Prism = { return; } - code = code.replace(/^\n/,''); + code = code.replace(/^(?:\r\n|\r|\n)/,''); var env = { element: element, From 91d44f27a3795ea7c6567456128de3231f21e647 Mon Sep 17 00:00:00 2001 From: Golmote Date: Fri, 9 Jan 2015 08:10:19 +0100 Subject: [PATCH 130/137] Fixed pattern deletion in Scala --- components/prism-scala.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/prism-scala.js b/components/prism-scala.js index 8627503309..2a6938db3e 100644 --- a/components/prism-scala.js +++ b/components/prism-scala.js @@ -5,4 +5,5 @@ Prism.languages.scala = Prism.languages.extend('java', { 'symbol': /'([^\d\s]\w*)/g, 'string': /(""")[\W\w]*?\1|("|\/)[\W\w]*?\2|('.')/g }); -delete Prism.languages.scala['class-name','function']; +delete Prism.languages.scala['class-name']; +delete Prism.languages.scala['function']; From 9487b5bead96834801493080f8fc68167d2378ff Mon Sep 17 00:00:00 2001 From: Golmote Date: Fri, 9 Jan 2015 08:11:21 +0100 Subject: [PATCH 131/137] Removed unneeded escapes in RegExps, added some semicolons --- components/prism-apacheconf.js | 2 +- components/prism-aspnet.js | 2 +- components/prism-autohotkey.js | 6 +++--- components/prism-c.js | 2 +- components/prism-clike.js | 2 +- components/prism-core.js | 2 +- components/prism-cpp.js | 4 ++-- components/prism-css.js | 2 +- components/prism-gherkin.js | 2 +- components/prism-ini.js | 6 +++--- components/prism-latex.js | 2 +- components/prism-markup.js | 2 +- components/prism-nsis.js | 4 ++-- components/prism-rip.js | 8 ++++---- components/prism-scheme.js | 2 +- components/prism-scss.js | 4 ++-- components/prism-swift.js | 2 +- components/prism-twig.js | 16 ++++++++-------- 18 files changed, 35 insertions(+), 35 deletions(-) diff --git a/components/prism-apacheconf.js b/components/prism-apacheconf.js index eec903739a..63c4d9b9e4 100644 --- a/components/prism-apacheconf.js +++ b/components/prism-apacheconf.js @@ -1,5 +1,5 @@ Prism.languages.apacheconf = { - 'comment': /\#.*/g, + 'comment': /#.*/g, 'directive-inline': { pattern: /^\s*\b(AcceptFilter|AcceptPathInfo|AccessFileName|Action|AddAlt|AddAltByEncoding|AddAltByType|AddCharset|AddDefaultCharset|AddDescription|AddEncoding|AddHandler|AddIcon|AddIconByEncoding|AddIconByType|AddInputFilter|AddLanguage|AddModuleInfo|AddOutputFilter|AddOutputFilterByType|AddType|Alias|AliasMatch|Allow|AllowCONNECT|AllowEncodedSlashes|AllowMethods|AllowOverride|AllowOverrideList|Anonymous|Anonymous_LogEmail|Anonymous_MustGiveEmail|Anonymous_NoUserID|Anonymous_VerifyEmail|AsyncRequestWorkerFactor|AuthBasicAuthoritative|AuthBasicFake|AuthBasicProvider|AuthBasicUseDigestAlgorithm|AuthDBDUserPWQuery|AuthDBDUserRealmQuery|AuthDBMGroupFile|AuthDBMType|AuthDBMUserFile|AuthDigestAlgorithm|AuthDigestDomain|AuthDigestNonceLifetime|AuthDigestProvider|AuthDigestQop|AuthDigestShmemSize|AuthFormAuthoritative|AuthFormBody|AuthFormDisableNoStore|AuthFormFakeBasicAuth|AuthFormLocation|AuthFormLoginRequiredLocation|AuthFormLoginSuccessLocation|AuthFormLogoutLocation|AuthFormMethod|AuthFormMimetype|AuthFormPassword|AuthFormProvider|AuthFormSitePassphrase|AuthFormSize|AuthFormUsername|AuthGroupFile|AuthLDAPAuthorizePrefix|AuthLDAPBindAuthoritative|AuthLDAPBindDN|AuthLDAPBindPassword|AuthLDAPCharsetConfig|AuthLDAPCompareAsUser|AuthLDAPCompareDNOnServer|AuthLDAPDereferenceAliases|AuthLDAPGroupAttribute|AuthLDAPGroupAttributeIsDN|AuthLDAPInitialBindAsUser|AuthLDAPInitialBindPattern|AuthLDAPMaxSubGroupDepth|AuthLDAPRemoteUserAttribute|AuthLDAPRemoteUserIsDN|AuthLDAPSearchAsUser|AuthLDAPSubGroupAttribute|AuthLDAPSubGroupClass|AuthLDAPUrl|AuthMerging|AuthName|AuthnCacheContext|AuthnCacheEnable|AuthnCacheProvideFor|AuthnCacheSOCache|AuthnCacheTimeout|AuthnzFcgiCheckAuthnProvider|AuthnzFcgiDefineProvider|AuthType|AuthUserFile|AuthzDBDLoginToReferer|AuthzDBDQuery|AuthzDBDRedirectQuery|AuthzDBMType|AuthzSendForbiddenOnFailure|BalancerGrowth|BalancerInherit|BalancerMember|BalancerPersist|BrowserMatch|BrowserMatchNoCase|BufferedLogs|BufferSize|CacheDefaultExpire|CacheDetailHeader|CacheDirLength|CacheDirLevels|CacheDisable|CacheEnable|CacheFile|CacheHeader|CacheIgnoreCacheControl|CacheIgnoreHeaders|CacheIgnoreNoLastMod|CacheIgnoreQueryString|CacheIgnoreURLSessionIdentifiers|CacheKeyBaseURL|CacheLastModifiedFactor|CacheLock|CacheLockMaxAge|CacheLockPath|CacheMaxExpire|CacheMaxFileSize|CacheMinExpire|CacheMinFileSize|CacheNegotiatedDocs|CacheQuickHandler|CacheReadSize|CacheReadTime|CacheRoot|CacheSocache|CacheSocacheMaxSize|CacheSocacheMaxTime|CacheSocacheMinTime|CacheSocacheReadSize|CacheSocacheReadTime|CacheStaleOnError|CacheStoreExpired|CacheStoreNoStore|CacheStorePrivate|CGIDScriptTimeout|CGIMapExtension|CharsetDefault|CharsetOptions|CharsetSourceEnc|CheckCaseOnly|CheckSpelling|ChrootDir|ContentDigest|CookieDomain|CookieExpires|CookieName|CookieStyle|CookieTracking|CoreDumpDirectory|CustomLog|Dav|DavDepthInfinity|DavGenericLockDB|DavLockDB|DavMinTimeout|DBDExptime|DBDInitSQL|DBDKeep|DBDMax|DBDMin|DBDParams|DBDPersist|DBDPrepareSQL|DBDriver|DefaultIcon|DefaultLanguage|DefaultRuntimeDir|DefaultType|Define|DeflateBufferSize|DeflateCompressionLevel|DeflateFilterNote|DeflateInflateLimitRequestBody|DeflateInflateRatioBurst|DeflateInflateRatioLimit|DeflateMemLevel|DeflateWindowSize|Deny|DirectoryCheckHandler|DirectoryIndex|DirectoryIndexRedirect|DirectorySlash|DocumentRoot|DTracePrivileges|DumpIOInput|DumpIOOutput|EnableExceptionHook|EnableMMAP|EnableSendfile|Error|ErrorDocument|ErrorLog|ErrorLogFormat|Example|ExpiresActive|ExpiresByType|ExpiresDefault|ExtendedStatus|ExtFilterDefine|ExtFilterOptions|FallbackResource|FileETag|FilterChain|FilterDeclare|FilterProtocol|FilterProvider|FilterTrace|ForceLanguagePriority|ForceType|ForensicLog|GprofDir|GracefulShutdownTimeout|Group|Header|HeaderName|HeartbeatAddress|HeartbeatListen|HeartbeatMaxServers|HeartbeatStorage|HeartbeatStorage|HostnameLookups|IdentityCheck|IdentityCheckTimeout|ImapBase|ImapDefault|ImapMenu|Include|IncludeOptional|IndexHeadInsert|IndexIgnore|IndexIgnoreReset|IndexOptions|IndexOrderDefault|IndexStyleSheet|InputSed|ISAPIAppendLogToErrors|ISAPIAppendLogToQuery|ISAPICacheFile|ISAPIFakeAsync|ISAPILogNotSupported|ISAPIReadAheadBuffer|KeepAlive|KeepAliveTimeout|KeptBodySize|LanguagePriority|LDAPCacheEntries|LDAPCacheTTL|LDAPConnectionPoolTTL|LDAPConnectionTimeout|LDAPLibraryDebug|LDAPOpCacheEntries|LDAPOpCacheTTL|LDAPReferralHopLimit|LDAPReferrals|LDAPRetries|LDAPRetryDelay|LDAPSharedCacheFile|LDAPSharedCacheSize|LDAPTimeout|LDAPTrustedClientCert|LDAPTrustedGlobalCert|LDAPTrustedMode|LDAPVerifyServerCert|LimitInternalRecursion|LimitRequestBody|LimitRequestFields|LimitRequestFieldSize|LimitRequestLine|LimitXMLRequestBody|Listen|ListenBackLog|LoadFile|LoadModule|LogFormat|LogLevel|LogMessage|LuaAuthzProvider|LuaCodeCache|LuaHookAccessChecker|LuaHookAuthChecker|LuaHookCheckUserID|LuaHookFixups|LuaHookInsertFilter|LuaHookLog|LuaHookMapToStorage|LuaHookTranslateName|LuaHookTypeChecker|LuaInherit|LuaInputFilter|LuaMapHandler|LuaOutputFilter|LuaPackageCPath|LuaPackagePath|LuaQuickHandler|LuaRoot|LuaScope|MaxConnectionsPerChild|MaxKeepAliveRequests|MaxMemFree|MaxRangeOverlaps|MaxRangeReversals|MaxRanges|MaxRequestWorkers|MaxSpareServers|MaxSpareThreads|MaxThreads|MergeTrailers|MetaDir|MetaFiles|MetaSuffix|MimeMagicFile|MinSpareServers|MinSpareThreads|MMapFile|ModemStandard|ModMimeUsePathInfo|MultiviewsMatch|Mutex|NameVirtualHost|NoProxy|NWSSLTrustedCerts|NWSSLUpgradeable|Options|Order|OutputSed|PassEnv|PidFile|PrivilegesMode|Protocol|ProtocolEcho|ProxyAddHeaders|ProxyBadHeader|ProxyBlock|ProxyDomain|ProxyErrorOverride|ProxyExpressDBMFile|ProxyExpressDBMType|ProxyExpressEnable|ProxyFtpDirCharset|ProxyFtpEscapeWildcards|ProxyFtpListOnWildcard|ProxyHTMLBufSize|ProxyHTMLCharsetOut|ProxyHTMLDocType|ProxyHTMLEnable|ProxyHTMLEvents|ProxyHTMLExtended|ProxyHTMLFixups|ProxyHTMLInterp|ProxyHTMLLinks|ProxyHTMLMeta|ProxyHTMLStripComments|ProxyHTMLURLMap|ProxyIOBufferSize|ProxyMaxForwards|ProxyPass|ProxyPassInherit|ProxyPassInterpolateEnv|ProxyPassMatch|ProxyPassReverse|ProxyPassReverseCookieDomain|ProxyPassReverseCookiePath|ProxyPreserveHost|ProxyReceiveBufferSize|ProxyRemote|ProxyRemoteMatch|ProxyRequests|ProxySCGIInternalRedirect|ProxySCGISendfile|ProxySet|ProxySourceAddress|ProxyStatus|ProxyTimeout|ProxyVia|ReadmeName|ReceiveBufferSize|Redirect|RedirectMatch|RedirectPermanent|RedirectTemp|ReflectorHeader|RemoteIPHeader|RemoteIPInternalProxy|RemoteIPInternalProxyList|RemoteIPProxiesHeader|RemoteIPTrustedProxy|RemoteIPTrustedProxyList|RemoveCharset|RemoveEncoding|RemoveHandler|RemoveInputFilter|RemoveLanguage|RemoveOutputFilter|RemoveType|RequestHeader|RequestReadTimeout|Require|RewriteBase|RewriteCond|RewriteEngine|RewriteMap|RewriteOptions|RewriteRule|RLimitCPU|RLimitMEM|RLimitNPROC|Satisfy|ScoreBoardFile|Script|ScriptAlias|ScriptAliasMatch|ScriptInterpreterSource|ScriptLog|ScriptLogBuffer|ScriptLogLength|ScriptSock|SecureListen|SeeRequestTail|SendBufferSize|ServerAdmin|ServerAlias|ServerLimit|ServerName|ServerPath|ServerRoot|ServerSignature|ServerTokens|Session|SessionCookieName|SessionCookieName2|SessionCookieRemove|SessionCryptoCipher|SessionCryptoDriver|SessionCryptoPassphrase|SessionCryptoPassphraseFile|SessionDBDCookieName|SessionDBDCookieName2|SessionDBDCookieRemove|SessionDBDDeleteLabel|SessionDBDInsertLabel|SessionDBDPerUser|SessionDBDSelectLabel|SessionDBDUpdateLabel|SessionEnv|SessionExclude|SessionHeader|SessionInclude|SessionMaxAge|SetEnv|SetEnvIf|SetEnvIfExpr|SetEnvIfNoCase|SetHandler|SetInputFilter|SetOutputFilter|SSIEndTag|SSIErrorMsg|SSIETag|SSILastModified|SSILegacyExprParser|SSIStartTag|SSITimeFormat|SSIUndefinedEcho|SSLCACertificateFile|SSLCACertificatePath|SSLCADNRequestFile|SSLCADNRequestPath|SSLCARevocationCheck|SSLCARevocationFile|SSLCARevocationPath|SSLCertificateChainFile|SSLCertificateFile|SSLCertificateKeyFile|SSLCipherSuite|SSLCompression|SSLCryptoDevice|SSLEngine|SSLFIPS|SSLHonorCipherOrder|SSLInsecureRenegotiation|SSLOCSPDefaultResponder|SSLOCSPEnable|SSLOCSPOverrideResponder|SSLOCSPResponderTimeout|SSLOCSPResponseMaxAge|SSLOCSPResponseTimeSkew|SSLOCSPUseRequestNonce|SSLOpenSSLConfCmd|SSLOptions|SSLPassPhraseDialog|SSLProtocol|SSLProxyCACertificateFile|SSLProxyCACertificatePath|SSLProxyCARevocationCheck|SSLProxyCARevocationFile|SSLProxyCARevocationPath|SSLProxyCheckPeerCN|SSLProxyCheckPeerExpire|SSLProxyCheckPeerName|SSLProxyCipherSuite|SSLProxyEngine|SSLProxyMachineCertificateChainFile|SSLProxyMachineCertificateFile|SSLProxyMachineCertificatePath|SSLProxyProtocol|SSLProxyVerify|SSLProxyVerifyDepth|SSLRandomSeed|SSLRenegBufferSize|SSLRequire|SSLRequireSSL|SSLSessionCache|SSLSessionCacheTimeout|SSLSessionTicketKeyFile|SSLSRPUnknownUserSeed|SSLSRPVerifierFile|SSLStaplingCache|SSLStaplingErrorCacheTimeout|SSLStaplingFakeTryLater|SSLStaplingForceURL|SSLStaplingResponderTimeout|SSLStaplingResponseMaxAge|SSLStaplingResponseTimeSkew|SSLStaplingReturnResponderErrors|SSLStaplingStandardCacheTimeout|SSLStrictSNIVHostCheck|SSLUserName|SSLUseStapling|SSLVerifyClient|SSLVerifyDepth|StartServers|StartThreads|Substitute|Suexec|SuexecUserGroup|ThreadLimit|ThreadsPerChild|ThreadStackSize|TimeOut|TraceEnable|TransferLog|TypesConfig|UnDefine|UndefMacro|UnsetEnv|Use|UseCanonicalName|UseCanonicalPhysicalPort|User|UserDir|VHostCGIMode|VHostCGIPrivs|VHostGroup|VHostPrivs|VHostSecure|VHostUser|VirtualDocumentRoot|VirtualDocumentRootIP|VirtualScriptAlias|VirtualScriptAliasIP|WatchdogInterval|XBitHack|xml2EncAlias|xml2EncDefault|xml2StartParse)\b/gmi, alias: 'property' diff --git a/components/prism-aspnet.js b/components/prism-aspnet.js index bfbc546b70..d4e72cfd03 100644 --- a/components/prism-aspnet.js +++ b/components/prism-aspnet.js @@ -44,6 +44,6 @@ if ( Prism.languages.aspnet.style ) { Prism.languages.aspnet.style.inside.tag.inside = Prism.languages.aspnet.tag.inside; } if ( Prism.languages.aspnet.script ) { - Prism.languages.aspnet.script.inside.tag.pattern = Prism.languages.aspnet['asp script'].inside.tag.pattern + Prism.languages.aspnet.script.inside.tag.pattern = Prism.languages.aspnet['asp script'].inside.tag.pattern; Prism.languages.aspnet.script.inside.tag.inside = Prism.languages.aspnet.tag.inside; } \ No newline at end of file diff --git a/components/prism-autohotkey.js b/components/prism-autohotkey.js index 1a433e5d0e..ee2b41df90 100644 --- a/components/prism-autohotkey.js +++ b/components/prism-autohotkey.js @@ -5,11 +5,11 @@ Prism.languages.autohotkey= { lookbehind: true }, 'string': /"(([^"\n\r]|"")*)"/gm, - 'function': /[^\(\); \t\,\n\+\*\-\=\?>:\\\/<\&%\[\]]+?(?=\()/gm, //function - don't use .*\) in the end bcoz string locks it + 'function': /[^\(\); \t,\n\+\*\-=\?>:\\\/<&%\[\]]+?(?=\()/gm, //function - don't use .*\) in the end bcoz string locks it 'tag': /^[ \t]*[^\s:]+?(?=:[^:])/gm, //labels - 'variable': /\%\w+\%/g, + 'variable': /%\w+%/g, 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g, - 'operator': /[\+\-\*\\\/:=\?\&\|<>]/g, + 'operator': /[\+\-\*\\\/:=\?&\|<>]/g, 'punctuation': /[\{}[\]\(\):]/g, 'boolean': /\b(true|false)\b/g, diff --git a/components/prism-c.js b/components/prism-c.js index e56da5e1a9..3683be394d 100644 --- a/components/prism-c.js +++ b/components/prism-c.js @@ -16,7 +16,7 @@ Prism.languages.insertBefore('c', 'string', { // highlight the path of the include statement as a string 'string': { pattern: /(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/g, - lookbehind: true, + lookbehind: true } } } diff --git a/components/prism-clike.js b/components/prism-clike.js index f835e76cbe..8d3428846f 100644 --- a/components/prism-clike.js +++ b/components/prism-clike.js @@ -26,7 +26,7 @@ Prism.languages.clike = { } }, 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g, - 'operator': /[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|\~|\^|\%/g, + 'operator': /[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|~|\^|%/g, 'ignore': /&(lt|gt|amp);/gi, 'punctuation': /[{}[\];(),.:]/g }; diff --git a/components/prism-core.js b/components/prism-core.js index 166f104cf8..f0e1507194 100644 --- a/components/prism-core.js +++ b/components/prism-core.js @@ -212,7 +212,7 @@ var _ = self.Prism = { })); } else { - env.highlightedCode = _.highlight(env.code, env.grammar, env.language) + env.highlightedCode = _.highlight(env.code, env.grammar, env.language); _.hooks.run('before-insert', env); diff --git a/components/prism-cpp.js b/components/prism-cpp.js index 88e9b407aa..53bf5a6c63 100644 --- a/components/prism-cpp.js +++ b/components/prism-cpp.js @@ -7,6 +7,6 @@ Prism.languages.cpp = Prism.languages.extend('c', { Prism.languages.insertBefore('cpp', 'keyword', { 'class-name': { pattern: /(class\s+)[a-z0-9_]+/ig, - lookbehind: true, - }, + lookbehind: true + } }); \ No newline at end of file diff --git a/components/prism-css.js b/components/prism-css.js index 5b027ee12f..cedab6e1be 100644 --- a/components/prism-css.js +++ b/components/prism-css.js @@ -1,7 +1,7 @@ Prism.languages.css = { 'comment': /\/\*[\w\W]*?\*\//g, 'atrule': { - pattern: /@[\w-]+?.*?(;|(?=\s*{))/gi, + pattern: /@[\w-]+?.*?(;|(?=\s*\{))/gi, inside: { 'punctuation': /[;:]/g } diff --git a/components/prism-gherkin.js b/components/prism-gherkin.js index b29626131d..03bf9a9b9e 100644 --- a/components/prism-gherkin.js +++ b/components/prism-gherkin.js @@ -9,5 +9,5 @@ Prism.languages.gherkin = { }, 'string': /("|')(\\?.)*?\1/g, 'atrule': /\b(And|Given|When|Then|In order to|As an|I want to|As a)\b/g, - 'keyword': /\b(Scenario Outline|Scenario|Feature|Background|Story)\b/g, + 'keyword': /\b(Scenario Outline|Scenario|Feature|Background|Story)\b/g }; diff --git a/components/prism-ini.js b/components/prism-ini.js index 0d448611ef..247e01291f 100644 --- a/components/prism-ini.js +++ b/components/prism-ini.js @@ -1,11 +1,11 @@ Prism.languages.ini= { 'comment': /^\s*;.*$/gm, 'important': /\[.*?\]/gm, - 'constant': /^\s*[^\s\=]+?(?=[ \t]*\=)/gm, + 'constant': /^\s*[^\s=]+?(?=[ \t]*=)/gm, 'attr-value': { - pattern: /\=.*/gm, + pattern: /=.*/gm, inside: { - 'punctuation': /^[\=]/g + 'punctuation': /^[=]/g } } }; \ No newline at end of file diff --git a/components/prism-latex.js b/components/prism-latex.js index c8902f6c5a..dadd4ce2f6 100644 --- a/components/prism-latex.js +++ b/components/prism-latex.js @@ -3,4 +3,4 @@ Prism.languages.latex = { 'string': /(\$)(\\?.)*?\1/g, 'punctuation': /[{}]/g, 'selector': /\\[a-z;,:\.]*/i -} \ No newline at end of file +}; \ No newline at end of file diff --git a/components/prism-markup.js b/components/prism-markup.js index e6c49953ac..b06a94bc48 100644 --- a/components/prism-markup.js +++ b/components/prism-markup.js @@ -29,7 +29,7 @@ Prism.languages.markup = { } }, - 'entity': /\&#?[\da-z]{1,8};/gi + 'entity': /&#?[\da-z]{1,8};/gi }; // Plugin to make entity title show the real entity, idea by Roman Komarov diff --git a/components/prism-nsis.js b/components/prism-nsis.js index f5596901e0..a65ccd0280 100644 --- a/components/prism-nsis.js +++ b/components/prism-nsis.js @@ -13,7 +13,7 @@ 'property': /\b(admin|all|auto|both|colored|false|force|hide|highest|lastused|leave|listonly|none|normal|notset|off|on|open|print|show|silent|silentlog|smooth|textonly|true|user|ARCHIVE|FILE_(ATTRIBUTE_ARCHIVE|ATTRIBUTE_NORMAL|ATTRIBUTE_OFFLINE|ATTRIBUTE_READONLY|ATTRIBUTE_SYSTEM|ATTRIBUTE_TEMPORARY)|HK(CR|CU|DD|LM|PD|U)|HKEY_(CLASSES_ROOT|CURRENT_CONFIG|CURRENT_USER|DYN_DATA|LOCAL_MACHINE|PERFORMANCE_DATA|USERS)|ID(ABORT|CANCEL|IGNORE|NO|OK|RETRY|YES)|MB_(ABORTRETRYIGNORE|DEFBUTTON1|DEFBUTTON2|DEFBUTTON3|DEFBUTTON4|ICONEXCLAMATION|ICONINFORMATION|ICONQUESTION|ICONSTOP|OK|OKCANCEL|RETRYCANCEL|RIGHT|RTLREADING|SETFOREGROUND|TOPMOST|USERICON|YESNO)|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SYSTEM|TEMPORARY)\b/g, 'variable': /(\$(\(|\{)?[-_\w]+)(\)|\})?/i, 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g, - 'operator': /[-+]{1,2}|<=?|>=?|={1,3}|(&){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g, + 'operator': /[-+]{1,2}|<=?|>=?|={1,3}|(&){1,2}|\|?\||\?|\*|\/|~|\^|%/g, 'punctuation': /[{}[\];(),.:]/g, - 'important': /\!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|else|endif|error|execute|finalize|getdllversionsystem|ifdef|ifmacrodef|ifmacrondef|ifndef|if|include|insertmacro|macroend|macro|makensis|packhdr|searchparse|searchreplace|tempfile|undef|verbose|warning)\b/gi, + 'important': /!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|else|endif|error|execute|finalize|getdllversionsystem|ifdef|ifmacrodef|ifmacrondef|ifndef|if|include|insertmacro|macroend|macro|makensis|packhdr|searchparse|searchreplace|tempfile|undef|verbose|warning)\b/gi }; diff --git a/components/prism-rip.js b/components/prism-rip.js index 0ed8831f95..2b044426d0 100644 --- a/components/prism-rip.js +++ b/components/prism-rip.js @@ -13,17 +13,17 @@ Prism.languages.rip = { 'number': /[+-]?(?:(?:\d+\.\d+)|(?:\d+))/g, - 'character': /\B`[^\s\`\'",.:;#\/\\()<>\[\]{}]\b/g, + 'character': /\B`[^\s`'",.:;#\/\\()<>\[\]{}]\b/g, 'regex': { pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/(?=\s*($|[\r\n,.;})]))/g, lookbehind: true }, - 'symbol': /:[^\d\s\`\'",.:;#\/\\()<>\[\]{}][^\s\`\'",.:;#\/\\()<>\[\]{}]*/g, + 'symbol': /:[^\d\s`'",.:;#\/\\()<>\[\]{}][^\s`'",.:;#\/\\()<>\[\]{}]*/g, 'string': /("|')(\\?.)*?\1/g, - 'punctuation': /(?:\.{2,3})|[\`,.:;=\/\\()<>\[\]{}]/, + 'punctuation': /(?:\.{2,3})|[`,.:;=\/\\()<>\[\]{}]/, - 'reference': /[^\d\s\`\'",.:;#\/\\()<>\[\]{}][^\s\`\'",.:;#\/\\()<>\[\]{}]*/g + 'reference': /[^\d\s`'",.:;#\/\\()<>\[\]{}][^\s`'",.:;#\/\\()<>\[\]{}]*/g }; diff --git a/components/prism-scheme.js b/components/prism-scheme.js index 59b6977ee0..ba965e9c11 100644 --- a/components/prism-scheme.js +++ b/components/prism-scheme.js @@ -11,7 +11,7 @@ Prism.languages.scheme = { }, 'string' : /(["])(?:(?=(\\?))\2.)*?\1|'[^('|\s)]+/, //thanks http://stackoverflow.com/questions/171480/regex-grabbing-values-between-quotation-marks 'number' : /(\s|\))[-+]?[0-9]*\.?[0-9]+((\s*)[-+]{1}(\s*)[0-9]*\.?[0-9]+i)?/, - 'operator': /(\*|\+|\-|\%|\/|<=|=>|>=|<|=|>)/, + 'operator': /(\*|\+|\-|%|\/|<=|=>|>=|<|=|>)/, 'function' : { pattern : /([(])[^(\s|\))]*\s/, lookbehind : true diff --git a/components/prism-scss.js b/components/prism-scss.js index 063b65f87a..4e8caa5c61 100644 --- a/components/prism-scss.js +++ b/components/prism-scss.js @@ -15,7 +15,7 @@ Prism.languages.scss = Prism.languages.extend('css', { // the end of a selector is found when there is no rules in it ( {} or {\s}) or if there is a property (because an interpolated var // can "pass" as a selector- e.g: proper#{$erty}) // this one was ard to do, so please be careful if you edit this one :) - 'selector': /([^@;\{\}\(\)]?([^@;\{\}\(\)]|&|\#\{\$[-_\w]+\})+)(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/gm + 'selector': /([^@;\{\}\(\)]?([^@;\{\}\(\)]|&|#\{\$[-_\w]+\})+)(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/gm }); Prism.languages.insertBefore('scss', 'atrule', { @@ -32,5 +32,5 @@ Prism.languages.insertBefore('scss', 'function', { 'statement': /\B!(default|optional)\b/gi, 'boolean': /\b(true|false)\b/g, 'null': /\b(null)\b/g, - 'operator': /\s+([-+]{1,2}|={1,2}|!=|\|?\||\?|\*|\/|\%)\s+/g + 'operator': /\s+([-+]{1,2}|={1,2}|!=|\|?\||\?|\*|\/|%)\s+/g }); diff --git a/components/prism-swift.js b/components/prism-swift.js index 374a9d90cc..becac585c0 100644 --- a/components/prism-swift.js +++ b/components/prism-swift.js @@ -3,6 +3,6 @@ Prism.languages.swift = Prism.languages.extend('clike', { 'keyword': /\b(as|associativity|break|case|class|continue|convenience|default|deinit|didSet|do|dynamicType|else|enum|extension|fallthrough|final|for|func|get|if|import|in|infix|init|inout|internal|is|lazy|left|let|mutating|new|none|nonmutating|operator|optional|override|postfix|precedence|prefix|private|protocol|public|required|return|right|safe|self|Self|set|static|struct|subscript|super|switch|Type|typealias|unowned|unowned|unsafe|var|weak|where|while|willSet|__COLUMN__|__FILE__|__FUNCTION__|__LINE__)\b/g, 'number': /\b([\d_]+(\.[\de_]+)?|0x[a-f0-9_]+(\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/gi, 'constant': /\b(nil|[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/g, - 'atrule': /\@\b(IBOutlet|IBDesignable|IBAction|IBInspectable|class_protocol|exported|noreturn|NSCopying|NSManaged|objc|UIApplicationMain|auto_closure)\b/g, + 'atrule': /@\b(IBOutlet|IBDesignable|IBAction|IBInspectable|class_protocol|exported|noreturn|NSCopying|NSManaged|objc|UIApplicationMain|auto_closure)\b/g, 'builtin': /\b([A-Z]\S+|abs|advance|alignof|alignofValue|assert|contains|count|countElements|debugPrint|debugPrintln|distance|dropFirst|dropLast|dump|enumerate|equal|filter|find|first|getVaList|indices|isEmpty|join|last|lazy|lexicographicalCompare|map|max|maxElement|min|minElement|numericCast|overlaps|partition|prefix|print|println|reduce|reflect|reverse|sizeof|sizeofValue|sort|sorted|split|startsWith|stride|strideof|strideofValue|suffix|swap|toDebugString|toString|transcode|underestimateCount|unsafeBitCast|withExtendedLifetime|withUnsafeMutablePointer|withUnsafeMutablePointers|withUnsafePointer|withUnsafePointers|withVaList)\b/g }); diff --git a/components/prism-twig.js b/components/prism-twig.js index fc77962fde..35d5969c9f 100644 --- a/components/prism-twig.js +++ b/components/prism-twig.js @@ -1,17 +1,17 @@ Prism.languages.twig = { - 'comment': /\{\#[\s\S]*?\#\}/g, + 'comment': /\{#[\s\S]*?#\}/g, 'tag': { - pattern: /(\{\{[\s\S]*?\}\}|\{\%[\s\S]*?\%\})/g, + pattern: /(\{\{[\s\S]*?\}\}|\{%[\s\S]*?%\})/g, inside: { 'ld': { - pattern: /^(\{\{\-?|\{\%\-?\s*\w+)/, + pattern: /^(\{\{\-?|\{%\-?\s*\w+)/, inside: { - 'punctuation': /^(\{\{|\{\%)\-?/, + 'punctuation': /^(\{\{|\{%)\-?/, 'keyword': /\w+/ } }, 'rd': { - pattern: /\-?(\%\}|\}\})$/, + pattern: /\-?(%\}|\}\})$/, inside: { 'punctuation': /.*/ } @@ -25,16 +25,16 @@ Prism.languages.twig = { 'keyword': /\b(if)\b/g, 'boolean': /\b(true|false|null)\b/g, 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g, - 'operator': /==|=|\!=|<|>|>=|<=|\+|\-|~|\*|\/|\/\/|%|\*\*|\|/g, + 'operator': /==|=|!=|<|>|>=|<=|\+|\-|~|\*|\/|\/\/|%|\*\*|\|/g, 'space-operator': { - pattern: /(\s)(\b(not|b\-and|b\-xor|b\-or|and|or|in|matches|starts with|ends with|is)\b|\?|:|\?\:)(?=\s)/g, + pattern: /(\s)(\b(not|b\-and|b\-xor|b\-or|and|or|in|matches|starts with|ends with|is)\b|\?|:|\?:)(?=\s)/g, lookbehind: true, inside: { 'operator': /.*/ } }, 'property': /\b[a-zA-Z_][a-zA-Z0-9_]*\b/g, - 'punctuation': /\(|\)|\[\]|\[|\]|\{|\}|\:|\.|,/g + 'punctuation': /\(|\)|\[\]|\[|\]|\{|\}|:|\.|,/g } }, From c8e3c2d71c70ba987ab4b86622637707c253069a Mon Sep 17 00:00:00 2001 From: Golmote Date: Fri, 9 Jan 2015 08:11:48 +0100 Subject: [PATCH 132/137] Run gulp --- components/prism-apacheconf.min.js | 2 +- components/prism-autohotkey.min.js | 2 +- components/prism-clike.min.js | 2 +- components/prism-css.min.js | 2 +- components/prism-ini.min.js | 2 +- components/prism-markup.min.js | 2 +- components/prism-nsis.min.js | 2 +- components/prism-rip.min.js | 2 +- components/prism-scala.min.js | 2 +- components/prism-scheme.min.js | 2 +- components/prism-scss.min.js | 2 +- components/prism-swift.min.js | 2 +- components/prism-twig.min.js | 2 +- prism.js | 8 ++++---- 14 files changed, 17 insertions(+), 17 deletions(-) diff --git a/components/prism-apacheconf.min.js b/components/prism-apacheconf.min.js index 9274c9a702..fc5b3b1442 100644 --- a/components/prism-apacheconf.min.js +++ b/components/prism-apacheconf.min.js @@ -1 +1 @@ -Prism.languages.apacheconf={comment:/\#.*/g,"directive-inline":{pattern:/^\s*\b(AcceptFilter|AcceptPathInfo|AccessFileName|Action|AddAlt|AddAltByEncoding|AddAltByType|AddCharset|AddDefaultCharset|AddDescription|AddEncoding|AddHandler|AddIcon|AddIconByEncoding|AddIconByType|AddInputFilter|AddLanguage|AddModuleInfo|AddOutputFilter|AddOutputFilterByType|AddType|Alias|AliasMatch|Allow|AllowCONNECT|AllowEncodedSlashes|AllowMethods|AllowOverride|AllowOverrideList|Anonymous|Anonymous_LogEmail|Anonymous_MustGiveEmail|Anonymous_NoUserID|Anonymous_VerifyEmail|AsyncRequestWorkerFactor|AuthBasicAuthoritative|AuthBasicFake|AuthBasicProvider|AuthBasicUseDigestAlgorithm|AuthDBDUserPWQuery|AuthDBDUserRealmQuery|AuthDBMGroupFile|AuthDBMType|AuthDBMUserFile|AuthDigestAlgorithm|AuthDigestDomain|AuthDigestNonceLifetime|AuthDigestProvider|AuthDigestQop|AuthDigestShmemSize|AuthFormAuthoritative|AuthFormBody|AuthFormDisableNoStore|AuthFormFakeBasicAuth|AuthFormLocation|AuthFormLoginRequiredLocation|AuthFormLoginSuccessLocation|AuthFormLogoutLocation|AuthFormMethod|AuthFormMimetype|AuthFormPassword|AuthFormProvider|AuthFormSitePassphrase|AuthFormSize|AuthFormUsername|AuthGroupFile|AuthLDAPAuthorizePrefix|AuthLDAPBindAuthoritative|AuthLDAPBindDN|AuthLDAPBindPassword|AuthLDAPCharsetConfig|AuthLDAPCompareAsUser|AuthLDAPCompareDNOnServer|AuthLDAPDereferenceAliases|AuthLDAPGroupAttribute|AuthLDAPGroupAttributeIsDN|AuthLDAPInitialBindAsUser|AuthLDAPInitialBindPattern|AuthLDAPMaxSubGroupDepth|AuthLDAPRemoteUserAttribute|AuthLDAPRemoteUserIsDN|AuthLDAPSearchAsUser|AuthLDAPSubGroupAttribute|AuthLDAPSubGroupClass|AuthLDAPUrl|AuthMerging|AuthName|AuthnCacheContext|AuthnCacheEnable|AuthnCacheProvideFor|AuthnCacheSOCache|AuthnCacheTimeout|AuthnzFcgiCheckAuthnProvider|AuthnzFcgiDefineProvider|AuthType|AuthUserFile|AuthzDBDLoginToReferer|AuthzDBDQuery|AuthzDBDRedirectQuery|AuthzDBMType|AuthzSendForbiddenOnFailure|BalancerGrowth|BalancerInherit|BalancerMember|BalancerPersist|BrowserMatch|BrowserMatchNoCase|BufferedLogs|BufferSize|CacheDefaultExpire|CacheDetailHeader|CacheDirLength|CacheDirLevels|CacheDisable|CacheEnable|CacheFile|CacheHeader|CacheIgnoreCacheControl|CacheIgnoreHeaders|CacheIgnoreNoLastMod|CacheIgnoreQueryString|CacheIgnoreURLSessionIdentifiers|CacheKeyBaseURL|CacheLastModifiedFactor|CacheLock|CacheLockMaxAge|CacheLockPath|CacheMaxExpire|CacheMaxFileSize|CacheMinExpire|CacheMinFileSize|CacheNegotiatedDocs|CacheQuickHandler|CacheReadSize|CacheReadTime|CacheRoot|CacheSocache|CacheSocacheMaxSize|CacheSocacheMaxTime|CacheSocacheMinTime|CacheSocacheReadSize|CacheSocacheReadTime|CacheStaleOnError|CacheStoreExpired|CacheStoreNoStore|CacheStorePrivate|CGIDScriptTimeout|CGIMapExtension|CharsetDefault|CharsetOptions|CharsetSourceEnc|CheckCaseOnly|CheckSpelling|ChrootDir|ContentDigest|CookieDomain|CookieExpires|CookieName|CookieStyle|CookieTracking|CoreDumpDirectory|CustomLog|Dav|DavDepthInfinity|DavGenericLockDB|DavLockDB|DavMinTimeout|DBDExptime|DBDInitSQL|DBDKeep|DBDMax|DBDMin|DBDParams|DBDPersist|DBDPrepareSQL|DBDriver|DefaultIcon|DefaultLanguage|DefaultRuntimeDir|DefaultType|Define|DeflateBufferSize|DeflateCompressionLevel|DeflateFilterNote|DeflateInflateLimitRequestBody|DeflateInflateRatioBurst|DeflateInflateRatioLimit|DeflateMemLevel|DeflateWindowSize|Deny|DirectoryCheckHandler|DirectoryIndex|DirectoryIndexRedirect|DirectorySlash|DocumentRoot|DTracePrivileges|DumpIOInput|DumpIOOutput|EnableExceptionHook|EnableMMAP|EnableSendfile|Error|ErrorDocument|ErrorLog|ErrorLogFormat|Example|ExpiresActive|ExpiresByType|ExpiresDefault|ExtendedStatus|ExtFilterDefine|ExtFilterOptions|FallbackResource|FileETag|FilterChain|FilterDeclare|FilterProtocol|FilterProvider|FilterTrace|ForceLanguagePriority|ForceType|ForensicLog|GprofDir|GracefulShutdownTimeout|Group|Header|HeaderName|HeartbeatAddress|HeartbeatListen|HeartbeatMaxServers|HeartbeatStorage|HeartbeatStorage|HostnameLookups|IdentityCheck|IdentityCheckTimeout|ImapBase|ImapDefault|ImapMenu|Include|IncludeOptional|IndexHeadInsert|IndexIgnore|IndexIgnoreReset|IndexOptions|IndexOrderDefault|IndexStyleSheet|InputSed|ISAPIAppendLogToErrors|ISAPIAppendLogToQuery|ISAPICacheFile|ISAPIFakeAsync|ISAPILogNotSupported|ISAPIReadAheadBuffer|KeepAlive|KeepAliveTimeout|KeptBodySize|LanguagePriority|LDAPCacheEntries|LDAPCacheTTL|LDAPConnectionPoolTTL|LDAPConnectionTimeout|LDAPLibraryDebug|LDAPOpCacheEntries|LDAPOpCacheTTL|LDAPReferralHopLimit|LDAPReferrals|LDAPRetries|LDAPRetryDelay|LDAPSharedCacheFile|LDAPSharedCacheSize|LDAPTimeout|LDAPTrustedClientCert|LDAPTrustedGlobalCert|LDAPTrustedMode|LDAPVerifyServerCert|LimitInternalRecursion|LimitRequestBody|LimitRequestFields|LimitRequestFieldSize|LimitRequestLine|LimitXMLRequestBody|Listen|ListenBackLog|LoadFile|LoadModule|LogFormat|LogLevel|LogMessage|LuaAuthzProvider|LuaCodeCache|LuaHookAccessChecker|LuaHookAuthChecker|LuaHookCheckUserID|LuaHookFixups|LuaHookInsertFilter|LuaHookLog|LuaHookMapToStorage|LuaHookTranslateName|LuaHookTypeChecker|LuaInherit|LuaInputFilter|LuaMapHandler|LuaOutputFilter|LuaPackageCPath|LuaPackagePath|LuaQuickHandler|LuaRoot|LuaScope|MaxConnectionsPerChild|MaxKeepAliveRequests|MaxMemFree|MaxRangeOverlaps|MaxRangeReversals|MaxRanges|MaxRequestWorkers|MaxSpareServers|MaxSpareThreads|MaxThreads|MergeTrailers|MetaDir|MetaFiles|MetaSuffix|MimeMagicFile|MinSpareServers|MinSpareThreads|MMapFile|ModemStandard|ModMimeUsePathInfo|MultiviewsMatch|Mutex|NameVirtualHost|NoProxy|NWSSLTrustedCerts|NWSSLUpgradeable|Options|Order|OutputSed|PassEnv|PidFile|PrivilegesMode|Protocol|ProtocolEcho|ProxyAddHeaders|ProxyBadHeader|ProxyBlock|ProxyDomain|ProxyErrorOverride|ProxyExpressDBMFile|ProxyExpressDBMType|ProxyExpressEnable|ProxyFtpDirCharset|ProxyFtpEscapeWildcards|ProxyFtpListOnWildcard|ProxyHTMLBufSize|ProxyHTMLCharsetOut|ProxyHTMLDocType|ProxyHTMLEnable|ProxyHTMLEvents|ProxyHTMLExtended|ProxyHTMLFixups|ProxyHTMLInterp|ProxyHTMLLinks|ProxyHTMLMeta|ProxyHTMLStripComments|ProxyHTMLURLMap|ProxyIOBufferSize|ProxyMaxForwards|ProxyPass|ProxyPassInherit|ProxyPassInterpolateEnv|ProxyPassMatch|ProxyPassReverse|ProxyPassReverseCookieDomain|ProxyPassReverseCookiePath|ProxyPreserveHost|ProxyReceiveBufferSize|ProxyRemote|ProxyRemoteMatch|ProxyRequests|ProxySCGIInternalRedirect|ProxySCGISendfile|ProxySet|ProxySourceAddress|ProxyStatus|ProxyTimeout|ProxyVia|ReadmeName|ReceiveBufferSize|Redirect|RedirectMatch|RedirectPermanent|RedirectTemp|ReflectorHeader|RemoteIPHeader|RemoteIPInternalProxy|RemoteIPInternalProxyList|RemoteIPProxiesHeader|RemoteIPTrustedProxy|RemoteIPTrustedProxyList|RemoveCharset|RemoveEncoding|RemoveHandler|RemoveInputFilter|RemoveLanguage|RemoveOutputFilter|RemoveType|RequestHeader|RequestReadTimeout|Require|RewriteBase|RewriteCond|RewriteEngine|RewriteMap|RewriteOptions|RewriteRule|RLimitCPU|RLimitMEM|RLimitNPROC|Satisfy|ScoreBoardFile|Script|ScriptAlias|ScriptAliasMatch|ScriptInterpreterSource|ScriptLog|ScriptLogBuffer|ScriptLogLength|ScriptSock|SecureListen|SeeRequestTail|SendBufferSize|ServerAdmin|ServerAlias|ServerLimit|ServerName|ServerPath|ServerRoot|ServerSignature|ServerTokens|Session|SessionCookieName|SessionCookieName2|SessionCookieRemove|SessionCryptoCipher|SessionCryptoDriver|SessionCryptoPassphrase|SessionCryptoPassphraseFile|SessionDBDCookieName|SessionDBDCookieName2|SessionDBDCookieRemove|SessionDBDDeleteLabel|SessionDBDInsertLabel|SessionDBDPerUser|SessionDBDSelectLabel|SessionDBDUpdateLabel|SessionEnv|SessionExclude|SessionHeader|SessionInclude|SessionMaxAge|SetEnv|SetEnvIf|SetEnvIfExpr|SetEnvIfNoCase|SetHandler|SetInputFilter|SetOutputFilter|SSIEndTag|SSIErrorMsg|SSIETag|SSILastModified|SSILegacyExprParser|SSIStartTag|SSITimeFormat|SSIUndefinedEcho|SSLCACertificateFile|SSLCACertificatePath|SSLCADNRequestFile|SSLCADNRequestPath|SSLCARevocationCheck|SSLCARevocationFile|SSLCARevocationPath|SSLCertificateChainFile|SSLCertificateFile|SSLCertificateKeyFile|SSLCipherSuite|SSLCompression|SSLCryptoDevice|SSLEngine|SSLFIPS|SSLHonorCipherOrder|SSLInsecureRenegotiation|SSLOCSPDefaultResponder|SSLOCSPEnable|SSLOCSPOverrideResponder|SSLOCSPResponderTimeout|SSLOCSPResponseMaxAge|SSLOCSPResponseTimeSkew|SSLOCSPUseRequestNonce|SSLOpenSSLConfCmd|SSLOptions|SSLPassPhraseDialog|SSLProtocol|SSLProxyCACertificateFile|SSLProxyCACertificatePath|SSLProxyCARevocationCheck|SSLProxyCARevocationFile|SSLProxyCARevocationPath|SSLProxyCheckPeerCN|SSLProxyCheckPeerExpire|SSLProxyCheckPeerName|SSLProxyCipherSuite|SSLProxyEngine|SSLProxyMachineCertificateChainFile|SSLProxyMachineCertificateFile|SSLProxyMachineCertificatePath|SSLProxyProtocol|SSLProxyVerify|SSLProxyVerifyDepth|SSLRandomSeed|SSLRenegBufferSize|SSLRequire|SSLRequireSSL|SSLSessionCache|SSLSessionCacheTimeout|SSLSessionTicketKeyFile|SSLSRPUnknownUserSeed|SSLSRPVerifierFile|SSLStaplingCache|SSLStaplingErrorCacheTimeout|SSLStaplingFakeTryLater|SSLStaplingForceURL|SSLStaplingResponderTimeout|SSLStaplingResponseMaxAge|SSLStaplingResponseTimeSkew|SSLStaplingReturnResponderErrors|SSLStaplingStandardCacheTimeout|SSLStrictSNIVHostCheck|SSLUserName|SSLUseStapling|SSLVerifyClient|SSLVerifyDepth|StartServers|StartThreads|Substitute|Suexec|SuexecUserGroup|ThreadLimit|ThreadsPerChild|ThreadStackSize|TimeOut|TraceEnable|TransferLog|TypesConfig|UnDefine|UndefMacro|UnsetEnv|Use|UseCanonicalName|UseCanonicalPhysicalPort|User|UserDir|VHostCGIMode|VHostCGIPrivs|VHostGroup|VHostPrivs|VHostSecure|VHostUser|VirtualDocumentRoot|VirtualDocumentRootIP|VirtualScriptAlias|VirtualScriptAliasIP|WatchdogInterval|XBitHack|xml2EncAlias|xml2EncDefault|xml2StartParse)\b/gim,alias:"property"},"directive-block":{pattern:/<\/?\b(AuthnProviderAlias|AuthzProviderAlias|Directory|DirectoryMatch|Else|ElseIf|Files|FilesMatch|If|IfDefine|IfModule|IfVersion|Limit|LimitExcept|Location|LocationMatch|Macro|Proxy|RequireAll|RequireAny|RequireNone|VirtualHost)\b *.*>/gi,inside:{"directive-block":{pattern:/^<\/?\w+/,inside:{punctuation:/^<\/?/},alias:"tag"},"directive-block-parameter":{pattern:/.*[^>]/,inside:{punctuation:/:/,string:{pattern:/("|').*\1/g,inside:{variable:/(\$|%)\{?(\w\.?(\+|\-|:)?)+\}?/g}}},alias:"attr-value"},punctuation:/>/},alias:"tag"},"directive-flags":{pattern:/\[(\w,?)+\]/g,alias:"keyword"},string:{pattern:/("|').*\1/g,inside:{variable:/(\$|%)\{?(\w\.?(\+|\-|:)?)+\}?/g}},variable:/(\$|%)\{?(\w\.?(\+|\-|:)?)+\}?/g,regex:/\^?.*\$|\^.*\$?/g}; \ No newline at end of file +Prism.languages.apacheconf={comment:/#.*/g,"directive-inline":{pattern:/^\s*\b(AcceptFilter|AcceptPathInfo|AccessFileName|Action|AddAlt|AddAltByEncoding|AddAltByType|AddCharset|AddDefaultCharset|AddDescription|AddEncoding|AddHandler|AddIcon|AddIconByEncoding|AddIconByType|AddInputFilter|AddLanguage|AddModuleInfo|AddOutputFilter|AddOutputFilterByType|AddType|Alias|AliasMatch|Allow|AllowCONNECT|AllowEncodedSlashes|AllowMethods|AllowOverride|AllowOverrideList|Anonymous|Anonymous_LogEmail|Anonymous_MustGiveEmail|Anonymous_NoUserID|Anonymous_VerifyEmail|AsyncRequestWorkerFactor|AuthBasicAuthoritative|AuthBasicFake|AuthBasicProvider|AuthBasicUseDigestAlgorithm|AuthDBDUserPWQuery|AuthDBDUserRealmQuery|AuthDBMGroupFile|AuthDBMType|AuthDBMUserFile|AuthDigestAlgorithm|AuthDigestDomain|AuthDigestNonceLifetime|AuthDigestProvider|AuthDigestQop|AuthDigestShmemSize|AuthFormAuthoritative|AuthFormBody|AuthFormDisableNoStore|AuthFormFakeBasicAuth|AuthFormLocation|AuthFormLoginRequiredLocation|AuthFormLoginSuccessLocation|AuthFormLogoutLocation|AuthFormMethod|AuthFormMimetype|AuthFormPassword|AuthFormProvider|AuthFormSitePassphrase|AuthFormSize|AuthFormUsername|AuthGroupFile|AuthLDAPAuthorizePrefix|AuthLDAPBindAuthoritative|AuthLDAPBindDN|AuthLDAPBindPassword|AuthLDAPCharsetConfig|AuthLDAPCompareAsUser|AuthLDAPCompareDNOnServer|AuthLDAPDereferenceAliases|AuthLDAPGroupAttribute|AuthLDAPGroupAttributeIsDN|AuthLDAPInitialBindAsUser|AuthLDAPInitialBindPattern|AuthLDAPMaxSubGroupDepth|AuthLDAPRemoteUserAttribute|AuthLDAPRemoteUserIsDN|AuthLDAPSearchAsUser|AuthLDAPSubGroupAttribute|AuthLDAPSubGroupClass|AuthLDAPUrl|AuthMerging|AuthName|AuthnCacheContext|AuthnCacheEnable|AuthnCacheProvideFor|AuthnCacheSOCache|AuthnCacheTimeout|AuthnzFcgiCheckAuthnProvider|AuthnzFcgiDefineProvider|AuthType|AuthUserFile|AuthzDBDLoginToReferer|AuthzDBDQuery|AuthzDBDRedirectQuery|AuthzDBMType|AuthzSendForbiddenOnFailure|BalancerGrowth|BalancerInherit|BalancerMember|BalancerPersist|BrowserMatch|BrowserMatchNoCase|BufferedLogs|BufferSize|CacheDefaultExpire|CacheDetailHeader|CacheDirLength|CacheDirLevels|CacheDisable|CacheEnable|CacheFile|CacheHeader|CacheIgnoreCacheControl|CacheIgnoreHeaders|CacheIgnoreNoLastMod|CacheIgnoreQueryString|CacheIgnoreURLSessionIdentifiers|CacheKeyBaseURL|CacheLastModifiedFactor|CacheLock|CacheLockMaxAge|CacheLockPath|CacheMaxExpire|CacheMaxFileSize|CacheMinExpire|CacheMinFileSize|CacheNegotiatedDocs|CacheQuickHandler|CacheReadSize|CacheReadTime|CacheRoot|CacheSocache|CacheSocacheMaxSize|CacheSocacheMaxTime|CacheSocacheMinTime|CacheSocacheReadSize|CacheSocacheReadTime|CacheStaleOnError|CacheStoreExpired|CacheStoreNoStore|CacheStorePrivate|CGIDScriptTimeout|CGIMapExtension|CharsetDefault|CharsetOptions|CharsetSourceEnc|CheckCaseOnly|CheckSpelling|ChrootDir|ContentDigest|CookieDomain|CookieExpires|CookieName|CookieStyle|CookieTracking|CoreDumpDirectory|CustomLog|Dav|DavDepthInfinity|DavGenericLockDB|DavLockDB|DavMinTimeout|DBDExptime|DBDInitSQL|DBDKeep|DBDMax|DBDMin|DBDParams|DBDPersist|DBDPrepareSQL|DBDriver|DefaultIcon|DefaultLanguage|DefaultRuntimeDir|DefaultType|Define|DeflateBufferSize|DeflateCompressionLevel|DeflateFilterNote|DeflateInflateLimitRequestBody|DeflateInflateRatioBurst|DeflateInflateRatioLimit|DeflateMemLevel|DeflateWindowSize|Deny|DirectoryCheckHandler|DirectoryIndex|DirectoryIndexRedirect|DirectorySlash|DocumentRoot|DTracePrivileges|DumpIOInput|DumpIOOutput|EnableExceptionHook|EnableMMAP|EnableSendfile|Error|ErrorDocument|ErrorLog|ErrorLogFormat|Example|ExpiresActive|ExpiresByType|ExpiresDefault|ExtendedStatus|ExtFilterDefine|ExtFilterOptions|FallbackResource|FileETag|FilterChain|FilterDeclare|FilterProtocol|FilterProvider|FilterTrace|ForceLanguagePriority|ForceType|ForensicLog|GprofDir|GracefulShutdownTimeout|Group|Header|HeaderName|HeartbeatAddress|HeartbeatListen|HeartbeatMaxServers|HeartbeatStorage|HeartbeatStorage|HostnameLookups|IdentityCheck|IdentityCheckTimeout|ImapBase|ImapDefault|ImapMenu|Include|IncludeOptional|IndexHeadInsert|IndexIgnore|IndexIgnoreReset|IndexOptions|IndexOrderDefault|IndexStyleSheet|InputSed|ISAPIAppendLogToErrors|ISAPIAppendLogToQuery|ISAPICacheFile|ISAPIFakeAsync|ISAPILogNotSupported|ISAPIReadAheadBuffer|KeepAlive|KeepAliveTimeout|KeptBodySize|LanguagePriority|LDAPCacheEntries|LDAPCacheTTL|LDAPConnectionPoolTTL|LDAPConnectionTimeout|LDAPLibraryDebug|LDAPOpCacheEntries|LDAPOpCacheTTL|LDAPReferralHopLimit|LDAPReferrals|LDAPRetries|LDAPRetryDelay|LDAPSharedCacheFile|LDAPSharedCacheSize|LDAPTimeout|LDAPTrustedClientCert|LDAPTrustedGlobalCert|LDAPTrustedMode|LDAPVerifyServerCert|LimitInternalRecursion|LimitRequestBody|LimitRequestFields|LimitRequestFieldSize|LimitRequestLine|LimitXMLRequestBody|Listen|ListenBackLog|LoadFile|LoadModule|LogFormat|LogLevel|LogMessage|LuaAuthzProvider|LuaCodeCache|LuaHookAccessChecker|LuaHookAuthChecker|LuaHookCheckUserID|LuaHookFixups|LuaHookInsertFilter|LuaHookLog|LuaHookMapToStorage|LuaHookTranslateName|LuaHookTypeChecker|LuaInherit|LuaInputFilter|LuaMapHandler|LuaOutputFilter|LuaPackageCPath|LuaPackagePath|LuaQuickHandler|LuaRoot|LuaScope|MaxConnectionsPerChild|MaxKeepAliveRequests|MaxMemFree|MaxRangeOverlaps|MaxRangeReversals|MaxRanges|MaxRequestWorkers|MaxSpareServers|MaxSpareThreads|MaxThreads|MergeTrailers|MetaDir|MetaFiles|MetaSuffix|MimeMagicFile|MinSpareServers|MinSpareThreads|MMapFile|ModemStandard|ModMimeUsePathInfo|MultiviewsMatch|Mutex|NameVirtualHost|NoProxy|NWSSLTrustedCerts|NWSSLUpgradeable|Options|Order|OutputSed|PassEnv|PidFile|PrivilegesMode|Protocol|ProtocolEcho|ProxyAddHeaders|ProxyBadHeader|ProxyBlock|ProxyDomain|ProxyErrorOverride|ProxyExpressDBMFile|ProxyExpressDBMType|ProxyExpressEnable|ProxyFtpDirCharset|ProxyFtpEscapeWildcards|ProxyFtpListOnWildcard|ProxyHTMLBufSize|ProxyHTMLCharsetOut|ProxyHTMLDocType|ProxyHTMLEnable|ProxyHTMLEvents|ProxyHTMLExtended|ProxyHTMLFixups|ProxyHTMLInterp|ProxyHTMLLinks|ProxyHTMLMeta|ProxyHTMLStripComments|ProxyHTMLURLMap|ProxyIOBufferSize|ProxyMaxForwards|ProxyPass|ProxyPassInherit|ProxyPassInterpolateEnv|ProxyPassMatch|ProxyPassReverse|ProxyPassReverseCookieDomain|ProxyPassReverseCookiePath|ProxyPreserveHost|ProxyReceiveBufferSize|ProxyRemote|ProxyRemoteMatch|ProxyRequests|ProxySCGIInternalRedirect|ProxySCGISendfile|ProxySet|ProxySourceAddress|ProxyStatus|ProxyTimeout|ProxyVia|ReadmeName|ReceiveBufferSize|Redirect|RedirectMatch|RedirectPermanent|RedirectTemp|ReflectorHeader|RemoteIPHeader|RemoteIPInternalProxy|RemoteIPInternalProxyList|RemoteIPProxiesHeader|RemoteIPTrustedProxy|RemoteIPTrustedProxyList|RemoveCharset|RemoveEncoding|RemoveHandler|RemoveInputFilter|RemoveLanguage|RemoveOutputFilter|RemoveType|RequestHeader|RequestReadTimeout|Require|RewriteBase|RewriteCond|RewriteEngine|RewriteMap|RewriteOptions|RewriteRule|RLimitCPU|RLimitMEM|RLimitNPROC|Satisfy|ScoreBoardFile|Script|ScriptAlias|ScriptAliasMatch|ScriptInterpreterSource|ScriptLog|ScriptLogBuffer|ScriptLogLength|ScriptSock|SecureListen|SeeRequestTail|SendBufferSize|ServerAdmin|ServerAlias|ServerLimit|ServerName|ServerPath|ServerRoot|ServerSignature|ServerTokens|Session|SessionCookieName|SessionCookieName2|SessionCookieRemove|SessionCryptoCipher|SessionCryptoDriver|SessionCryptoPassphrase|SessionCryptoPassphraseFile|SessionDBDCookieName|SessionDBDCookieName2|SessionDBDCookieRemove|SessionDBDDeleteLabel|SessionDBDInsertLabel|SessionDBDPerUser|SessionDBDSelectLabel|SessionDBDUpdateLabel|SessionEnv|SessionExclude|SessionHeader|SessionInclude|SessionMaxAge|SetEnv|SetEnvIf|SetEnvIfExpr|SetEnvIfNoCase|SetHandler|SetInputFilter|SetOutputFilter|SSIEndTag|SSIErrorMsg|SSIETag|SSILastModified|SSILegacyExprParser|SSIStartTag|SSITimeFormat|SSIUndefinedEcho|SSLCACertificateFile|SSLCACertificatePath|SSLCADNRequestFile|SSLCADNRequestPath|SSLCARevocationCheck|SSLCARevocationFile|SSLCARevocationPath|SSLCertificateChainFile|SSLCertificateFile|SSLCertificateKeyFile|SSLCipherSuite|SSLCompression|SSLCryptoDevice|SSLEngine|SSLFIPS|SSLHonorCipherOrder|SSLInsecureRenegotiation|SSLOCSPDefaultResponder|SSLOCSPEnable|SSLOCSPOverrideResponder|SSLOCSPResponderTimeout|SSLOCSPResponseMaxAge|SSLOCSPResponseTimeSkew|SSLOCSPUseRequestNonce|SSLOpenSSLConfCmd|SSLOptions|SSLPassPhraseDialog|SSLProtocol|SSLProxyCACertificateFile|SSLProxyCACertificatePath|SSLProxyCARevocationCheck|SSLProxyCARevocationFile|SSLProxyCARevocationPath|SSLProxyCheckPeerCN|SSLProxyCheckPeerExpire|SSLProxyCheckPeerName|SSLProxyCipherSuite|SSLProxyEngine|SSLProxyMachineCertificateChainFile|SSLProxyMachineCertificateFile|SSLProxyMachineCertificatePath|SSLProxyProtocol|SSLProxyVerify|SSLProxyVerifyDepth|SSLRandomSeed|SSLRenegBufferSize|SSLRequire|SSLRequireSSL|SSLSessionCache|SSLSessionCacheTimeout|SSLSessionTicketKeyFile|SSLSRPUnknownUserSeed|SSLSRPVerifierFile|SSLStaplingCache|SSLStaplingErrorCacheTimeout|SSLStaplingFakeTryLater|SSLStaplingForceURL|SSLStaplingResponderTimeout|SSLStaplingResponseMaxAge|SSLStaplingResponseTimeSkew|SSLStaplingReturnResponderErrors|SSLStaplingStandardCacheTimeout|SSLStrictSNIVHostCheck|SSLUserName|SSLUseStapling|SSLVerifyClient|SSLVerifyDepth|StartServers|StartThreads|Substitute|Suexec|SuexecUserGroup|ThreadLimit|ThreadsPerChild|ThreadStackSize|TimeOut|TraceEnable|TransferLog|TypesConfig|UnDefine|UndefMacro|UnsetEnv|Use|UseCanonicalName|UseCanonicalPhysicalPort|User|UserDir|VHostCGIMode|VHostCGIPrivs|VHostGroup|VHostPrivs|VHostSecure|VHostUser|VirtualDocumentRoot|VirtualDocumentRootIP|VirtualScriptAlias|VirtualScriptAliasIP|WatchdogInterval|XBitHack|xml2EncAlias|xml2EncDefault|xml2StartParse)\b/gim,alias:"property"},"directive-block":{pattern:/<\/?\b(AuthnProviderAlias|AuthzProviderAlias|Directory|DirectoryMatch|Else|ElseIf|Files|FilesMatch|If|IfDefine|IfModule|IfVersion|Limit|LimitExcept|Location|LocationMatch|Macro|Proxy|RequireAll|RequireAny|RequireNone|VirtualHost)\b *.*>/gi,inside:{"directive-block":{pattern:/^<\/?\w+/,inside:{punctuation:/^<\/?/},alias:"tag"},"directive-block-parameter":{pattern:/.*[^>]/,inside:{punctuation:/:/,string:{pattern:/("|').*\1/g,inside:{variable:/(\$|%)\{?(\w\.?(\+|\-|:)?)+\}?/g}}},alias:"attr-value"},punctuation:/>/},alias:"tag"},"directive-flags":{pattern:/\[(\w,?)+\]/g,alias:"keyword"},string:{pattern:/("|').*\1/g,inside:{variable:/(\$|%)\{?(\w\.?(\+|\-|:)?)+\}?/g}},variable:/(\$|%)\{?(\w\.?(\+|\-|:)?)+\}?/g,regex:/\^?.*\$|\^.*\$?/g}; \ No newline at end of file diff --git a/components/prism-autohotkey.min.js b/components/prism-autohotkey.min.js index d10a9526fd..bee7da9c66 100644 --- a/components/prism-autohotkey.min.js +++ b/components/prism-autohotkey.min.js @@ -1 +1 @@ -Prism.languages.autohotkey={comment:{pattern:/(^[^";\n]*("[^"\n]*?"[^"\n]*?)*)(;.*$|^\s*\/\*[\s\S]*\n\*\/)/gm,lookbehind:!0},string:/"(([^"\n\r]|"")*)"/gm,"function":/[^\(\); \t\,\n\+\*\-\=\?>:\\\/<\&%\[\]]+?(?=\()/gm,tag:/^[ \t]*[^\s:]+?(?=:[^:])/gm,variable:/\%\w+\%/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[\+\-\*\\\/:=\?\&\|<>]/g,punctuation:/[\{}[\]\(\):]/g,"boolean":/\b(true|false)\b/g,selector:/\b(AutoTrim|BlockInput|Break|Click|ClipWait|Continue|Control|ControlClick|ControlFocus|ControlGet|ControlGetFocus|ControlGetPos|ControlGetText|ControlMove|ControlSend|ControlSendRaw|ControlSetText|CoordMode|Critical|DetectHiddenText|DetectHiddenWindows|Drive|DriveGet|DriveSpaceFree|EnvAdd|EnvDiv|EnvGet|EnvMult|EnvSet|EnvSub|EnvUpdate|Exit|ExitApp|FileAppend|FileCopy|FileCopyDir|FileCreateDir|FileCreateShortcut|FileDelete|FileEncoding|FileGetAttrib|FileGetShortcut|FileGetSize|FileGetTime|FileGetVersion|FileInstall|FileMove|FileMoveDir|FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|FileRemoveDir|FileSelectFile|FileSelectFolder|FileSetAttrib|FileSetTime|FormatTime|GetKeyState|Gosub|Goto|GroupActivate|GroupAdd|GroupClose|GroupDeactivate|Gui|GuiControl|GuiControlGet|Hotkey|ImageSearch|IniDelete|IniRead|IniWrite|Input|InputBox|KeyWait|ListHotkeys|ListLines|ListVars|Loop|Menu|MouseClick|MouseClickDrag|MouseGetPos|MouseMove|MsgBox|OnExit|OutputDebug|Pause|PixelGetColor|PixelSearch|PostMessage|Process|Progress|Random|RegDelete|RegRead|RegWrite|Reload|Repeat|Return|Run|RunAs|RunWait|Send|SendEvent|SendInput|SendMessage|SendMode|SendPlay|SendRaw|SetBatchLines|SetCapslockState|SetControlDelay|SetDefaultMouseSpeed|SetEnv|SetFormat|SetKeyDelay|SetMouseDelay|SetNumlockState|SetScrollLockState|SetStoreCapslockMode|SetTimer|SetTitleMatchMode|SetWinDelay|SetWorkingDir|Shutdown|Sleep|Sort|SoundBeep|SoundGet|SoundGetWaveVolume|SoundPlay|SoundSet|SoundSetWaveVolume|SplashImage|SplashTextOff|SplashTextOn|SplitPath|StatusBarGetText|StatusBarWait|StringCaseSense|StringGetPos|StringLeft|StringLen|StringLower|StringMid|StringReplace|StringRight|StringSplit|StringTrimLeft|StringTrimRight|StringUpper|Suspend|SysGet|Thread|ToolTip|Transform|TrayTip|URLDownloadToFile|WinActivate|WinActivateBottom|WinClose|WinGet|WinGetActiveStats|WinGetActiveTitle|WinGetClass|WinGetPos|WinGetText|WinGetTitle|WinHide|WinKill|WinMaximize|WinMenuSelectItem|WinMinimize|WinMinimizeAll|WinMinimizeAllUndo|WinMove|WinRestore|WinSet|WinSetTitle|WinShow|WinWait|WinWaitActive|WinWaitClose|WinWaitNotActive)\b/i,constant:/\b(a_ahkpath|a_ahkversion|a_appdata|a_appdatacommon|a_autotrim|a_batchlines|a_caretx|a_carety|a_computername|a_controldelay|a_cursor|a_dd|a_ddd|a_dddd|a_defaultmousespeed|a_desktop|a_desktopcommon|a_detecthiddentext|a_detecthiddenwindows|a_endchar|a_eventinfo|a_exitreason|a_formatfloat|a_formatinteger|a_gui|a_guievent|a_guicontrol|a_guicontrolevent|a_guiheight|a_guiwidth|a_guix|a_guiy|a_hour|a_iconfile|a_iconhidden|a_iconnumber|a_icontip|a_index|a_ipaddress1|a_ipaddress2|a_ipaddress3|a_ipaddress4|a_isadmin|a_iscompiled|a_iscritical|a_ispaused|a_issuspended|a_isunicode|a_keydelay|a_language|a_lasterror|a_linefile|a_linenumber|a_loopfield|a_loopfileattrib|a_loopfiledir|a_loopfileext|a_loopfilefullpath|a_loopfilelongpath|a_loopfilename|a_loopfileshortname|a_loopfileshortpath|a_loopfilesize|a_loopfilesizekb|a_loopfilesizemb|a_loopfiletimeaccessed|a_loopfiletimecreated|a_loopfiletimemodified|a_loopreadline|a_loopregkey|a_loopregname|a_loopregsubkey|a_loopregtimemodified|a_loopregtype|a_mday|a_min|a_mm|a_mmm|a_mmmm|a_mon|a_mousedelay|a_msec|a_mydocuments|a_now|a_nowutc|a_numbatchlines|a_ostype|a_osversion|a_priorhotkey|programfiles|a_programfiles|a_programs|a_programscommon|a_screenheight|a_screenwidth|a_scriptdir|a_scriptfullpath|a_scriptname|a_sec|a_space|a_startmenu|a_startmenucommon|a_startup|a_startupcommon|a_stringcasesense|a_tab|a_temp|a_thisfunc|a_thishotkey|a_thislabel|a_thismenu|a_thismenuitem|a_thismenuitempos|a_tickcount|a_timeidle|a_timeidlephysical|a_timesincepriorhotkey|a_timesincethishotkey|a_titlematchmode|a_titlematchmodespeed|a_username|a_wday|a_windelay|a_windir|a_workingdir|a_yday|a_year|a_yweek|a_yyyy|clipboard|clipboardall|comspec|errorlevel)\b/i,builtin:/\b(abs|acos|asc|asin|atan|ceil|chr|class|cos|dllcall|exp|fileexist|Fileopen|floor|getkeystate|il_add|il_create|il_destroy|instr|substr|isfunc|islabel|IsObject|ln|log|lv_add|lv_delete|lv_deletecol|lv_getcount|lv_getnext|lv_gettext|lv_insert|lv_insertcol|lv_modify|lv_modifycol|lv_setimagelist|mod|onmessage|numget|numput|registercallback|regexmatch|regexreplace|round|sin|tan|sqrt|strlen|sb_seticon|sb_setparts|sb_settext|strsplit|tv_add|tv_delete|tv_getchild|tv_getcount|tv_getnext|tv_get|tv_getparent|tv_getprev|tv_getselection|tv_gettext|tv_modify|varsetcapacity|winactive|winexist|__New|__Call|__Get|__Set)\b/i,symbol:/\b(alt|altdown|altup|appskey|backspace|browser_back|browser_favorites|browser_forward|browser_home|browser_refresh|browser_search|browser_stop|bs|capslock|control|ctrl|ctrlbreak|ctrldown|ctrlup|del|delete|down|end|enter|esc|escape|f1|f10|f11|f12|f13|f14|f15|f16|f17|f18|f19|f2|f20|f21|f22|f23|f24|f3|f4|f5|f6|f7|f8|f9|home|ins|insert|joy1|joy10|joy11|joy12|joy13|joy14|joy15|joy16|joy17|joy18|joy19|joy2|joy20|joy21|joy22|joy23|joy24|joy25|joy26|joy27|joy28|joy29|joy3|joy30|joy31|joy32|joy4|joy5|joy6|joy7|joy8|joy9|joyaxes|joybuttons|joyinfo|joyname|joypov|joyr|joyu|joyv|joyx|joyy|joyz|lalt|launch_app1|launch_app2|launch_mail|launch_media|lbutton|lcontrol|lctrl|left|lshift|lwin|lwindown|lwinup|mbutton|media_next|media_play_pause|media_prev|media_stop|numlock|numpad0|numpad1|numpad2|numpad3|numpad4|numpad5|numpad6|numpad7|numpad8|numpad9|numpadadd|numpadclear|numpaddel|numpaddiv|numpaddot|numpaddown|numpadend|numpadenter|numpadhome|numpadins|numpadleft|numpadmult|numpadpgdn|numpadpgup|numpadright|numpadsub|numpadup|pause|pgdn|pgup|printscreen|ralt|rbutton|rcontrol|rctrl|right|rshift|rwin|rwindown|rwinup|scrolllock|shift|shiftdown|shiftup|space|tab|up|volume_down|volume_mute|volume_up|wheeldown|wheelleft|wheelright|wheelup|xbutton1|xbutton2)\b/i,important:/#\b(AllowSameLineComments|ClipboardTimeout|CommentFlag|ErrorStdOut|EscapeChar|HotkeyInterval|HotkeyModifierTimeout|Hotstring|IfWinActive|IfWinExist|IfWinNotActive|IfWinNotExist|Include|IncludeAgain|InstallKeybdHook|InstallMouseHook|KeyHistory|LTrim|MaxHotkeysPerInterval|MaxMem|MaxThreads|MaxThreadsBuffer|MaxThreadsPerHotkey|NoEnv|NoTrayIcon|Persistent|SingleInstance|UseHook|WinActivateForce)\b/i,keyword:/\b(Abort|AboveNormal|Add|ahk_class|ahk_group|ahk_id|ahk_pid|All|Alnum|Alpha|AltSubmit|AltTab|AltTabAndMenu|AltTabMenu|AltTabMenuDismiss|AlwaysOnTop|AutoSize|Background|BackgroundTrans|BelowNormal|between|BitAnd|BitNot|BitOr|BitShiftLeft|BitShiftRight|BitXOr|Bold|Border|Button|ByRef|Checkbox|Checked|CheckedGray|Choose|ChooseString|Click|Close|Color|ComboBox|Contains|ControlList|Count|Date|DateTime|Days|DDL|Default|Delete|DeleteAll|Delimiter|Deref|Destroy|Digit|Disable|Disabled|DropDownList|Edit|Eject|Else|Enable|Enabled|Error|Exist|Exp|Expand|ExStyle|FileSystem|First|Flash|Float|FloatFast|Focus|Font|for|global|Grid|Group|GroupBox|GuiClose|GuiContextMenu|GuiDropFiles|GuiEscape|GuiSize|Hdr|Hidden|Hide|High|HKCC|HKCR|HKCU|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_LOCAL_MACHINE|HKEY_USERS|HKLM|HKU|Hours|HScroll|Icon|IconSmall|ID|IDLast|If|IfEqual|IfExist|IfGreater|IfGreaterOrEqual|IfInString|IfLess|IfLessOrEqual|IfMsgBox|IfNotEqual|IfNotExist|IfNotInString|IfWinActive|IfWinExist|IfWinNotActive|IfWinNotExist|Ignore|ImageList|in|Integer|IntegerFast|Interrupt|is|italic|Join|Label|LastFound|LastFoundExist|Limit|Lines|List|ListBox|ListView|Ln|local|Lock|Logoff|Low|Lower|Lowercase|MainWindow|Margin|Maximize|MaximizeBox|MaxSize|Minimize|MinimizeBox|MinMax|MinSize|Minutes|MonthCal|Mouse|Move|Multi|NA|No|NoActivate|NoDefault|NoHide|NoIcon|NoMainWindow|norm|Normal|NoSort|NoSortHdr|NoStandard|Not|NoTab|NoTimers|Number|Off|Ok|On|OwnDialogs|Owner|Parse|Password|Picture|Pixel|Pos|Pow|Priority|ProcessName|Radio|Range|Read|ReadOnly|Realtime|Redraw|REG_BINARY|REG_DWORD|REG_EXPAND_SZ|REG_MULTI_SZ|REG_SZ|Region|Relative|Rename|Report|Resize|Restore|Retry|RGB|Right|Screen|Seconds|Section|Serial|SetLabel|ShiftAltTab|Show|Single|Slider|SortDesc|Standard|static|Status|StatusBar|StatusCD|strike|Style|Submit|SysMenu|Tab|Tab2|TabStop|Text|Theme|Tile|ToggleCheck|ToggleEnable|ToolWindow|Top|Topmost|TransColor|Transparent|Tray|TreeView|TryAgain|Type|UnCheck|underline|Unicode|Unlock|UpDown|Upper|Uppercase|UseErrorLevel|Vis|VisFirst|Visible|VScroll|Wait|WaitClose|WantCtrlA|WantF2|WantReturn|While|Wrap|Xdigit|xm|xp|xs|Yes|ym|yp|ys)\b/i}; \ No newline at end of file +Prism.languages.autohotkey={comment:{pattern:/(^[^";\n]*("[^"\n]*?"[^"\n]*?)*)(;.*$|^\s*\/\*[\s\S]*\n\*\/)/gm,lookbehind:!0},string:/"(([^"\n\r]|"")*)"/gm,"function":/[^\(\); \t,\n\+\*\-=\?>:\\\/<&%\[\]]+?(?=\()/gm,tag:/^[ \t]*[^\s:]+?(?=:[^:])/gm,variable:/%\w+%/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[\+\-\*\\\/:=\?&\|<>]/g,punctuation:/[\{}[\]\(\):]/g,"boolean":/\b(true|false)\b/g,selector:/\b(AutoTrim|BlockInput|Break|Click|ClipWait|Continue|Control|ControlClick|ControlFocus|ControlGet|ControlGetFocus|ControlGetPos|ControlGetText|ControlMove|ControlSend|ControlSendRaw|ControlSetText|CoordMode|Critical|DetectHiddenText|DetectHiddenWindows|Drive|DriveGet|DriveSpaceFree|EnvAdd|EnvDiv|EnvGet|EnvMult|EnvSet|EnvSub|EnvUpdate|Exit|ExitApp|FileAppend|FileCopy|FileCopyDir|FileCreateDir|FileCreateShortcut|FileDelete|FileEncoding|FileGetAttrib|FileGetShortcut|FileGetSize|FileGetTime|FileGetVersion|FileInstall|FileMove|FileMoveDir|FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|FileRemoveDir|FileSelectFile|FileSelectFolder|FileSetAttrib|FileSetTime|FormatTime|GetKeyState|Gosub|Goto|GroupActivate|GroupAdd|GroupClose|GroupDeactivate|Gui|GuiControl|GuiControlGet|Hotkey|ImageSearch|IniDelete|IniRead|IniWrite|Input|InputBox|KeyWait|ListHotkeys|ListLines|ListVars|Loop|Menu|MouseClick|MouseClickDrag|MouseGetPos|MouseMove|MsgBox|OnExit|OutputDebug|Pause|PixelGetColor|PixelSearch|PostMessage|Process|Progress|Random|RegDelete|RegRead|RegWrite|Reload|Repeat|Return|Run|RunAs|RunWait|Send|SendEvent|SendInput|SendMessage|SendMode|SendPlay|SendRaw|SetBatchLines|SetCapslockState|SetControlDelay|SetDefaultMouseSpeed|SetEnv|SetFormat|SetKeyDelay|SetMouseDelay|SetNumlockState|SetScrollLockState|SetStoreCapslockMode|SetTimer|SetTitleMatchMode|SetWinDelay|SetWorkingDir|Shutdown|Sleep|Sort|SoundBeep|SoundGet|SoundGetWaveVolume|SoundPlay|SoundSet|SoundSetWaveVolume|SplashImage|SplashTextOff|SplashTextOn|SplitPath|StatusBarGetText|StatusBarWait|StringCaseSense|StringGetPos|StringLeft|StringLen|StringLower|StringMid|StringReplace|StringRight|StringSplit|StringTrimLeft|StringTrimRight|StringUpper|Suspend|SysGet|Thread|ToolTip|Transform|TrayTip|URLDownloadToFile|WinActivate|WinActivateBottom|WinClose|WinGet|WinGetActiveStats|WinGetActiveTitle|WinGetClass|WinGetPos|WinGetText|WinGetTitle|WinHide|WinKill|WinMaximize|WinMenuSelectItem|WinMinimize|WinMinimizeAll|WinMinimizeAllUndo|WinMove|WinRestore|WinSet|WinSetTitle|WinShow|WinWait|WinWaitActive|WinWaitClose|WinWaitNotActive)\b/i,constant:/\b(a_ahkpath|a_ahkversion|a_appdata|a_appdatacommon|a_autotrim|a_batchlines|a_caretx|a_carety|a_computername|a_controldelay|a_cursor|a_dd|a_ddd|a_dddd|a_defaultmousespeed|a_desktop|a_desktopcommon|a_detecthiddentext|a_detecthiddenwindows|a_endchar|a_eventinfo|a_exitreason|a_formatfloat|a_formatinteger|a_gui|a_guievent|a_guicontrol|a_guicontrolevent|a_guiheight|a_guiwidth|a_guix|a_guiy|a_hour|a_iconfile|a_iconhidden|a_iconnumber|a_icontip|a_index|a_ipaddress1|a_ipaddress2|a_ipaddress3|a_ipaddress4|a_isadmin|a_iscompiled|a_iscritical|a_ispaused|a_issuspended|a_isunicode|a_keydelay|a_language|a_lasterror|a_linefile|a_linenumber|a_loopfield|a_loopfileattrib|a_loopfiledir|a_loopfileext|a_loopfilefullpath|a_loopfilelongpath|a_loopfilename|a_loopfileshortname|a_loopfileshortpath|a_loopfilesize|a_loopfilesizekb|a_loopfilesizemb|a_loopfiletimeaccessed|a_loopfiletimecreated|a_loopfiletimemodified|a_loopreadline|a_loopregkey|a_loopregname|a_loopregsubkey|a_loopregtimemodified|a_loopregtype|a_mday|a_min|a_mm|a_mmm|a_mmmm|a_mon|a_mousedelay|a_msec|a_mydocuments|a_now|a_nowutc|a_numbatchlines|a_ostype|a_osversion|a_priorhotkey|programfiles|a_programfiles|a_programs|a_programscommon|a_screenheight|a_screenwidth|a_scriptdir|a_scriptfullpath|a_scriptname|a_sec|a_space|a_startmenu|a_startmenucommon|a_startup|a_startupcommon|a_stringcasesense|a_tab|a_temp|a_thisfunc|a_thishotkey|a_thislabel|a_thismenu|a_thismenuitem|a_thismenuitempos|a_tickcount|a_timeidle|a_timeidlephysical|a_timesincepriorhotkey|a_timesincethishotkey|a_titlematchmode|a_titlematchmodespeed|a_username|a_wday|a_windelay|a_windir|a_workingdir|a_yday|a_year|a_yweek|a_yyyy|clipboard|clipboardall|comspec|errorlevel)\b/i,builtin:/\b(abs|acos|asc|asin|atan|ceil|chr|class|cos|dllcall|exp|fileexist|Fileopen|floor|getkeystate|il_add|il_create|il_destroy|instr|substr|isfunc|islabel|IsObject|ln|log|lv_add|lv_delete|lv_deletecol|lv_getcount|lv_getnext|lv_gettext|lv_insert|lv_insertcol|lv_modify|lv_modifycol|lv_setimagelist|mod|onmessage|numget|numput|registercallback|regexmatch|regexreplace|round|sin|tan|sqrt|strlen|sb_seticon|sb_setparts|sb_settext|strsplit|tv_add|tv_delete|tv_getchild|tv_getcount|tv_getnext|tv_get|tv_getparent|tv_getprev|tv_getselection|tv_gettext|tv_modify|varsetcapacity|winactive|winexist|__New|__Call|__Get|__Set)\b/i,symbol:/\b(alt|altdown|altup|appskey|backspace|browser_back|browser_favorites|browser_forward|browser_home|browser_refresh|browser_search|browser_stop|bs|capslock|control|ctrl|ctrlbreak|ctrldown|ctrlup|del|delete|down|end|enter|esc|escape|f1|f10|f11|f12|f13|f14|f15|f16|f17|f18|f19|f2|f20|f21|f22|f23|f24|f3|f4|f5|f6|f7|f8|f9|home|ins|insert|joy1|joy10|joy11|joy12|joy13|joy14|joy15|joy16|joy17|joy18|joy19|joy2|joy20|joy21|joy22|joy23|joy24|joy25|joy26|joy27|joy28|joy29|joy3|joy30|joy31|joy32|joy4|joy5|joy6|joy7|joy8|joy9|joyaxes|joybuttons|joyinfo|joyname|joypov|joyr|joyu|joyv|joyx|joyy|joyz|lalt|launch_app1|launch_app2|launch_mail|launch_media|lbutton|lcontrol|lctrl|left|lshift|lwin|lwindown|lwinup|mbutton|media_next|media_play_pause|media_prev|media_stop|numlock|numpad0|numpad1|numpad2|numpad3|numpad4|numpad5|numpad6|numpad7|numpad8|numpad9|numpadadd|numpadclear|numpaddel|numpaddiv|numpaddot|numpaddown|numpadend|numpadenter|numpadhome|numpadins|numpadleft|numpadmult|numpadpgdn|numpadpgup|numpadright|numpadsub|numpadup|pause|pgdn|pgup|printscreen|ralt|rbutton|rcontrol|rctrl|right|rshift|rwin|rwindown|rwinup|scrolllock|shift|shiftdown|shiftup|space|tab|up|volume_down|volume_mute|volume_up|wheeldown|wheelleft|wheelright|wheelup|xbutton1|xbutton2)\b/i,important:/#\b(AllowSameLineComments|ClipboardTimeout|CommentFlag|ErrorStdOut|EscapeChar|HotkeyInterval|HotkeyModifierTimeout|Hotstring|IfWinActive|IfWinExist|IfWinNotActive|IfWinNotExist|Include|IncludeAgain|InstallKeybdHook|InstallMouseHook|KeyHistory|LTrim|MaxHotkeysPerInterval|MaxMem|MaxThreads|MaxThreadsBuffer|MaxThreadsPerHotkey|NoEnv|NoTrayIcon|Persistent|SingleInstance|UseHook|WinActivateForce)\b/i,keyword:/\b(Abort|AboveNormal|Add|ahk_class|ahk_group|ahk_id|ahk_pid|All|Alnum|Alpha|AltSubmit|AltTab|AltTabAndMenu|AltTabMenu|AltTabMenuDismiss|AlwaysOnTop|AutoSize|Background|BackgroundTrans|BelowNormal|between|BitAnd|BitNot|BitOr|BitShiftLeft|BitShiftRight|BitXOr|Bold|Border|Button|ByRef|Checkbox|Checked|CheckedGray|Choose|ChooseString|Click|Close|Color|ComboBox|Contains|ControlList|Count|Date|DateTime|Days|DDL|Default|Delete|DeleteAll|Delimiter|Deref|Destroy|Digit|Disable|Disabled|DropDownList|Edit|Eject|Else|Enable|Enabled|Error|Exist|Exp|Expand|ExStyle|FileSystem|First|Flash|Float|FloatFast|Focus|Font|for|global|Grid|Group|GroupBox|GuiClose|GuiContextMenu|GuiDropFiles|GuiEscape|GuiSize|Hdr|Hidden|Hide|High|HKCC|HKCR|HKCU|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_LOCAL_MACHINE|HKEY_USERS|HKLM|HKU|Hours|HScroll|Icon|IconSmall|ID|IDLast|If|IfEqual|IfExist|IfGreater|IfGreaterOrEqual|IfInString|IfLess|IfLessOrEqual|IfMsgBox|IfNotEqual|IfNotExist|IfNotInString|IfWinActive|IfWinExist|IfWinNotActive|IfWinNotExist|Ignore|ImageList|in|Integer|IntegerFast|Interrupt|is|italic|Join|Label|LastFound|LastFoundExist|Limit|Lines|List|ListBox|ListView|Ln|local|Lock|Logoff|Low|Lower|Lowercase|MainWindow|Margin|Maximize|MaximizeBox|MaxSize|Minimize|MinimizeBox|MinMax|MinSize|Minutes|MonthCal|Mouse|Move|Multi|NA|No|NoActivate|NoDefault|NoHide|NoIcon|NoMainWindow|norm|Normal|NoSort|NoSortHdr|NoStandard|Not|NoTab|NoTimers|Number|Off|Ok|On|OwnDialogs|Owner|Parse|Password|Picture|Pixel|Pos|Pow|Priority|ProcessName|Radio|Range|Read|ReadOnly|Realtime|Redraw|REG_BINARY|REG_DWORD|REG_EXPAND_SZ|REG_MULTI_SZ|REG_SZ|Region|Relative|Rename|Report|Resize|Restore|Retry|RGB|Right|Screen|Seconds|Section|Serial|SetLabel|ShiftAltTab|Show|Single|Slider|SortDesc|Standard|static|Status|StatusBar|StatusCD|strike|Style|Submit|SysMenu|Tab|Tab2|TabStop|Text|Theme|Tile|ToggleCheck|ToggleEnable|ToolWindow|Top|Topmost|TransColor|Transparent|Tray|TreeView|TryAgain|Type|UnCheck|underline|Unicode|Unlock|UpDown|Upper|Uppercase|UseErrorLevel|Vis|VisFirst|Visible|VScroll|Wait|WaitClose|WantCtrlA|WantF2|WantReturn|While|Wrap|Xdigit|xm|xp|xs|Yes|ym|yp|ys)\b/i}; \ No newline at end of file diff --git a/components/prism-clike.min.js b/components/prism-clike.min.js index 93397fee32..aaa8378f5b 100644 --- a/components/prism-clike.min.js +++ b/components/prism-clike.min.js @@ -1 +1 @@ -Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//g,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*?(\r?\n|$)/g,lookbehind:!0}],string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/gi,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/gi,inside:{punctuation:/\(/}},number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g}; \ No newline at end of file +Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//g,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*?(\r?\n|$)/g,lookbehind:!0}],string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/gi,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/gi,inside:{punctuation:/\(/}},number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|~|\^|%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g}; \ No newline at end of file diff --git a/components/prism-css.min.js b/components/prism-css.min.js index c07e428a94..4d50f244d0 100644 --- a/components/prism-css.min.js +++ b/components/prism-css.min.js @@ -1 +1 @@ -Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/gi,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,punctuation:/[\{\};:]/g,"function":/[-a-z0-9]+(?=\()/gi},Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/[\w\W]*?<\/style>/gi,inside:{tag:{pattern:/|<\/style>/gi,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css},alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').+?\1/gi,inside:{"attr-name":{pattern:/^\s*style/gi,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/gi,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)); \ No newline at end of file +Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/gi,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,punctuation:/[\{\};:]/g,"function":/[-a-z0-9]+(?=\()/gi},Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/[\w\W]*?<\/style>/gi,inside:{tag:{pattern:/|<\/style>/gi,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css},alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').+?\1/gi,inside:{"attr-name":{pattern:/^\s*style/gi,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/gi,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)); \ No newline at end of file diff --git a/components/prism-ini.min.js b/components/prism-ini.min.js index 1552265321..165b585e51 100644 --- a/components/prism-ini.min.js +++ b/components/prism-ini.min.js @@ -1 +1 @@ -Prism.languages.ini={comment:/^\s*;.*$/gm,important:/\[.*?\]/gm,constant:/^\s*[^\s\=]+?(?=[ \t]*\=)/gm,"attr-value":{pattern:/\=.*/gm,inside:{punctuation:/^[\=]/g}}}; \ No newline at end of file +Prism.languages.ini={comment:/^\s*;.*$/gm,important:/\[.*?\]/gm,constant:/^\s*[^\s=]+?(?=[ \t]*=)/gm,"attr-value":{pattern:/=.*/gm,inside:{punctuation:/^[=]/g}}}; \ No newline at end of file diff --git a/components/prism-markup.min.js b/components/prism-markup.min.js index b46f9add1d..988005f937 100644 --- a/components/prism-markup.min.js +++ b/components/prism-markup.min.js @@ -1 +1 @@ -Prism.languages.markup={comment://g,prolog:/<\?.+?\?>/,doctype://,cdata://i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/\&#?[\da-z]{1,8};/gi},Prism.hooks.add("wrap",function(t){"entity"===t.type&&(t.attributes.title=t.content.replace(/&/,"&"))}); \ No newline at end of file +Prism.languages.markup={comment://g,prolog:/<\?.+?\?>/,doctype://,cdata://i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&#?[\da-z]{1,8};/gi},Prism.hooks.add("wrap",function(t){"entity"===t.type&&(t.attributes.title=t.content.replace(/&/,"&"))}); \ No newline at end of file diff --git a/components/prism-nsis.min.js b/components/prism-nsis.min.js index c9d5555c8e..8a01521587 100644 --- a/components/prism-nsis.min.js +++ b/components/prism-nsis.min.js @@ -1 +1 @@ -Prism.languages.nsis={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])(#|;).*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,keyword:/\b(Abort|Add(BrandingImage|Size)|AdvSplash|Allow(RootDirInstall|SkipFiles)|AutoCloseWindow|Banner|BG(Font|Gradient|Image)|BrandingText|BringToFront|Call(\b|InstDLL)|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|Create(Directory|Font|ShortCut)|Delete(\b|INISec|INIStr|RegKey|RegValue)|Detail(Print|sButtonText)|Dialer|Dir(Text|Var|Verify)|EnableWindow|Enum(RegKey|RegValue)|Exch|Exec(\b|Shell|Wait)|ExpandEnvStrings|File(\b|BufSize|Close|ErrorText|Open|Read|ReadByte|ReadUTF16LE|ReadWord|WriteUTF16LE|Seek|Write|WriteByte|WriteWord)|Find(Close|First|Next|Window)|FlushINI|Get(CurInstType|CurrentAddress|DlgItem|DLLVersion|DLLVersionLocal|ErrorLevel|FileTime|FileTimeLocal|FullPathName|Function(\b|Address|End)|InstDirError|LabelAddress|TempFileName)|Goto|HideWindow|Icon|If(Abort|Errors|FileExists|RebootFlag|Silent)|InitPluginsDir|Install(ButtonText|Colors|Dir|DirRegKey)|InstProgressFlags|Inst(Type|TypeGetText|TypeSetText)|Int(Cmp|CmpU|Fmt|Op)|IsWindow|Lang(DLL|String)|License(BkColor|Data|ForceSelection|LangString|Text)|LoadLanguageFile|LockWindow|Log(Set|Text)|Manifest(DPIAware|SupportedOS)|Math|MessageBox|MiscButtonText|Name|Nop|ns(Dialogs|Exec)|NSISdl|OutFile|Page(\b|Callbacks)|Pop|Push|Quit|Read(EnvStr|INIStr|RegDWORD|RegStr)|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|Section(\b|End|GetFlags|GetInstTypes|GetSize|GetText|Group|In|SetFlags|SetInstTypes|SetSize|SetText)|SendMessage|Set(AutoClose|BrandingImage|Compress|Compressor|CompressorDictSize|CtlColors|CurInstType|DatablockOptimize|DateSave|DetailsPrint|DetailsView|ErrorLevel|Errors|FileAttributes|Font|OutPath|Overwrite|PluginUnload|RebootFlag|RegView|ShellVarContext|Silent)|Show(InstDetails|UninstDetails|Window)|Silent(Install|UnInstall)|Sleep|SpaceTexts|Splash|StartMenu|Str(Cmp|CmpS|Cpy|Len)|SubCaption|System|Unicode|Uninstall(ButtonText|Caption|Icon|SubCaption|Text)|UninstPage|UnRegDLL|UserInfo|Var|VI(AddVersionKey|FileVersion|ProductVersion)|VPatch|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|Write(RegStr|Uninstaller)|XPStyle)\b/g,property:/\b(admin|all|auto|both|colored|false|force|hide|highest|lastused|leave|listonly|none|normal|notset|off|on|open|print|show|silent|silentlog|smooth|textonly|true|user|ARCHIVE|FILE_(ATTRIBUTE_ARCHIVE|ATTRIBUTE_NORMAL|ATTRIBUTE_OFFLINE|ATTRIBUTE_READONLY|ATTRIBUTE_SYSTEM|ATTRIBUTE_TEMPORARY)|HK(CR|CU|DD|LM|PD|U)|HKEY_(CLASSES_ROOT|CURRENT_CONFIG|CURRENT_USER|DYN_DATA|LOCAL_MACHINE|PERFORMANCE_DATA|USERS)|ID(ABORT|CANCEL|IGNORE|NO|OK|RETRY|YES)|MB_(ABORTRETRYIGNORE|DEFBUTTON1|DEFBUTTON2|DEFBUTTON3|DEFBUTTON4|ICONEXCLAMATION|ICONINFORMATION|ICONQUESTION|ICONSTOP|OK|OKCANCEL|RETRYCANCEL|RIGHT|RTLREADING|SETFOREGROUND|TOPMOST|USERICON|YESNO)|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SYSTEM|TEMPORARY)\b/g,variable:/(\$(\(|\{)?[-_\w]+)(\)|\})?/i,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|<=?|>=?|={1,3}|(&){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,punctuation:/[{}[\];(),.:]/g,important:/\!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|else|endif|error|execute|finalize|getdllversionsystem|ifdef|ifmacrodef|ifmacrondef|ifndef|if|include|insertmacro|macroend|macro|makensis|packhdr|searchparse|searchreplace|tempfile|undef|verbose|warning)\b/gi}; \ No newline at end of file +Prism.languages.nsis={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])(#|;).*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,keyword:/\b(Abort|Add(BrandingImage|Size)|AdvSplash|Allow(RootDirInstall|SkipFiles)|AutoCloseWindow|Banner|BG(Font|Gradient|Image)|BrandingText|BringToFront|Call(\b|InstDLL)|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|Create(Directory|Font|ShortCut)|Delete(\b|INISec|INIStr|RegKey|RegValue)|Detail(Print|sButtonText)|Dialer|Dir(Text|Var|Verify)|EnableWindow|Enum(RegKey|RegValue)|Exch|Exec(\b|Shell|Wait)|ExpandEnvStrings|File(\b|BufSize|Close|ErrorText|Open|Read|ReadByte|ReadUTF16LE|ReadWord|WriteUTF16LE|Seek|Write|WriteByte|WriteWord)|Find(Close|First|Next|Window)|FlushINI|Get(CurInstType|CurrentAddress|DlgItem|DLLVersion|DLLVersionLocal|ErrorLevel|FileTime|FileTimeLocal|FullPathName|Function(\b|Address|End)|InstDirError|LabelAddress|TempFileName)|Goto|HideWindow|Icon|If(Abort|Errors|FileExists|RebootFlag|Silent)|InitPluginsDir|Install(ButtonText|Colors|Dir|DirRegKey)|InstProgressFlags|Inst(Type|TypeGetText|TypeSetText)|Int(Cmp|CmpU|Fmt|Op)|IsWindow|Lang(DLL|String)|License(BkColor|Data|ForceSelection|LangString|Text)|LoadLanguageFile|LockWindow|Log(Set|Text)|Manifest(DPIAware|SupportedOS)|Math|MessageBox|MiscButtonText|Name|Nop|ns(Dialogs|Exec)|NSISdl|OutFile|Page(\b|Callbacks)|Pop|Push|Quit|Read(EnvStr|INIStr|RegDWORD|RegStr)|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|Section(\b|End|GetFlags|GetInstTypes|GetSize|GetText|Group|In|SetFlags|SetInstTypes|SetSize|SetText)|SendMessage|Set(AutoClose|BrandingImage|Compress|Compressor|CompressorDictSize|CtlColors|CurInstType|DatablockOptimize|DateSave|DetailsPrint|DetailsView|ErrorLevel|Errors|FileAttributes|Font|OutPath|Overwrite|PluginUnload|RebootFlag|RegView|ShellVarContext|Silent)|Show(InstDetails|UninstDetails|Window)|Silent(Install|UnInstall)|Sleep|SpaceTexts|Splash|StartMenu|Str(Cmp|CmpS|Cpy|Len)|SubCaption|System|Unicode|Uninstall(ButtonText|Caption|Icon|SubCaption|Text)|UninstPage|UnRegDLL|UserInfo|Var|VI(AddVersionKey|FileVersion|ProductVersion)|VPatch|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|Write(RegStr|Uninstaller)|XPStyle)\b/g,property:/\b(admin|all|auto|both|colored|false|force|hide|highest|lastused|leave|listonly|none|normal|notset|off|on|open|print|show|silent|silentlog|smooth|textonly|true|user|ARCHIVE|FILE_(ATTRIBUTE_ARCHIVE|ATTRIBUTE_NORMAL|ATTRIBUTE_OFFLINE|ATTRIBUTE_READONLY|ATTRIBUTE_SYSTEM|ATTRIBUTE_TEMPORARY)|HK(CR|CU|DD|LM|PD|U)|HKEY_(CLASSES_ROOT|CURRENT_CONFIG|CURRENT_USER|DYN_DATA|LOCAL_MACHINE|PERFORMANCE_DATA|USERS)|ID(ABORT|CANCEL|IGNORE|NO|OK|RETRY|YES)|MB_(ABORTRETRYIGNORE|DEFBUTTON1|DEFBUTTON2|DEFBUTTON3|DEFBUTTON4|ICONEXCLAMATION|ICONINFORMATION|ICONQUESTION|ICONSTOP|OK|OKCANCEL|RETRYCANCEL|RIGHT|RTLREADING|SETFOREGROUND|TOPMOST|USERICON|YESNO)|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SYSTEM|TEMPORARY)\b/g,variable:/(\$(\(|\{)?[-_\w]+)(\)|\})?/i,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|<=?|>=?|={1,3}|(&){1,2}|\|?\||\?|\*|\/|~|\^|%/g,punctuation:/[{}[\];(),.:]/g,important:/!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|else|endif|error|execute|finalize|getdllversionsystem|ifdef|ifmacrodef|ifmacrondef|ifndef|if|include|insertmacro|macroend|macro|makensis|packhdr|searchparse|searchreplace|tempfile|undef|verbose|warning)\b/gi}; \ No newline at end of file diff --git a/components/prism-rip.min.js b/components/prism-rip.min.js index 001ca45892..0652842f6c 100644 --- a/components/prism-rip.min.js +++ b/components/prism-rip.min.js @@ -1 +1 @@ -Prism.languages.rip={comment:/#[^\r\n]*(\r?\n|$)/g,keyword:/(?:=>|->)|\b(?:class|if|else|switch|case|return|exit|try|catch|finally|raise)\b/g,builtin:/\b(@|System)\b/g,"boolean":/\b(true|false)\b/g,date:/\b\d{4}-\d{2}-\d{2}\b/g,time:/\b\d{2}:\d{2}:\d{2}\b/g,datetime:/\b\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\b/g,number:/[+-]?(?:(?:\d+\.\d+)|(?:\d+))/g,character:/\B`[^\s\`\'",.:;#\/\\()<>\[\]{}]\b/g,regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0},symbol:/:[^\d\s\`\'",.:;#\/\\()<>\[\]{}][^\s\`\'",.:;#\/\\()<>\[\]{}]*/g,string:/("|')(\\?.)*?\1/g,punctuation:/(?:\.{2,3})|[\`,.:;=\/\\()<>\[\]{}]/,reference:/[^\d\s\`\'",.:;#\/\\()<>\[\]{}][^\s\`\'",.:;#\/\\()<>\[\]{}]*/g}; \ No newline at end of file +Prism.languages.rip={comment:/#[^\r\n]*(\r?\n|$)/g,keyword:/(?:=>|->)|\b(?:class|if|else|switch|case|return|exit|try|catch|finally|raise)\b/g,builtin:/\b(@|System)\b/g,"boolean":/\b(true|false)\b/g,date:/\b\d{4}-\d{2}-\d{2}\b/g,time:/\b\d{2}:\d{2}:\d{2}\b/g,datetime:/\b\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\b/g,number:/[+-]?(?:(?:\d+\.\d+)|(?:\d+))/g,character:/\B`[^\s`'",.:;#\/\\()<>\[\]{}]\b/g,regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0},symbol:/:[^\d\s`'",.:;#\/\\()<>\[\]{}][^\s`'",.:;#\/\\()<>\[\]{}]*/g,string:/("|')(\\?.)*?\1/g,punctuation:/(?:\.{2,3})|[`,.:;=\/\\()<>\[\]{}]/,reference:/[^\d\s`'",.:;#\/\\()<>\[\]{}][^\s`'",.:;#\/\\()<>\[\]{}]*/g}; \ No newline at end of file diff --git a/components/prism-scala.min.js b/components/prism-scala.min.js index a8ea5857bf..ddac961667 100644 --- a/components/prism-scala.min.js +++ b/components/prism-scala.min.js @@ -1 +1 @@ -Prism.languages.scala=Prism.languages.extend("java",{keyword:/(<-|=>)|\b(abstract|case|catch|class|def|do|else|extends|final|finally|for|forSome|if|implicit|import|lazy|match|new|null|object|override|package|private|protected|return|sealed|self|super|this|throw|trait|try|type|val|var|while|with|yield)\b/g,builtin:/\b(String|Int|Long|Short|Byte|Boolean|Double|Float|Char|Any|AnyRef|AnyVal|Unit|Nothing)\b/g,number:/\b0x[\da-f]*\.?[\da-f\-]+\b|\b\d*\.?\d+[e]?[\d]*[dfl]?\b/gi,symbol:/'([^\d\s]\w*)/g,string:/(""")[\W\w]*?\1|("|\/)[\W\w]*?\2|('.')/g}),delete Prism.languages.scala["function"]; \ No newline at end of file +Prism.languages.scala=Prism.languages.extend("java",{keyword:/(<-|=>)|\b(abstract|case|catch|class|def|do|else|extends|final|finally|for|forSome|if|implicit|import|lazy|match|new|null|object|override|package|private|protected|return|sealed|self|super|this|throw|trait|try|type|val|var|while|with|yield)\b/g,builtin:/\b(String|Int|Long|Short|Byte|Boolean|Double|Float|Char|Any|AnyRef|AnyVal|Unit|Nothing)\b/g,number:/\b0x[\da-f]*\.?[\da-f\-]+\b|\b\d*\.?\d+[e]?[\d]*[dfl]?\b/gi,symbol:/'([^\d\s]\w*)/g,string:/(""")[\W\w]*?\1|("|\/)[\W\w]*?\2|('.')/g}),delete Prism.languages.scala["class-name"],delete Prism.languages.scala["function"]; \ No newline at end of file diff --git a/components/prism-scheme.min.js b/components/prism-scheme.min.js index bb8717740a..7000c58156 100644 --- a/components/prism-scheme.min.js +++ b/components/prism-scheme.min.js @@ -1 +1 @@ -Prism.languages.scheme={"boolean":/#(t|f){1}/,comment:/;.*/,keyword:{pattern:/([(])(define(-syntax|-library|-values)?|(case-)?lambda|let(-values|(rec)?(\*)?)?|else|if|cond|begin|delay|delay-force|parameterize|guard|set!|(quasi-)?quote|syntax-rules)/,lookbehind:!0},builtin:{pattern:/([(])(cons|car|cdr|null\?|pair\?|boolean\?|eof-object\?|char\?|procedure\?|number\?|port\?|string\?|vector\?|symbol\?|bytevector\?|list|call-with-current-continuation|call\/cc|append|abs|apply|eval)\b/,lookbehind:!0},string:/(["])(?:(?=(\\?))\2.)*?\1|'[^('|\s)]+/,number:/(\s|\))[-+]?[0-9]*\.?[0-9]+((\s*)[-+]{1}(\s*)[0-9]*\.?[0-9]+i)?/,operator:/(\*|\+|\-|\%|\/|<=|=>|>=|<|=|>)/,"function":{pattern:/([(])[^(\s|\))]*\s/,lookbehind:!0},punctuation:/[()]/}; \ No newline at end of file +Prism.languages.scheme={"boolean":/#(t|f){1}/,comment:/;.*/,keyword:{pattern:/([(])(define(-syntax|-library|-values)?|(case-)?lambda|let(-values|(rec)?(\*)?)?|else|if|cond|begin|delay|delay-force|parameterize|guard|set!|(quasi-)?quote|syntax-rules)/,lookbehind:!0},builtin:{pattern:/([(])(cons|car|cdr|null\?|pair\?|boolean\?|eof-object\?|char\?|procedure\?|number\?|port\?|string\?|vector\?|symbol\?|bytevector\?|list|call-with-current-continuation|call\/cc|append|abs|apply|eval)\b/,lookbehind:!0},string:/(["])(?:(?=(\\?))\2.)*?\1|'[^('|\s)]+/,number:/(\s|\))[-+]?[0-9]*\.?[0-9]+((\s*)[-+]{1}(\s*)[0-9]*\.?[0-9]+i)?/,operator:/(\*|\+|\-|%|\/|<=|=>|>=|<|=|>)/,"function":{pattern:/([(])[^(\s|\))]*\s/,lookbehind:!0},punctuation:/[()]/}; \ No newline at end of file diff --git a/components/prism-scss.min.js b/components/prism-scss.min.js index c70c3f3be3..d992d8948e 100644 --- a/components/prism-scss.min.js +++ b/components/prism-scss.min.js @@ -1 +1 @@ -Prism.languages.scss=Prism.languages.extend("css",{comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,lookbehind:!0},atrule:/@[\w-]+(?=\s+(\(|\{|;))/gi,url:/([-a-z]+-)*url(?=\()/gi,selector:/([^@;\{\}\(\)]?([^@;\{\}\(\)]|&|\#\{\$[-_\w]+\})+)(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/gm}),Prism.languages.insertBefore("scss","atrule",{keyword:/@(if|else if|else|for|each|while|import|extend|debug|warn|mixin|include|function|return|content)|(?=@for\s+\$[-_\w]+\s)+from/i}),Prism.languages.insertBefore("scss","property",{variable:/((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i}),Prism.languages.insertBefore("scss","function",{placeholder:/%[-_\w]+/i,statement:/\B!(default|optional)\b/gi,"boolean":/\b(true|false)\b/g,"null":/\b(null)\b/g,operator:/\s+([-+]{1,2}|={1,2}|!=|\|?\||\?|\*|\/|\%)\s+/g}); \ No newline at end of file +Prism.languages.scss=Prism.languages.extend("css",{comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,lookbehind:!0},atrule:/@[\w-]+(?=\s+(\(|\{|;))/gi,url:/([-a-z]+-)*url(?=\()/gi,selector:/([^@;\{\}\(\)]?([^@;\{\}\(\)]|&|#\{\$[-_\w]+\})+)(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/gm}),Prism.languages.insertBefore("scss","atrule",{keyword:/@(if|else if|else|for|each|while|import|extend|debug|warn|mixin|include|function|return|content)|(?=@for\s+\$[-_\w]+\s)+from/i}),Prism.languages.insertBefore("scss","property",{variable:/((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i}),Prism.languages.insertBefore("scss","function",{placeholder:/%[-_\w]+/i,statement:/\B!(default|optional)\b/gi,"boolean":/\b(true|false)\b/g,"null":/\b(null)\b/g,operator:/\s+([-+]{1,2}|={1,2}|!=|\|?\||\?|\*|\/|%)\s+/g}); \ No newline at end of file diff --git a/components/prism-swift.min.js b/components/prism-swift.min.js index 5a81aa52c2..8e9f82e170 100644 --- a/components/prism-swift.min.js +++ b/components/prism-swift.min.js @@ -1 +1 @@ -Prism.languages.swift=Prism.languages.extend("clike",{keyword:/\b(as|associativity|break|case|class|continue|convenience|default|deinit|didSet|do|dynamicType|else|enum|extension|fallthrough|final|for|func|get|if|import|in|infix|init|inout|internal|is|lazy|left|let|mutating|new|none|nonmutating|operator|optional|override|postfix|precedence|prefix|private|protocol|public|required|return|right|safe|self|Self|set|static|struct|subscript|super|switch|Type|typealias|unowned|unowned|unsafe|var|weak|where|while|willSet|__COLUMN__|__FILE__|__FUNCTION__|__LINE__)\b/g,number:/\b([\d_]+(\.[\de_]+)?|0x[a-f0-9_]+(\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/gi,constant:/\b(nil|[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/g,atrule:/\@\b(IBOutlet|IBDesignable|IBAction|IBInspectable|class_protocol|exported|noreturn|NSCopying|NSManaged|objc|UIApplicationMain|auto_closure)\b/g,builtin:/\b([A-Z]\S+|abs|advance|alignof|alignofValue|assert|contains|count|countElements|debugPrint|debugPrintln|distance|dropFirst|dropLast|dump|enumerate|equal|filter|find|first|getVaList|indices|isEmpty|join|last|lazy|lexicographicalCompare|map|max|maxElement|min|minElement|numericCast|overlaps|partition|prefix|print|println|reduce|reflect|reverse|sizeof|sizeofValue|sort|sorted|split|startsWith|stride|strideof|strideofValue|suffix|swap|toDebugString|toString|transcode|underestimateCount|unsafeBitCast|withExtendedLifetime|withUnsafeMutablePointer|withUnsafeMutablePointers|withUnsafePointer|withUnsafePointers|withVaList)\b/g}); \ No newline at end of file +Prism.languages.swift=Prism.languages.extend("clike",{keyword:/\b(as|associativity|break|case|class|continue|convenience|default|deinit|didSet|do|dynamicType|else|enum|extension|fallthrough|final|for|func|get|if|import|in|infix|init|inout|internal|is|lazy|left|let|mutating|new|none|nonmutating|operator|optional|override|postfix|precedence|prefix|private|protocol|public|required|return|right|safe|self|Self|set|static|struct|subscript|super|switch|Type|typealias|unowned|unowned|unsafe|var|weak|where|while|willSet|__COLUMN__|__FILE__|__FUNCTION__|__LINE__)\b/g,number:/\b([\d_]+(\.[\de_]+)?|0x[a-f0-9_]+(\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/gi,constant:/\b(nil|[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/g,atrule:/@\b(IBOutlet|IBDesignable|IBAction|IBInspectable|class_protocol|exported|noreturn|NSCopying|NSManaged|objc|UIApplicationMain|auto_closure)\b/g,builtin:/\b([A-Z]\S+|abs|advance|alignof|alignofValue|assert|contains|count|countElements|debugPrint|debugPrintln|distance|dropFirst|dropLast|dump|enumerate|equal|filter|find|first|getVaList|indices|isEmpty|join|last|lazy|lexicographicalCompare|map|max|maxElement|min|minElement|numericCast|overlaps|partition|prefix|print|println|reduce|reflect|reverse|sizeof|sizeofValue|sort|sorted|split|startsWith|stride|strideof|strideofValue|suffix|swap|toDebugString|toString|transcode|underestimateCount|unsafeBitCast|withExtendedLifetime|withUnsafeMutablePointer|withUnsafeMutablePointers|withUnsafePointer|withUnsafePointers|withVaList)\b/g}); \ No newline at end of file diff --git a/components/prism-twig.min.js b/components/prism-twig.min.js index 23c46f9193..d33fc31551 100644 --- a/components/prism-twig.min.js +++ b/components/prism-twig.min.js @@ -1 +1 @@ -Prism.languages.twig={comment:/\{\#[\s\S]*?\#\}/g,tag:{pattern:/(\{\{[\s\S]*?\}\}|\{\%[\s\S]*?\%\})/g,inside:{ld:{pattern:/^(\{\{\-?|\{\%\-?\s*\w+)/,inside:{punctuation:/^(\{\{|\{\%)\-?/,keyword:/\w+/}},rd:{pattern:/\-?(\%\}|\}\})$/,inside:{punctuation:/.*/}},string:{pattern:/("|')(\\?.)*?\1/g,inside:{punctuation:/^('|")|('|")$/g}},keyword:/\b(if)\b/g,"boolean":/\b(true|false|null)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/==|=|\!=|<|>|>=|<=|\+|\-|~|\*|\/|\/\/|%|\*\*|\|/g,"space-operator":{pattern:/(\s)(\b(not|b\-and|b\-xor|b\-or|and|or|in|matches|starts with|ends with|is)\b|\?|:|\?\:)(?=\s)/g,lookbehind:!0,inside:{operator:/.*/}},property:/\b[a-zA-Z_][a-zA-Z0-9_]*\b/g,punctuation:/\(|\)|\[\]|\[|\]|\{|\}|\:|\.|,/g}},other:{pattern:/[\s\S]*/,inside:Prism.languages.markup}}; \ No newline at end of file +Prism.languages.twig={comment:/\{#[\s\S]*?#\}/g,tag:{pattern:/(\{\{[\s\S]*?\}\}|\{%[\s\S]*?%\})/g,inside:{ld:{pattern:/^(\{\{\-?|\{%\-?\s*\w+)/,inside:{punctuation:/^(\{\{|\{%)\-?/,keyword:/\w+/}},rd:{pattern:/\-?(%\}|\}\})$/,inside:{punctuation:/.*/}},string:{pattern:/("|')(\\?.)*?\1/g,inside:{punctuation:/^('|")|('|")$/g}},keyword:/\b(if)\b/g,"boolean":/\b(true|false|null)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/==|=|!=|<|>|>=|<=|\+|\-|~|\*|\/|\/\/|%|\*\*|\|/g,"space-operator":{pattern:/(\s)(\b(not|b\-and|b\-xor|b\-or|and|or|in|matches|starts with|ends with|is)\b|\?|:|\?:)(?=\s)/g,lookbehind:!0,inside:{operator:/.*/}},property:/\b[a-zA-Z_][a-zA-Z0-9_]*\b/g,punctuation:/\(|\)|\[\]|\[|\]|\{|\}|:|\.|,/g}},other:{pattern:/[\s\S]*/,inside:Prism.languages.markup}}; \ No newline at end of file diff --git a/prism.js b/prism.js index 50c3356804..764e23f08b 100644 --- a/prism.js +++ b/prism.js @@ -217,7 +217,7 @@ var _ = self.Prism = { })); } else { - env.highlightedCode = _.highlight(env.code, env.grammar, env.language) + env.highlightedCode = _.highlight(env.code, env.grammar, env.language); _.hooks.run('before-insert', env); @@ -466,7 +466,7 @@ Prism.languages.markup = { } }, - 'entity': /\&#?[\da-z]{1,8};/gi + 'entity': /&#?[\da-z]{1,8};/gi }; // Plugin to make entity title show the real entity, idea by Roman Komarov @@ -485,7 +485,7 @@ Prism.hooks.add('wrap', function(env) { Prism.languages.css = { 'comment': /\/\*[\w\W]*?\*\//g, 'atrule': { - pattern: /@[\w-]+?.*?(;|(?=\s*{))/gi, + pattern: /@[\w-]+?.*?(;|(?=\s*\{))/gi, inside: { 'punctuation': /[;:]/g } @@ -565,7 +565,7 @@ Prism.languages.clike = { } }, 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g, - 'operator': /[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|\~|\^|\%/g, + 'operator': /[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|~|\^|%/g, 'ignore': /&(lt|gt|amp);/gi, 'punctuation': /[{}[\];(),.:]/g }; From d9978a172d672e910c49387f4c5fdee54ac87dfc Mon Sep 17 00:00:00 2001 From: Golmote Date: Fri, 9 Jan 2015 20:11:39 +0100 Subject: [PATCH 133/137] Improve NASM number regexp. Fixes #462 --- components/prism-nasm.js | 2 +- components/prism-nasm.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/prism-nasm.js b/components/prism-nasm.js index 96e8811380..1b5946fc16 100644 --- a/components/prism-nasm.js +++ b/components/prism-nasm.js @@ -15,6 +15,6 @@ Prism.languages.nasm = { pattern: /\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(bp|sp|si|di)|[cdefgs]s)\b/gi, alias: 'variable' }, - 'number': /(\b|-|(?=\$))(0[hHxX][\dA-Fa-f]*\.?[\dA-Fa-f]+([pP][+-]?\d+)?|\d[\dA-Fa-f]+[hHxX]|\$\d[\dA-Fa-f]*|0[oOqQ][0-7]+|[0-7]+[oOqQ]|0[bByY][01]+|[01]+[bByY]|0[dDtT]\d+|\d*\.?\d+(\.?[Ee][+-]?\d+)?[dDtT]?)\b/g, + 'number': /(\b|-|(?=\$))(0[hx][\da-f]*\.?[\da-f]+(p[+-]?\d+)?|\d[\da-f]+[hx]|\\$\d[\da-f]*|0[oq][0-7]+|[0-7]+[oq]|0[by][01]+|[01]+[by]|0[dt]\d+|\d*\.?\d+(\.?e[+-]?\d+)?[dt]?)\b/i, 'operator': /[\[\]\*+\-\/%<>=&|\$!]/gm }; diff --git a/components/prism-nasm.min.js b/components/prism-nasm.min.js index c5020e41d8..43e3128bd5 100644 --- a/components/prism-nasm.min.js +++ b/components/prism-nasm.min.js @@ -1 +1 @@ -Prism.languages.nasm={comment:/;.*$/m,string:/("|'|`)(\\?.)*?\1/gm,label:{pattern:/^\s*[A-Za-z\._\?\$][\w\.\?\$@~#]*:/m,alias:"function"},keyword:[/\[?BITS (16|32|64)\]?/m,/^\s*section\s*[a-zA-Z\.]+:?/im,/(?:extern|global)[^;]*/im,/(?:CPU|FLOAT|DEFAULT).*$/m],register:{pattern:/\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(bp|sp|si|di)|[cdefgs]s)\b/gi,alias:"variable"},number:/(\b|-|(?=\$))(0[hHxX][\dA-Fa-f]*\.?[\dA-Fa-f]+([pP][+-]?\d+)?|\d[\dA-Fa-f]+[hHxX]|\$\d[\dA-Fa-f]*|0[oOqQ][0-7]+|[0-7]+[oOqQ]|0[bByY][01]+|[01]+[bByY]|0[dDtT]\d+|\d*\.?\d+(\.?[Ee][+-]?\d+)?[dDtT]?)\b/g,operator:/[\[\]\*+\-\/%<>=&|\$!]/gm}; \ No newline at end of file +Prism.languages.nasm={comment:/;.*$/m,string:/("|'|`)(\\?.)*?\1/gm,label:{pattern:/^\s*[A-Za-z\._\?\$][\w\.\?\$@~#]*:/m,alias:"function"},keyword:[/\[?BITS (16|32|64)\]?/m,/^\s*section\s*[a-zA-Z\.]+:?/im,/(?:extern|global)[^;]*/im,/(?:CPU|FLOAT|DEFAULT).*$/m],register:{pattern:/\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(bp|sp|si|di)|[cdefgs]s)\b/gi,alias:"variable"},number:/(\b|-|(?=\$))(0[hx][\da-f]*\.?[\da-f]+(p[+-]?\d+)?|\d[\da-f]+[hx]|\\$\d[\da-f]*|0[oq][0-7]+|[0-7]+[oq]|0[by][01]+|[01]+[by]|0[dt]\d+|\d*\.?\d+(\.?e[+-]?\d+)?[dt]?)\b/i,operator:/[\[\]\*+\-\/%<>=&|\$!]/gm}; \ No newline at end of file From 287c75d65fdbc33a9fa63e457c5b3dd3c3003e75 Mon Sep 17 00:00:00 2001 From: Golmote Date: Fri, 9 Jan 2015 20:16:08 +0100 Subject: [PATCH 134/137] Fix new NASM number regexp --- components/prism-nasm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-nasm.js b/components/prism-nasm.js index 1b5946fc16..b3b7a5cff2 100644 --- a/components/prism-nasm.js +++ b/components/prism-nasm.js @@ -15,6 +15,6 @@ Prism.languages.nasm = { pattern: /\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(bp|sp|si|di)|[cdefgs]s)\b/gi, alias: 'variable' }, - 'number': /(\b|-|(?=\$))(0[hx][\da-f]*\.?[\da-f]+(p[+-]?\d+)?|\d[\da-f]+[hx]|\\$\d[\da-f]*|0[oq][0-7]+|[0-7]+[oq]|0[by][01]+|[01]+[by]|0[dt]\d+|\d*\.?\d+(\.?e[+-]?\d+)?[dt]?)\b/i, + 'number': /(\b|-|(?=\$))(0[hx][\da-f]*\.?[\da-f]+(p[+-]?\d+)?|\d[\da-f]+[hx]|\$\d[\da-f]*|0[oq][0-7]+|[0-7]+[oq]|0[by][01]+|[01]+[by]|0[dt]\d+|\d*\.?\d+(\.?e[+-]?\d+)?[dt]?)\b/i, 'operator': /[\[\]\*+\-\/%<>=&|\$!]/gm }; From 24351dc104a8d9397a187c1d994253548a269f0d Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 10 Jan 2015 09:33:25 +0100 Subject: [PATCH 135/137] Fix URL RegExp in Autolinker --- plugins/autolinker/prism-autolinker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/autolinker/prism-autolinker.js b/plugins/autolinker/prism-autolinker.js index 8123861627..a26b263047 100644 --- a/plugins/autolinker/prism-autolinker.js +++ b/plugins/autolinker/prism-autolinker.js @@ -4,7 +4,7 @@ if (!self.Prism) { return; } -var url = /\b([a-z]{3,7}:\/\/|tel:)[\w-+%~/.:#=?&]+/, +var url = /\b([a-z]{3,7}:\/\/|tel:)[\w\-+%~/.:#=?&]+/, email = /\b\S+@[\w.]+[a-z]{2}/, linkMd = /\[([^\]]+)]\(([^)]+)\)/, From 6cac548df83a6a6adeb5fa3ebbd00d61d7f75419 Mon Sep 17 00:00:00 2001 From: Golmote Date: Sat, 10 Jan 2015 09:33:48 +0100 Subject: [PATCH 136/137] Run gulp --- components/prism-nasm.min.js | 2 +- plugins/autolinker/prism-autolinker.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/prism-nasm.min.js b/components/prism-nasm.min.js index 43e3128bd5..6926b798be 100644 --- a/components/prism-nasm.min.js +++ b/components/prism-nasm.min.js @@ -1 +1 @@ -Prism.languages.nasm={comment:/;.*$/m,string:/("|'|`)(\\?.)*?\1/gm,label:{pattern:/^\s*[A-Za-z\._\?\$][\w\.\?\$@~#]*:/m,alias:"function"},keyword:[/\[?BITS (16|32|64)\]?/m,/^\s*section\s*[a-zA-Z\.]+:?/im,/(?:extern|global)[^;]*/im,/(?:CPU|FLOAT|DEFAULT).*$/m],register:{pattern:/\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(bp|sp|si|di)|[cdefgs]s)\b/gi,alias:"variable"},number:/(\b|-|(?=\$))(0[hx][\da-f]*\.?[\da-f]+(p[+-]?\d+)?|\d[\da-f]+[hx]|\\$\d[\da-f]*|0[oq][0-7]+|[0-7]+[oq]|0[by][01]+|[01]+[by]|0[dt]\d+|\d*\.?\d+(\.?e[+-]?\d+)?[dt]?)\b/i,operator:/[\[\]\*+\-\/%<>=&|\$!]/gm}; \ No newline at end of file +Prism.languages.nasm={comment:/;.*$/m,string:/("|'|`)(\\?.)*?\1/gm,label:{pattern:/^\s*[A-Za-z\._\?\$][\w\.\?\$@~#]*:/m,alias:"function"},keyword:[/\[?BITS (16|32|64)\]?/m,/^\s*section\s*[a-zA-Z\.]+:?/im,/(?:extern|global)[^;]*/im,/(?:CPU|FLOAT|DEFAULT).*$/m],register:{pattern:/\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(bp|sp|si|di)|[cdefgs]s)\b/gi,alias:"variable"},number:/(\b|-|(?=\$))(0[hx][\da-f]*\.?[\da-f]+(p[+-]?\d+)?|\d[\da-f]+[hx]|\$\d[\da-f]*|0[oq][0-7]+|[0-7]+[oq]|0[by][01]+|[01]+[by]|0[dt]\d+|\d*\.?\d+(\.?e[+-]?\d+)?[dt]?)\b/i,operator:/[\[\]\*+\-\/%<>=&|\$!]/gm}; \ No newline at end of file diff --git a/plugins/autolinker/prism-autolinker.min.js b/plugins/autolinker/prism-autolinker.min.js index 80f30dfdf2..2b985be3ac 100644 --- a/plugins/autolinker/prism-autolinker.min.js +++ b/plugins/autolinker/prism-autolinker.min.js @@ -1 +1 @@ -!function(){if(self.Prism){var i=/\b([a-z]{3,7}:\/\/|tel:)[\w-+%~/.:#=?&]+/,n=/\b\S+@[\w.]+[a-z]{2}/,t=/\[([^\]]+)]\(([^)]+)\)/,e=["comment","url","attr-value","string"];for(var a in Prism.languages){var r=Prism.languages[a];Prism.languages.DFS(r,function(a,r,l){e.indexOf(l)>-1&&"Array"!==Prism.util.type(r)&&(r.pattern||(r=this[a]={pattern:r}),r.inside=r.inside||{},"comment"==l&&(r.inside["md-link"]=t),"attr-value"==l?Prism.languages.insertBefore("inside","punctuation",{"url-link":i},r):r.inside["url-link"]=i,r.inside["email-link"]=n)}),r["url-link"]=i,r["email-link"]=n}Prism.hooks.add("wrap",function(i){if(/-link$/.test(i.type)){i.tag="a";var n=i.content;if("email-link"==i.type&&0!=n.indexOf("mailto:"))n="mailto:"+n;else if("md-link"==i.type){var e=i.content.match(t);n=e[2],i.content=e[1]}i.attributes.href=n}})}}(); \ No newline at end of file +!function(){if(self.Prism){var i=/\b([a-z]{3,7}:\/\/|tel:)[\w\-+%~/.:#=?&]+/,n=/\b\S+@[\w.]+[a-z]{2}/,t=/\[([^\]]+)]\(([^)]+)\)/,e=["comment","url","attr-value","string"];for(var a in Prism.languages){var r=Prism.languages[a];Prism.languages.DFS(r,function(a,r,l){e.indexOf(l)>-1&&"Array"!==Prism.util.type(r)&&(r.pattern||(r=this[a]={pattern:r}),r.inside=r.inside||{},"comment"==l&&(r.inside["md-link"]=t),"attr-value"==l?Prism.languages.insertBefore("inside","punctuation",{"url-link":i},r):r.inside["url-link"]=i,r.inside["email-link"]=n)}),r["url-link"]=i,r["email-link"]=n}Prism.hooks.add("wrap",function(i){if(/-link$/.test(i.type)){i.tag="a";var n=i.content;if("email-link"==i.type&&0!=n.indexOf("mailto:"))n="mailto:"+n;else if("md-link"==i.type){var e=i.content.match(t);n=e[2],i.content=e[1]}i.attributes.href=n}})}}(); \ No newline at end of file From b6e7da53e51da11ae57f97435f2c31e896344785 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Bansal Date: Sat, 10 Jan 2015 21:48:54 +0530 Subject: [PATCH 137/137] fixes #464 crlf issue --- plugins/show-invisibles/index.html | 2 +- plugins/show-invisibles/prism-show-invisibles.css | 11 +++++++---- plugins/show-invisibles/prism-show-invisibles.js | 7 ++++--- plugins/show-invisibles/prism-show-invisibles.min.js | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/plugins/show-invisibles/index.html b/plugins/show-invisibles/index.html index 2ef3312395..98c8719f88 100644 --- a/plugins/show-invisibles/index.html +++ b/plugins/show-invisibles/index.html @@ -43,4 +43,4 @@

Examples

- \ No newline at end of file + diff --git a/plugins/show-invisibles/prism-show-invisibles.css b/plugins/show-invisibles/prism-show-invisibles.css index f3e149c0bb..bea233840a 100644 --- a/plugins/show-invisibles/prism-show-invisibles.css +++ b/plugins/show-invisibles/prism-show-invisibles.css @@ -5,13 +5,16 @@ } .token.tab:not(:empty):before { - content: '▸'; + content: '\21E5'; } .token.cr:before { - content: '␍'; + content: '\240D'; } +.token.crlf:before { + content: '\240D\240A'; +} .token.lf:before { - content: '␊'; -} \ No newline at end of file + content: '\240A'; +} diff --git a/plugins/show-invisibles/prism-show-invisibles.js b/plugins/show-invisibles/prism-show-invisibles.js index 19681a8175..0fbe25e2bd 100644 --- a/plugins/show-invisibles/prism-show-invisibles.js +++ b/plugins/show-invisibles/prism-show-invisibles.js @@ -7,9 +7,10 @@ if(!window.Prism) { for (var language in Prism.languages) { var tokens = Prism.languages[language]; - tokens.tab = /\t/g; - tokens.lf = /\n/g; + tokens.tab = /\t/g; + tokens.crlf = /\r\n/g; + tokens.lf = /\n/g; tokens.cr = /\r/g; } -})(); \ No newline at end of file +})(); diff --git a/plugins/show-invisibles/prism-show-invisibles.min.js b/plugins/show-invisibles/prism-show-invisibles.min.js index ede15945cb..bf68c7cd96 100644 --- a/plugins/show-invisibles/prism-show-invisibles.min.js +++ b/plugins/show-invisibles/prism-show-invisibles.min.js @@ -1 +1 @@ -!function(){if(window.Prism)for(var r in Prism.languages){var a=Prism.languages[r];a.tab=/\t/g,a.lf=/\n/g,a.cr=/\r/g}}(); \ No newline at end of file +!function(){if(window.Prism)for(var r in Prism.languages){var g=Prism.languages[r];g.tab=/\t/g,g.crlf=/\r\n/g,g.lf=/\n/g,g.cr=/\r/g}}(); \ No newline at end of file