Skip to content

Commit

Permalink
Pug: 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 3e256d8 commit 76dc925
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions components/prism-pug.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

// This handles both single-line and multi-line comments
'comment': {
pattern: /(^([\t ]*))\/\/.*((?:\r?\n|\r)\2[\t ]+.+)*/m,
pattern: /(^([\t ]*))\/\/.*(?:(?:\r?\n|\r)\2[\t ]+.+)*/m,
lookbehind: true
},

// All the tag-related part is in lookbehind
// so that it can be highlighted by the "tag" pattern
'multiline-script': {
pattern: /(^([\t ]*)script\b.*\.[\t ]*)((?:\r?\n|\r(?!\n))(?:\2[\t ]+.+|\s*?(?=\r?\n|\r)))+/m,
pattern: /(^([\t ]*)script\b.*\.[\t ]*)(?:(?:\r?\n|\r(?!\n))(?:\2[\t ]+.+|\s*?(?=\r?\n|\r)))+/m,
lookbehind: true,
inside: {
rest: Prism.languages.javascript
Expand All @@ -29,7 +29,7 @@

// See at the end of the file for known filters
'filter': {
pattern: /(^([\t ]*)):.+((?:\r?\n|\r(?!\n))(?:\2[\t ]+.+|\s*?(?=\r?\n|\r)))+/m,
pattern: /(^([\t ]*)):.+(?:(?:\r?\n|\r(?!\n))(?:\2[\t ]+.+|\s*?(?=\r?\n|\r)))+/m,
lookbehind: true,
inside: {
'filter-name': {
Expand All @@ -40,7 +40,7 @@
},

'multiline-plain-text': {
pattern: /(^([\t ]*)[\w\-#.]+\.[\t ]*)((?:\r?\n|\r(?!\n))(?:\2[\t ]+.+|\s*?(?=\r?\n|\r)))+/m,
pattern: /(^([\t ]*)[\w\-#.]+\.[\t ]*)(?:(?:\r?\n|\r(?!\n))(?:\2[\t ]+.+|\s*?(?=\r?\n|\r)))+/m,
lookbehind: true
},
'markup': {
Expand Down Expand Up @@ -155,7 +155,7 @@
'punctuation': /[.\-!=|]+/
};

var filter_pattern = '(^([\\t ]*)):{{filter_name}}((?:\\r?\\n|\\r(?!\\n))(?:\\2[\\t ]+.+|\\s*?(?=\\r?\\n|\\r)))+';
var filter_pattern = '(^([\\t ]*)):{{filter_name}}(?:(?:\\r?\\n|\\r(?!\\n))(?:\\2[\\t ]+.+|\\s*?(?=\\r?\\n|\\r)))+';

// Non exhaustive list of available filters and associated languages
var filters = [
Expand Down
2 changes: 1 addition & 1 deletion components/prism-pug.min.js

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

0 comments on commit 76dc925

Please sign in to comment.