From a32930287adec0c95590d420ef87e0cc3e407274 Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Thu, 2 Jun 2011 12:56:24 +0200 Subject: [PATCH] jsdoc template: move src files into separate folder and make a groupTitle plugin. --- build/jsdoc-toolkit/app/plugins/grouptitle.js | 14 ++++++++++++++ build/jsdoc-toolkit/templates/jsdoc/publish.js | 8 ++++---- .../templates/jsdoc/{ => src}/Operator.js | 0 .../templates/jsdoc/{ => src}/Render.js | 13 ------------- .../templates/jsdoc/{ => src}/Symbol.js | 0 .../templates/jsdoc/{ => src}/Utils.js | 0 .../templates/jsdoc/templates/constructor.tmpl | 2 +- .../templates/jsdoc/templates/method.tmpl | 4 ++-- .../templates/jsdoc/templates/property.tmpl | 4 ++-- 9 files changed, 23 insertions(+), 22 deletions(-) create mode 100644 build/jsdoc-toolkit/app/plugins/grouptitle.js rename build/jsdoc-toolkit/templates/jsdoc/{ => src}/Operator.js (100%) rename build/jsdoc-toolkit/templates/jsdoc/{ => src}/Render.js (96%) rename build/jsdoc-toolkit/templates/jsdoc/{ => src}/Symbol.js (100%) rename build/jsdoc-toolkit/templates/jsdoc/{ => src}/Utils.js (100%) diff --git a/build/jsdoc-toolkit/app/plugins/grouptitle.js b/build/jsdoc-toolkit/app/plugins/grouptitle.js new file mode 100644 index 00000000..7720907b --- /dev/null +++ b/build/jsdoc-toolkit/app/plugins/grouptitle.js @@ -0,0 +1,14 @@ +JSDOC.PluginManager.registerPlugin( + "JSDOC.grouptitle", + { + beanSymbols: {}, + onSymbol: function(symbol) { + var matches = symbol.desc.match(/\{@grouptitle ([^}]+)\}/), + groupTitle; + if (matches) { + symbol.groupTitle = matches[1]; + symbol.desc = symbol.desc.replace(/\{@grouptitle ([^}]+)\}/, ''); + } + } + } +); \ No newline at end of file diff --git a/build/jsdoc-toolkit/templates/jsdoc/publish.js b/build/jsdoc-toolkit/templates/jsdoc/publish.js index 419c99ee..cefa72bc 100644 --- a/build/jsdoc-toolkit/templates/jsdoc/publish.js +++ b/build/jsdoc-toolkit/templates/jsdoc/publish.js @@ -1,8 +1,8 @@ /** Called automatically by JsDoc Toolkit. */ -load(JSDOC.opt.t + 'Symbol.js'); -load(JSDOC.opt.t + 'Utils.js'); -load(JSDOC.opt.t + 'Operator.js'); -load(JSDOC.opt.t + 'Render.js'); +load(JSDOC.opt.t + 'src/Symbol.js'); +load(JSDOC.opt.t + 'src/Utils.js'); +load(JSDOC.opt.t + 'src/Operator.js'); +load(JSDOC.opt.t + 'src/Render.js'); function publish(symbolSet) { var renderMode = JSDOC.opt.D.renderMode; diff --git a/build/jsdoc-toolkit/templates/jsdoc/Operator.js b/build/jsdoc-toolkit/templates/jsdoc/src/Operator.js similarity index 100% rename from build/jsdoc-toolkit/templates/jsdoc/Operator.js rename to build/jsdoc-toolkit/templates/jsdoc/src/Operator.js diff --git a/build/jsdoc-toolkit/templates/jsdoc/Render.js b/build/jsdoc-toolkit/templates/jsdoc/src/Render.js similarity index 96% rename from build/jsdoc-toolkit/templates/jsdoc/Render.js rename to build/jsdoc-toolkit/templates/jsdoc/src/Render.js index 47b53ada..75de7355 100644 --- a/build/jsdoc-toolkit/templates/jsdoc/Render.js +++ b/build/jsdoc-toolkit/templates/jsdoc/src/Render.js @@ -24,16 +24,6 @@ var Render = new function() { templates[i] = new JSDOC.JsPlate(templatesDir + templates[i]); } - var processGroupTitle = function(symbol) { - var matches = symbol.desc.match(/\{@grouptitle ([^}]+)\}/), - groupTitle; - if (matches) { - groupTitle = matches[1]; - symbol.desc = symbol.desc.replace(/\{@grouptitle ([^}]+)\}/, ''); - } - return groupTitle; - }; - var processInlineTags = function(str, param) { if (!param) param = {}; @@ -183,7 +173,6 @@ var Render = new function() { constructor: function(symbol) { var param = { symbol: symbol, - groupTitle: processGroupTitle(symbol), id: symbol.getId(), name: symbol.alias.replace(/(#|\^).+$/, ''), description: processInlineTags(symbol.desc), @@ -209,7 +198,6 @@ var Render = new function() { name = symbol.memberOf + '.' + name; var param = { name: name, - groupTitle: processGroupTitle(symbol), id: symbol.getId(), signature: makeSignature(symbol.params), description: processInlineTags(symbol.desc), @@ -227,7 +215,6 @@ var Render = new function() { name = symbol.memberOf + '.' + name; var param = { name: name, - groupTitle: processGroupTitle(symbol), id: symbol.getId(), description: processInlineTags(symbol.desc), symbol: symbol diff --git a/build/jsdoc-toolkit/templates/jsdoc/Symbol.js b/build/jsdoc-toolkit/templates/jsdoc/src/Symbol.js similarity index 100% rename from build/jsdoc-toolkit/templates/jsdoc/Symbol.js rename to build/jsdoc-toolkit/templates/jsdoc/src/Symbol.js diff --git a/build/jsdoc-toolkit/templates/jsdoc/Utils.js b/build/jsdoc-toolkit/templates/jsdoc/src/Utils.js similarity index 100% rename from build/jsdoc-toolkit/templates/jsdoc/Utils.js rename to build/jsdoc-toolkit/templates/jsdoc/src/Utils.js diff --git a/build/jsdoc-toolkit/templates/jsdoc/templates/constructor.tmpl b/build/jsdoc-toolkit/templates/jsdoc/templates/constructor.tmpl index 0c4f861e..6261f011 100644 --- a/build/jsdoc-toolkit/templates/jsdoc/templates/constructor.tmpl +++ b/build/jsdoc-toolkit/templates/jsdoc/templates/constructor.tmpl @@ -1,4 +1,4 @@ -

{+data.symbol.groupTitle+}

+

{+data.symbol.groupTitle+}