Skip to content

Commit

Permalink
Rearrange the string and template-string token in JavaScript
Browse files Browse the repository at this point in the history
It is more likely that single and double quotes appear in
a template string, than backticks in a normal string. Fixes issue
#963.
  • Loading branch information
zeitgeist87 committed Jun 3, 2016
1 parent 0c4d8d7 commit 1158e46
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions components/prism-coffeescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,6 @@ Prism.languages.insertBefore('coffeescript', 'keyword', {
'property': /(?!\d)\w+(?=\s*:(?!:))/
});

delete Prism.languages.coffeescript['template-string'];

}(Prism));
2 changes: 1 addition & 1 deletion components/prism-coffeescript.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-javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Prism.languages.insertBefore('javascript', 'keyword', {
}
});

Prism.languages.insertBefore('javascript', 'class-name', {
Prism.languages.insertBefore('javascript', 'string', {
'template-string': {
pattern: /`(?:\\\\|\\?[^\\])*?`/,
greedy: true,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-javascript.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 prism.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ Prism.languages.insertBefore('javascript', 'keyword', {
}
});

Prism.languages.insertBefore('javascript', 'class-name', {
Prism.languages.insertBefore('javascript', 'string', {
'template-string': {
pattern: /`(?:\\\\|\\?[^\\])*?`/,
greedy: true,
Expand Down

0 comments on commit 1158e46

Please sign in to comment.