diff options
Diffstat (limited to 'docs/src/ngdoc.js')
| -rw-r--r-- | docs/src/ngdoc.js | 93 |
1 files changed, 44 insertions, 49 deletions
diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index fc606d54..4fdfe21d 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -365,15 +365,50 @@ Doc.prototype = { html_usage_directive: function(dom){ var self = this; dom.h('Usage', function() { - dom.tag('pre', {'class':"brush: js; html-script: true;"}, function() { - dom.text('<' + self.element + ' '); - dom.text(self.shortName); - if (self.param.length) { - dom.text('="' + self.param[0].name + '"'); - } - dom.text('>\n ...\n'); - dom.text('</' + self.element + '>'); - }); + var restrict = self.restrict || 'AC'; + if (restrict.match(/E/)) { + dom.text('as element'); + dom.code(function() { + dom.text('<'); + dom.text(self.shortName); + (self.param||[]).forEach(function(param){ + dom.text('\n '); + dom.text(param.optional ? ' [' : ' '); + dom.text(param.name); + dom.text(BOOLEAN_ATTR[param.name] ? '' : '="..."'); + dom.text(param.optional ? ']' : ''); + }); + dom.text('></'); + dom.text(self.shortName); + dom.text('>'); + }); + } + if (restrict.match(/A/)) { + var element = self.element || 'ANY' + dom.text('as attribute'); + dom.code(function() { + dom.text('<' + element + ' '); + dom.text(self.shortName); + if (self.param.length) { + dom.text('="' + self.param[0].name + '"'); + } + dom.text('>\n ...\n'); + dom.text('</' + element + '>'); + }); + } + if (restrict.match(/C/)) { + dom.text('as class'); + var element = self.element || 'ANY' + dom.code(function() { + dom.text('<' + element + ' class="'); + dom.text(self.shortName); + if (self.param.length) { + dom.text(': ' + self.param[0].name + ';'); + } + dom.text('">\n ...\n'); + dom.text('</' + element + '>'); + }); + } self.html_usage_directiveInfo(dom); self.html_usage_parameters(dom); }); @@ -427,46 +462,6 @@ Doc.prototype = { }); }, - html_usage_widget: function(dom){ - var self = this; - dom.h('Usage', function() { - dom.h('In HTML Template Binding', function() { - dom.code(function() { - if (self.shortName.match(/^@/)) { - dom.text('<'); - dom.text(self.element); - dom.text(' '); - dom.text(self.shortName.substring(1)); - if (self.param.length) { - dom.text('="'); - dom.text(self.param[0].name); - dom.text('"'); - } - dom.text('>\n ...\n</'); - dom.text(self.element); - dom.text('>'); - } else { - dom.text('<'); - dom.text(self.shortName); - (self.param||[]).forEach(function(param){ - dom.text('\n '); - dom.text(param.optional ? ' [' : ' '); - dom.text(param.name); - dom.text(BOOLEAN_ATTR[param.name] ? '' : '="..."'); - dom.text(param.optional ? ']' : ''); - }); - dom.text('></'); - dom.text(self.shortName); - dom.text('>'); - } - }); - }); - - self.html_usage_directiveInfo(dom); - self.html_usage_parameters(dom); - }); - }, - html_usage_directiveInfo: function(dom) { var self = this; var list = []; |
