From 6c796cb27c88dce90d2e7f852b707e25e9acd3d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bonjour?= Date: Mon, 17 Mar 2014 18:06:17 +0100 Subject: [PATCH 1/3] Improve filter documentation rendering. If parameters are defined for the filter, use the first one as the input expression in the example. --- index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 157d2c2..5794749 100644 --- a/index.js +++ b/index.js @@ -344,8 +344,13 @@ module.exports = { dom.text(self.usage); } else { dom.text('{{ '); - dom.text(self.shortName); - dom.text('_expression | '); + if (self.param && self.param.length) { + dom.text(self.param[0].name); + dom.text(' | '); + } else { + dom.text(self.shortName); + dom.text('_expression | '); + } dom.text(self.shortName); //let's use the inherited parameterParse from the default api @@ -438,4 +443,4 @@ module.exports = { } -}; \ No newline at end of file +}; From 3898a75fa8150962b9cb27a95373e33cb10a8ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bonjour?= Date: Mon, 17 Mar 2014 18:10:23 +0100 Subject: [PATCH 2/3] Improve directive documentation rendering. Do not use `shortName` in the example but the last part of the `id`. This allows human-readable names in the directives list (left column) while still having correct examples. --- index.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 5794749..7d55e78 100644 --- a/index.js +++ b/index.js @@ -265,6 +265,11 @@ module.exports = { directive: function(dom){ var self = this; var htmlMethods = self.doc_api_extensions.html; + var id = self.id, + p = id.indexOf(':'); + if (p !== -1) { + id = id.substr(p+1); + } dom.h('Usage', function() { var restrict = self.restrict || 'AC'; @@ -275,10 +280,10 @@ module.exports = { dom.text(')'); dom.code(function() { dom.text('<'); - dom.text(dashCase(self.shortName)); + dom.text(dashCase(id)); renderParams('\n '+prefix, '="', '"'); dom.text('>\n'); }); } @@ -287,7 +292,7 @@ module.exports = { dom.text('as attribute'); dom.code(function() { dom.text('<' + element + ' '); - dom.text(prefix+dashCase(self.shortName)); + dom.text(prefix+dashCase(id)); renderParams('\n '+prefix, '="', '"', true); dom.text('>\n ...\n'); dom.text(''); @@ -298,7 +303,7 @@ module.exports = { var element = self.element || 'ANY'; dom.code(function() { dom.text('<' + element + ' class="'); - dom.text(dashCase(self.shortName)); + dom.text(dashCase(id)); renderParams(' ', ': ', ';', true); dom.text('">\n ...\n'); dom.text(''); From 8dbd893dbc64b7ef90c9c686526b7e50018ebe43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fre=CC=81de=CC=81ric=20Bonjour?= Date: Tue, 18 Mar 2014 15:25:21 +0100 Subject: [PATCH 3/3] Add possibility to define the `startSymbol` and `endSymbol` used in Angular templates. --- index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 7d55e78..9e04daa 100644 --- a/index.js +++ b/index.js @@ -3,6 +3,7 @@ /*=========== DEPENDENCIES =============*/ var Example = require('./resources/example.js').Example; +var grunt = require('grunt'); /*=========== PRIVATE VARIABLES AND METHODS ===========*/ @@ -342,13 +343,17 @@ module.exports = { filter: function(dom){ var self = this; var htmlMethods = self.doc_api_extensions.html; + var config = grunt.config('docular'); + var startSymbol = config['angularStartSymbol'] || '{{'; + var endSymbol = config['angularEndSymbol'] || '{{'; + dom.h('Usage', function() { dom.h('In HTML Template Binding', function() { dom.tag('code', function() { if (self.usage) { dom.text(self.usage); } else { - dom.text('{{ '); + dom.text(startSymbol+' '); if (self.param && self.param.length) { dom.text(self.param[0].name); dom.text(' | '); @@ -361,7 +366,7 @@ module.exports = { //let's use the inherited parameterParse from the default api htmlMethods.parameterParse.call(self, dom, ':', true); - dom.text(' }}'); + dom.text(' '+endSymbol); } }); });