From 404c9a653a1e28de1c6dda996875d6616812313a Mon Sep 17 00:00:00 2001 From: Matias Niemelä Date: Tue, 7 May 2013 11:02:17 -0400 Subject: feat(ngdocs): add variable type hinting with colors --- docs/src/ngdoc.js | 85 ++++++++++++++++++++++++++++++----------- docs/src/templates/css/docs.css | 39 +++++++++++++++++++ 2 files changed, 101 insertions(+), 23 deletions(-) diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index f4187d47..3bcfb196 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -348,28 +348,59 @@ Doc.prototype = { }, + prepare_type_hint_class_name : function(type) { + var typeClass = type.toLowerCase().match(/^[-\w]+/) || []; + typeClass = typeClass[0] ? typeClass[0] : 'object'; + return 'label type-hint type-hint-' + typeClass; + }, + html_usage_parameters: function(dom) { - dom.h('Parameters', this.param, function(param){ - dom.tag('code', function() { - dom.text(param.name); - if (param.optional) { - dom.tag('i', function() { - dom.text('(optional'); - if(param['default']) { - dom.text('=' + param['default']); - } - dom.text(')'); - }); + var self = this; + var params = this.param ? this.param : []; + if(params.length > 0) { + dom.html('

Parameters

'); + dom.html(''); + dom.html(''); + dom.html(''); + dom.html(''); + dom.html(''); + dom.html(''); + dom.html(''); + dom.html(''); + dom.html(''); + for(var i=0;i)/); + var description = param.description; if (param.optional) { - dom.text('='); + name += '
(optional)
'; } - dom.text('} – '); - }); - dom.html(param.description); - }); + dom.html('
'); + dom.html(''); + dom.html(''); + dom.html(''); + dom.html(''); + }; + dom.html(''); + dom.html('
ParamTypeDetails
' + name + ''); + for(var j=0;j'); + dom.text(type); + dom.html(''); + } + dom.html('' + description + '
'); + } if(this.animations) { dom.h('Animations', this.animations, function(animations){ dom.html('