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

Fix quotechar usage #64

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 6 additions & 5 deletions tasks/html2js.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ module.exports = function(grunt) {

var counter = 0;
var target = this.target;
var quoteChar = options.quoteChar;

// generate a separate module
this.files.forEach(function(f) {

Expand All @@ -158,7 +160,7 @@ module.exports = function(grunt) {
if (grunt.util.kindOf(options.rename) === 'function') {
moduleName = options.rename(moduleName);
}
moduleNames.push("'" + moduleName + "'");
moduleNames.push(quoteChar + moduleName + quoteChar);
if (options.target === 'js') {
return compileTemplate(moduleName, filepath, options);
} else if (options.target === 'coffee') {
Expand All @@ -177,7 +179,6 @@ module.exports = function(grunt) {
var bundle = "";
var targetModule = f.module || options.module;
var indentString = options.indentString;
var quoteChar = options.quoteChar;
var strict = (options.useStrict) ? indentString + quoteChar + 'use strict' + quoteChar + ';\n' : '';
// If options.module is a function, use that to get the targetModule
if (grunt.util.kindOf(targetModule) === 'function') {
Expand All @@ -190,15 +191,15 @@ module.exports = function(grunt) {

if (options.singleModule) {
if (options.target === 'js') {
bundle = "angular.module('" + targetModule + "', []).run(['$templateCache', function($templateCache) {\n" + strict;
bundle = "angular.module(" + quoteChar + targetModule + quoteChar + ", []).run([" + quoteChar + "$templateCache" + quoteChar + ", function($templateCache) {\n" + strict;
modules += '\n}]);\n';
} else if (options.target === 'coffee') {
bundle = "angular.module('" + targetModule + "', []).run(['$templateCache', ($templateCache) ->\n";
bundle = "angular.module(" + quoteChar + targetModule + quoteChar + ", []).run([" + quoteChar + "$templateCache" + quoteChar + ", ($templateCache) ->\n";
modules += '\n])\n';
}
} else if (targetModule) {
//Allow a 'no targetModule if module is null' option
bundle = "angular.module('" + targetModule + "', [" + moduleNames.join(', ') + "])";
bundle = "angular.module(" + quoteChar + targetModule + quoteChar + ", [" + moduleNames.join(', ') + "])";
if (options.target === 'js') {
bundle += ';';
}
Expand Down
2 changes: 1 addition & 1 deletion test/expected/coffee.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-coffee', ['../test/fixtures/one.tpl.html', '../test/fixtures/two.tpl.html'])
angular.module("templates-coffee", ["../test/fixtures/one.tpl.html", "../test/fixtures/two.tpl.html"])

angular.module("../test/fixtures/one.tpl.html", []).run(["$templateCache", ($templateCache) ->
$templateCache.put("../test/fixtures/one.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/compact_format_custom_options.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('my-custom-template-module', ['fixtures/one.tpl.html', 'fixtures/two.tpl.html']);
angular.module("my-custom-template-module", ["fixtures/one.tpl.html", "fixtures/two.tpl.html"]);

angular.module("fixtures/one.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("fixtures/one.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/compact_format_default_options.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-compact_format_default_options', ['../test/fixtures/one.tpl.html', '../test/fixtures/two.tpl.html']);
angular.module("templates-compact_format_default_options", ["../test/fixtures/one.tpl.html", "../test/fixtures/two.tpl.html"]);

angular.module("../test/fixtures/one.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/one.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/double_quotes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-double_quotes', ['../test/fixtures/four.tpl.html']);
angular.module("templates-double_quotes", ["../test/fixtures/four.tpl.html"]);

angular.module("../test/fixtures/four.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/four.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/empty_attribute.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-empty_attribute', ['../test/fixtures/empty_attribute.tpl.html']);
angular.module("templates-empty_attribute", ["../test/fixtures/empty_attribute.tpl.html"]);

angular.module("../test/fixtures/empty_attribute.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/empty_attribute.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/file_header.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global angular: false */

angular.module('templates-file_header', ['../test/fixtures/three.tpl.html']);
angular.module("templates-file_header", ["../test/fixtures/three.tpl.html"]);

angular.module("../test/fixtures/three.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/three.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/files_array_custom_options_1.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('my-custom-templates', ['fixtures/one.tpl.html']);
angular.module("my-custom-templates", ["fixtures/one.tpl.html"]);

angular.module("fixtures/one.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("fixtures/one.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/files_array_custom_options_2.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('my-custom-templates', ['fixtures/two.tpl.html']);
angular.module("my-custom-templates", ["fixtures/two.tpl.html"]);

angular.module("fixtures/two.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("fixtures/two.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/files_array_default_options_1.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-files_array_default_options', ['../test/fixtures/one.tpl.html']);
angular.module("templates-files_array_default_options", ["../test/fixtures/one.tpl.html"]);

angular.module("../test/fixtures/one.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/one.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/files_array_default_options_2.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-files_array_default_options', ['../test/fixtures/two.tpl.html']);
angular.module("templates-files_array_default_options", ["../test/fixtures/two.tpl.html"]);

angular.module("../test/fixtures/two.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/two.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/files_object_custom_options_1.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('my-custom-template-module', ['fixtures/one.tpl.html']);
angular.module("my-custom-template-module", ["fixtures/one.tpl.html"]);

angular.module("fixtures/one.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("fixtures/one.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/files_object_custom_options_2.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('my-custom-template-module', ['fixtures/two.tpl.html']);
angular.module("my-custom-template-module", ["fixtures/two.tpl.html"]);

angular.module("fixtures/two.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("fixtures/two.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/files_object_default_options_1.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-files_object_default_options', ['../test/fixtures/one.tpl.html']);
angular.module("templates-files_object_default_options", ["../test/fixtures/one.tpl.html"]);

angular.module("../test/fixtures/one.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/one.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/files_object_default_options_2.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-files_object_default_options', ['../test/fixtures/two.tpl.html']);
angular.module("templates-files_object_default_options", ["../test/fixtures/two.tpl.html"]);

angular.module("../test/fixtures/two.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/two.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/htmlmin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-htmlmin', ['../test/fixtures/five.tpl.html']);
angular.module("templates-htmlmin", ["../test/fixtures/five.tpl.html"]);

angular.module("../test/fixtures/five.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/five.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/module_as_function.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('NAME_FROM_FUNCTION', ['../test/fixtures/one.tpl.html', '../test/fixtures/two.tpl.html']);
angular.module("NAME_FROM_FUNCTION", ["../test/fixtures/one.tpl.html", "../test/fixtures/two.tpl.html"]);

angular.module("../test/fixtures/one.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/one.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/multi_lines.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-multi_lines', ['../test/fixtures/three.tpl.html']);
angular.module("templates-multi_lines", ["../test/fixtures/three.tpl.html"]);

angular.module("../test/fixtures/three.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/three.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/multi_lines_4spaces.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-multi_lines_4space', ['../test/fixtures/three.tpl.html']);
angular.module("templates-multi_lines_4space", ["../test/fixtures/three.tpl.html"]);

angular.module("../test/fixtures/three.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/three.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/multi_lines_tabs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-multi_lines_tabs', ['../test/fixtures/three.tpl.html']);
angular.module("templates-multi_lines_tabs", ["../test/fixtures/three.tpl.html"]);

angular.module("../test/fixtures/three.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/three.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/process_function.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-process_function', ['../test/fixtures/process_function.tpl.html']);
angular.module("templates-process_function", ["../test/fixtures/process_function.tpl.html"]);

angular.module("../test/fixtures/process_function.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/process_function.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/process_jade.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-process_jade', ['../test/fixtures/process_jade.jade']);
angular.module("templates-process_jade", ["../test/fixtures/process_jade.jade"]);

angular.module("../test/fixtures/process_jade.jade", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/process_jade.jade",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/process_jade_custom.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-process_jade_custom', ['../test/fixtures/process_jade_custom.jade']);
angular.module("templates-process_jade_custom", ["../test/fixtures/process_jade_custom.jade"]);

angular.module("../test/fixtures/process_jade_custom.jade", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/process_jade_custom.jade",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/process_jade_with_include.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-process_jade_with_include', ['../test/fixtures/process_jade_with_include.jade']);
angular.module("templates-process_jade_with_include", ["../test/fixtures/process_jade_with_include.jade"]);

angular.module("../test/fixtures/process_jade_with_include.jade", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/process_jade_with_include.jade",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/process_template.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-process_template', ['../test/fixtures/process_template.tpl.html']);
angular.module("templates-process_template", ["../test/fixtures/process_template.tpl.html"]);

angular.module("../test/fixtures/process_template.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/process_template.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/regex_in_template.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-regex_in_template', ['../test/fixtures/pattern.tpl.html']);
angular.module("templates-regex_in_template", ["../test/fixtures/pattern.tpl.html"]);

angular.module("../test/fixtures/pattern.tpl.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/pattern.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/rename.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-rename', ['../test/fixtures/one.tpl', '../test/fixtures/two.tpl']);
angular.module("templates-rename", ["../test/fixtures/one.tpl", "../test/fixtures/two.tpl"]);

angular.module("../test/fixtures/one.tpl", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/one.tpl",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/single_module.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-single_module_coffee', []).run(['$templateCache', ($templateCache) ->
angular.module("templates-single_module_coffee", []).run(["$templateCache", ($templateCache) ->
$templateCache.put("../test/fixtures/one.tpl.html",
"1 2 3")
$templateCache.put("../test/fixtures/three.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/single_module.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-single_module', []).run(['$templateCache', function($templateCache) {
angular.module("templates-single_module", []).run(["$templateCache", function($templateCache) {
$templateCache.put("../test/fixtures/one.tpl.html",
"1 2 3");
$templateCache.put("../test/fixtures/three.tpl.html",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/strict_mode.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module('templates-strict_mode', ['../test/fixtures/one.tpl.html']);
angular.module("templates-strict_mode", ["../test/fixtures/one.tpl.html"]);

angular.module("../test/fixtures/one.tpl.html", []).run(["$templateCache", function($templateCache) {
"use strict";
Expand Down