Skip to content

Commit

Permalink
Merge remote-tracking branch 'PrismJS/gh-pages' into gh-pages
Browse files Browse the repository at this point in the history
* PrismJS/gh-pages:
  Plugins: Toolbar & Copy to Clipboard (PrismJS#891)
  Ini: Fix test after  PrismJS#1047
  Add support for the Jolie language (PrismJS#1014)
  Fix order of decoding entities in groovy (PrismJS#1049) (PrismJS#1050)
  Ruby: Make strings greedy. Fixes PrismJS#1048
  Ini: Remove newline at end of minified file.
  Ruby: Fix test after PrismJS#1023
  Remove important token in ini definition (PrismJS#1047)
  Add missing `from` keyword to typescript & set `ts` as alias. (PrismJS#1042)
  Fix greedy-flag bug
  Add yarn.lock (PrismJS#1035)
  • Loading branch information
thesave committed Nov 9, 2016
2 parents f9dd349 + 07b81ac commit 4701694
Show file tree
Hide file tree
Showing 29 changed files with 518 additions and 70 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
hide-*.js
node_modules
.idea/
.DS_Store
.DS_Store
yarn.lock
14 changes: 13 additions & 1 deletion components.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,9 @@ var components = {
},
"show-language": {
"title": "Show Language",
"owner": "nauzilus"
"owner": "nauzilus",
"noCSS": true,
"require": "toolbar"
},
"jsonp-highlight": {
"title": "JSONP Highlight",
Expand Down Expand Up @@ -659,6 +661,16 @@ var components = {
"title": "Data-URI Highlight",
"owner": "Golmote",
"noCSS": true
},
"toolbar": {
"title": "Toolbar",
"owner": "mAAdhaTTah"
},
"copy-to-clipboard": {
"title": "Copy to Clipboard Button",
"owner": "mAAdhaTTah",
"require": "toolbar",
"noCSS": true
}
}
};
6 changes: 3 additions & 3 deletions components/prism-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ var _ = _self.Prism = {
pattern = pattern.pattern || pattern;

// Don’t cache length as it changes during the loop
for (var i=0, pos = 0; i<strarr.length; pos += (strarr[i].matchedStr || strarr[i]).length, ++i) {
for (var i=0, pos = 0; i<strarr.length; pos += strarr[i].length, ++i) {

var str = strarr[i];

Expand Down Expand Up @@ -321,7 +321,7 @@ var _ = _self.Prism = {
p = pos;

for (var len = strarr.length; k < len && p < to; ++k) {
p += (strarr[k].matchedStr || strarr[k]).length;
p += strarr[k].length;
// Move the index i to the element in strarr that is closest to from
if (from >= p) {
++i;
Expand Down Expand Up @@ -409,7 +409,7 @@ var Token = _.Token = function(type, content, alias, matchedStr, greedy) {
this.content = content;
this.alias = alias;
// Copy of the full string this token was created from
this.matchedStr = matchedStr || null;
this.length = (matchedStr || "").length|0;
this.greedy = !!greedy;
};

Expand Down
2 changes: 1 addition & 1 deletion components/prism-core.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/prism-groovy.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Prism.hooks.add('wrap', function(env) {
}

// To prevent double HTML-encoding we have to decode env.content first
env.content = env.content.replace(/&amp;/g, '&').replace(/&lt;/g, '<');
env.content = env.content.replace(/&lt;/g, '<').replace(/&amp;/g, '&');

env.content = Prism.highlight(env.content, {
'expression': {
Expand Down
2 changes: 1 addition & 1 deletion components/prism-groovy.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/prism-ini.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Prism.languages.ini= {
'comment': /^[ \t]*;.*$/m,
'important': /\[.*?\]/,
'selector': /^[ \t]*\[.*?\]/m,
'constant': /^[ \t]*[^\s=]+?(?=[ \t]*=)/m,
'attr-value': {
pattern: /=.*/,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-ini.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions components/prism-ruby.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,37 +71,43 @@
Prism.languages.ruby.string = [
{
pattern: /%[qQiIwWxs]?([^a-zA-Z0-9\s\{\(\[<])(?:[^\\]|\\[\s\S])*?\1/,
greedy: true,
inside: {
'interpolation': interpolation
}
},
{
pattern: /%[qQiIwWxs]?\((?:[^()\\]|\\[\s\S])*\)/,
greedy: true,
inside: {
'interpolation': interpolation
}
},
{
// Here we need to specifically allow interpolation
pattern: /%[qQiIwWxs]?\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/,
greedy: true,
inside: {
'interpolation': interpolation
}
},
{
pattern: /%[qQiIwWxs]?\[(?:[^\[\]\\]|\\[\s\S])*\]/,
greedy: true,
inside: {
'interpolation': interpolation
}
},
{
pattern: /%[qQiIwWxs]?<(?:[^<>\\]|\\[\s\S])*>/,
greedy: true,
inside: {
'interpolation': interpolation
}
},
{
pattern: /("|')(#\{[^}]+\}|\\(?:\r?\n|\r)|\\?.)*?\1/,
greedy: true,
inside: {
'interpolation': interpolation
}
Expand Down
Loading

0 comments on commit 4701694

Please sign in to comment.