Skip to content

Commit

Permalink
Handlebars: Regexp optimisation + don't use captures if not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Golmote committed Oct 22, 2017
1 parent 23e3b43 commit 09dbfce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions components/prism-handlebars.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(function(Prism) {

var handlebars_pattern = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g;
var handlebars_pattern = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/;

Prism.languages.handlebars = Prism.languages.extend('markup', {
'handlebars': {
Expand All @@ -10,9 +10,9 @@
pattern: /^\{\{\{?|\}\}\}?$/i,
alias: 'punctuation'
},
'string': /(["'])(\\?.)*?\1/,
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?)\b/,
'boolean': /\b(true|false)\b/,
'string': /(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,
'number': /\b-?(?:0x[\dA-Fa-f]+|\d*\.?\d+(?:[Ee][+-]?\d+)?)\b/,
'boolean': /\b(?:true|false)\b/,
'block': {
pattern: /^(\s*~?\s*)[#\/]\S+?(?=\s*~?\s*$|\s)/i,
lookbehind: true,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-handlebars.min.js

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

0 comments on commit 09dbfce

Please sign in to comment.