mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Avoid escaping existing non-ascii characters in templates. [closes #278]
Former-commit-id: a56581f3e323c0c47e4f26ef8dce13e90fb6c15c
This commit is contained in:
@@ -375,6 +375,7 @@
|
||||
isAdvanced = mode == 'advanced',
|
||||
isMapped = this.isMapped,
|
||||
isSilent = this.isSilent,
|
||||
isTemplate = this.isTemplate,
|
||||
options = closureOptions.slice(),
|
||||
outputPath = this.outputPath,
|
||||
mapPath = getMapPath(outputPath),
|
||||
@@ -400,6 +401,9 @@
|
||||
if (isMapped) {
|
||||
options.push('--create_source_map=' + mapPath, '--source_map_format=V3');
|
||||
}
|
||||
if (isTemplate) {
|
||||
options.push('--charset=UTF-8');
|
||||
}
|
||||
|
||||
getJavaOptions(function(javaOptions) {
|
||||
var compiler = cp.spawn('java', javaOptions.concat('-jar', closurePath, options));
|
||||
@@ -497,7 +501,7 @@
|
||||
// 4. output
|
||||
// restrict lines to 500 characters for consistency with the Closure Compiler
|
||||
var stream = uglifyJS.OutputStream({
|
||||
'ascii_only': true,
|
||||
'ascii_only': !this.isTemplate,
|
||||
'comments': /@cc_on|@license|@preserve/i,
|
||||
'max_line_len': 500,
|
||||
});
|
||||
|
||||
@@ -1 +1 @@
|
||||
Hello {{ name }}!
|
||||
Hallå {{ name }}!
|
||||
@@ -652,7 +652,7 @@
|
||||
vm.runInContext(data.source, context);
|
||||
|
||||
equal(moduleId, expectedId, basename);
|
||||
equal(_.templates.d(object.d), 'Hello Mustache!', basename);
|
||||
equal(_.templates.d(object.d), 'Hallå Mustache!', basename);
|
||||
delete _.templates;
|
||||
start();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user