Skip to content

Commit

Permalink
MDL-58760 templates: Make {{#pix}} helper work with escaped icon key
Browse files Browse the repository at this point in the history
There is a difference between how our PHP mustache engine and JS
mustache engine escaping works. If the icon key is not hard-coded in the
template but defined as a context variable, the JS mustache engine
escapes the forward slashes.
  • Loading branch information
mudrd8mz committed Apr 28, 2017
1 parent 5ccddd2 commit 74e238f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/amd/build/templates.min.js

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

4 changes: 4 additions & 0 deletions lib/amd/src/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ define(['core/mustache',
var searchKey = this.currentThemeName + '/' + templateName;
var template = templateCache[searchKey];

// The key might have been escaped by the JS Mustache engine which
// converts forward slashes to HTML entities. Let us undo that here.
key = key.replace(///gi, '/');

return iconSystem.renderIcon(key, component, text, template);
};

Expand Down

0 comments on commit 74e238f

Please sign in to comment.