Skip to content

Commit

Permalink
Inlined some unnecessary rest properties (PrismJS#2082)
Browse files Browse the repository at this point in the history
This inlines a few unnecessary `rest` properties.
  • Loading branch information
RunDevelopment authored and Edward Porter committed Oct 17, 2019
1 parent b08bc92 commit a145ecb
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 64 deletions.
6 changes: 2 additions & 4 deletions components/prism-actionscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ if (Prism.languages.markup) {
'xml': {
pattern: /(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,
lookbehind: true,
inside: {
rest: Prism.languages.markup
}
inside: Prism.languages.markup
}
});
}
}
2 changes: 1 addition & 1 deletion components/prism-actionscript.min.js

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

26 changes: 7 additions & 19 deletions components/prism-haml.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,12 @@
{
pattern: /((?:^|\r?\n|\r)([\t ]*)(?:[~-]|[&!]?=)).*,[\t ]*(?:(?:\r?\n|\r)\2[\t ]+.*,[\t ]*)*(?:(?:\r?\n|\r)\2[\t ]+.+)/,
lookbehind: true,
inside: {
rest: Prism.languages.ruby
}
inside: Prism.languages.ruby
},
{
pattern: /((?:^|\r?\n|\r)([\t ]*)(?:[~-]|[&!]?=)).*\|[\t ]*(?:(?:\r?\n|\r)\2[\t ]+.*\|[\t ]*)*/,
lookbehind: true,
inside: {
rest: Prism.languages.ruby
}
inside: Prism.languages.ruby
}
],

Expand All @@ -48,9 +44,7 @@
'markup': {
pattern: /((?:^|\r?\n|\r)[\t ]*)<.+/,
lookbehind: true,
inside: {
rest: Prism.languages.markup
}
inside: Prism.languages.markup
},
'doctype': {
pattern: /((?:^|\r?\n|\r)[\t ]*)!!!(?: .+)?/,
Expand All @@ -67,9 +61,7 @@
// Allows for one nested group of braces
pattern: /(^|[^#])\{(?:\{[^}]+\}|[^}])+\}/,
lookbehind: true,
inside: {
rest: Prism.languages.ruby
}
inside: Prism.languages.ruby
},
{
pattern: /\([^)]+\)/,
Expand All @@ -84,9 +76,7 @@
},
{
pattern: /\[[^\]]+\]/,
inside: {
rest: Prism.languages.ruby
}
inside: Prism.languages.ruby
}
],
'punctuation': /[<>]/
Expand All @@ -95,9 +85,7 @@
'code': {
pattern: /((?:^|\r?\n|\r)[\t ]*(?:[~-]|[&!]?=)).+/,
lookbehind: true,
inside: {
rest: Prism.languages.ruby
}
inside: Prism.languages.ruby
},
// Interpolations in plain text
'interpolation': {
Expand Down Expand Up @@ -151,4 +139,4 @@

Prism.languages.insertBefore('haml', 'filter', all_filters);

}(Prism));
}(Prism));
2 changes: 1 addition & 1 deletion components/prism-haml.min.js

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

4 changes: 1 addition & 3 deletions components/prism-http.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@
options[contentType] = {
pattern: RegExp('(content-type:\\s*' + pattern + '[\\s\\S]*?)(?:\\r?\\n|\\r){2}[\\s\\S]*', 'i'),
lookbehind: true,
inside: {
rest: httpLanguages[contentType]
}
inside: httpLanguages[contentType]
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/prism-http.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-kotlin.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
{
pattern: /\$\{[^}]+\}/,
inside: {
delimiter: {
'delimiter': {
pattern: /^\$\{|\}$/,
alias: 'variable'
},
Expand Down
4 changes: 1 addition & 3 deletions components/prism-php.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@
var string_interpolation = {
pattern: /{\$(?:{(?:{[^{}]+}|[^{}]+)}|[^{}])+}|(^|[^\\{])\$+(?:\w+(?:\[.+?]|->\w+)*)/,
lookbehind: true,
inside: {
rest: Prism.languages.php
}
inside: Prism.languages.php
};

Prism.languages.insertBefore('php', 'string', {
Expand Down
2 changes: 1 addition & 1 deletion components/prism-php.min.js

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

26 changes: 7 additions & 19 deletions components/prism-pug.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
'multiline-script': {
pattern: /(^([\t ]*)script\b.*\.[\t ]*)(?:(?:\r?\n|\r(?!\n))(?:\2[\t ]+.+|\s*?(?=\r?\n|\r)))+/m,
lookbehind: true,
inside: {
rest: Prism.languages.javascript
}
inside: Prism.languages.javascript
},

// See at the end of the file for known filters
Expand All @@ -46,9 +44,7 @@
'markup': {
pattern: /(^[\t ]*)<.+/m,
lookbehind: true,
inside: {
rest: Prism.languages.markup
}
inside: Prism.languages.markup
},
'doctype': {
pattern: /((?:^|\n)[\t ]*)doctype(?: .+)?/,
Expand Down Expand Up @@ -98,16 +94,14 @@
pattern: /^\+\w+/,
alias: 'function'
},
'rest': Prism.languages.javascript
rest: Prism.languages.javascript
}
}
],
'script': {
pattern: /(^[\t ]*script(?:(?:&[^(]+)?\([^)]+\))*[\t ]+).+/m,
lookbehind: true,
inside: {
rest: Prism.languages.javascript
}
inside: Prism.languages.javascript
},

'plain-text': {
Expand All @@ -121,19 +115,15 @@
'attributes': [
{
pattern: /&[^(]+\([^)]+\)/,
inside: {
rest: Prism.languages.javascript
}
inside: Prism.languages.javascript
},
{
pattern: /\([^)]+\)/,
inside: {
'attr-value': {
pattern: /(=\s*)(?:\{[^}]*\}|[^,)\r\n]+)/,
lookbehind: true,
inside: {
rest: Prism.languages.javascript
}
inside: Prism.languages.javascript
},
'attr-name': /[\w-]+(?=\s*!?=|\s*[,)])/,
'punctuation': /[!=(),]+/
Expand All @@ -147,9 +137,7 @@
{
pattern: /(^[\t ]*(?:-|!?=)).+/m,
lookbehind: true,
inside: {
rest: Prism.languages.javascript
}
inside: Prism.languages.javascript
}
],
'punctuation': /[.\-!=|]+/
Expand Down
Loading

0 comments on commit a145ecb

Please sign in to comment.