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