Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Unified Diff: lib/src/prism/components/prism-handlebars.js

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/prism/components/prism-haml.min.js ('k') | lib/src/prism/components/prism-handlebars.min.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/prism/components/prism-handlebars.js
diff --git a/lib/src/prism/components/prism-handlebars.js b/lib/src/prism/components/prism-handlebars.js
index 00fe7714d68a0b6dcdc70e1e3427cde191a679a0..d6eb8e9551908acd1b2c42be1035aa8f239200db 100644
--- a/lib/src/prism/components/prism-handlebars.js
+++ b/lib/src/prism/components/prism-handlebars.js
@@ -10,11 +10,11 @@
pattern: /^\{\{\{?|\}\}\}?$/i,
alias: 'punctuation'
},
- 'string': /(["'])(\\?.)+?\1/,
- 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/,
+ 'string': /(["'])(\\?.)*?\1/,
+ 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?)\b/,
'boolean': /\b(true|false)\b/,
'block': {
- pattern: /^(\s*~?\s*)[#\/]\S+/i,
+ pattern: /^(\s*~?\s*)[#\/]\S+?(?=\s*~?\s*$|\s)/i,
lookbehind: true,
alias: 'keyword'
},
@@ -26,7 +26,7 @@
}
},
'punctuation': /[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/,
- 'variable': /[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/
+ 'variable': /[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~\s]+/
}
}
});
@@ -73,7 +73,8 @@
}
for (var i = 0, t; t = env.tokenStack[i]; i++) {
- env.highlightedCode = env.highlightedCode.replace('___HANDLEBARS' + (i + 1) + '___', Prism.highlight(t, env.grammar, 'handlebars'));
+ // The replace prevents $$, $&, $`, $', $n, $nn from being interpreted as special patterns
+ env.highlightedCode = env.highlightedCode.replace('___HANDLEBARS' + (i + 1) + '___', Prism.highlight(t, env.grammar, 'handlebars').replace(/\$/g, '$$$$'));
}
env.element.innerHTML = env.highlightedCode;
« no previous file with comments | « lib/src/prism/components/prism-haml.min.js ('k') | lib/src/prism/components/prism-handlebars.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698