diff options
Diffstat (limited to 'docs/src')
| -rw-r--r-- | docs/src/ngdoc.js | 18 |
1 files changed, 13 insertions, 5 deletions
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</'); - dom.text(self.shortName); + dom.text(dashCase(self.shortName)); dom.text('>'); }); } @@ -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('</' + element + '>'); @@ -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('</' + element + '>'); @@ -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(); + }); +} |
