Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InsertBefore: Ignore duplicates #1628

Merged
merged 5 commits into from
Dec 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions components/prism-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ var _ = _self.Prism = {
/**
* Insert a token before another token in a language literal
* As this needs to recreate the object (we cannot actually insert before keys in object literals),
* we cannot just provide an object, we need anobject and a key.
* we cannot just provide an object, we need an object and a key.
* @param inside The key (or language id) of the parent
* @param before The key to insert before.
* @param insert Object with the key/value pairs to insert
Expand All @@ -108,20 +108,20 @@ var _ = _self.Prism = {
var ret = {};

for (var token in grammar) {

if (grammar.hasOwnProperty(token)) {

if (token == before) {

for (var newToken in insert) {

if (insert.hasOwnProperty(newToken)) {
ret[newToken] = insert[newToken];
}
}
}

ret[token] = grammar[token];
// Do not insert token which also occur in insert. See #1525
if (!insert.hasOwnProperty(token)) {
ret[token] = grammar[token];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{} around the if.

}
}
}

Expand Down
2 changes: 1 addition & 1 deletion components/prism-core.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-csharp.min.js

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

1 change: 0 additions & 1 deletion components/prism-jolie.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Prism.languages.jolie = Prism.languages.extend('clike', {
});

delete Prism.languages.jolie['class-name'];
delete Prism.languages.jolie['function'];

Prism.languages.insertBefore( 'jolie', 'keyword', {
'function':
Expand Down
Loading