From 82d90a409692e97a79c3bf4708ee80796c7de2d6 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Fri, 6 Apr 2012 16:35:17 -0700 Subject: fix(docs): change all directive references to use the normalized names --- docs/src/ngdoc.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'docs/src') diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index 4dd3dcc0..70411052 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -372,10 +372,10 @@ Doc.prototype = { dom.text(')'); dom.code(function() { dom.text('<'); - dom.text(self.shortName); + dom.text(dashCase(self.shortName)); renderParams('\n ', '="', '"'); dom.text('>\n'); }); } @@ -384,7 +384,7 @@ Doc.prototype = { dom.text('as attribute'); dom.code(function() { dom.text('<' + element + ' '); - dom.text(self.shortName); + dom.text(dashCase(self.shortName)); renderParams('\n ', '="', '"', true); dom.text('>\n ...\n'); dom.text(''); @@ -395,7 +395,7 @@ Doc.prototype = { var element = self.element || 'ANY'; dom.code(function() { dom.text('<' + element + ' class="'); - dom.text(self.shortName); + dom.text(dashCase(self.shortName)); renderParams(' ', ': ', ';', true); dom.text('">\n ...\n'); dom.text(''); @@ -467,7 +467,7 @@ Doc.prototype = { (self.param||[]).forEach(function(param){ dom.text('\n '); dom.text(param.optional ? ' [' : ' '); - dom.text(param.name); + dom.text(dashCase(param.name)); dom.text(BOOLEAN_ATTR[param.name] ? '' : '="{' + param.type + '}"'); dom.text(param.optional ? ']' : ''); }); @@ -822,3 +822,11 @@ function property(name) { return value[name]; }; } + + +var DASH_CASE_REGEXP = /[A-Z]/g; +function dashCase(name){ + return name.replace(DASH_CASE_REGEXP, function(letter, pos) { + return (pos ? '-' : '') + letter.toLowerCase(); + }); +} -- cgit v1.2.3