Skip to content

Commit

Permalink
Fix order of decoding entities in groovy (#1049) (#1050)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob--W authored and Golmote committed Nov 9, 2016
1 parent 8b0520a commit d75da8e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/prism-groovy.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Prism.hooks.add('wrap', function(env) {
}

// To prevent double HTML-encoding we have to decode env.content first
env.content = env.content.replace(/&amp;/g, '&').replace(/&lt;/g, '<');
env.content = env.content.replace(/&lt;/g, '<').replace(/&amp;/g, '&');

env.content = Prism.highlight(env.content, {
'expression': {
Expand Down
2 changes: 1 addition & 1 deletion components/prism-groovy.min.js

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

8 changes: 8 additions & 0 deletions tests/languages/groovy/issue1049.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
'"&amp;"': '<span class="token string gstring">"&amp;amp;"</span>',
'"&amp;&amp;"': '<span class="token string gstring">"&amp;amp;&amp;amp;"</span>',
'"&lt;"': '<span class="token string gstring">"&amp;lt;"</span>',
'"&lt;&lt;"': '<span class="token string gstring">"&amp;lt;&amp;lt;"</span>',
'"&amp;lt;"': '<span class="token string gstring">"&amp;amp;lt;"</span>',
'"&gt;"': '<span class="token string gstring">"&amp;gt;"</span>',
};

0 comments on commit d75da8e

Please sign in to comment.