replace smart-quotes with regular quotes

This commit is contained in:
Misko Hevery 2011-02-18 13:19:59 -08:00
parent 7d4aee31bb
commit fd6e5e3f31
3 changed files with 11 additions and 2 deletions

View file

@ -64,6 +64,11 @@ function download(name, url) {
// strip out all text annotations
data = data.replace(/\[\w{1,3}\]/mg, '');
// fix smart-quotes
data = data.replace(/[“”]/g, '"');
data = data.replace(/[]/g, "'");
data = data + '\n';
fs.writeFileSync('docs/' + name, reflow(data, 100));
}

View file

@ -92,7 +92,7 @@ function angularServiceInject(name, fn, inject, eager) {
* extracting all arguments which start with $ or end with _ as the
* injection names.
*/
var FN_ARGS = /^function [^\(]*\(([^\)]*)\)/;
var FN_ARGS = /^function\s*[^\(]*\(([^\)]*)\)/;
var FN_ARG_SPLIT = /,/;
var FN_ARG = /^\s*(((\$?).+?)(_?))\s*$/;
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;

View file

@ -65,11 +65,15 @@ describe('injector', function(){
fn.$inject = ['a'];
expect(injectionArgs(fn)).toBe(fn.$inject);
expect(injectionArgs(function(){})).toEqual([]);
expect(injectionArgs(function (){})).toEqual([]);
expect(injectionArgs(function (){})).toEqual([]);
expect(injectionArgs(function /* */ (){})).toEqual([]);
});
it('should create $inject', function(){
// keep the multi-line to make sure we can handle it
function $f_n0(
function $f_n0 /*
*/(
$a, // x, <-- looks like an arg but it is a comment
b_, /* z, <-- looks like an arg but it is a
multi-line comment