Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed some absolute path issues, fixed some more multiline formatting…

… issues, fixed some formatting issues with missing fields, and added toctree generation
  • Loading branch information...
commit 278858ef0b6332fa9464e52fdaf46a71a1837c1a 1 parent a90832e
@jterrace authored
Showing with 50 additions and 24 deletions.
  1. +13 −19 class.tmpl
  2. +25 −5 publish.js
  3. +12 −0 toc.tmpl
View
32 class.tmpl
@@ -1,17 +1,13 @@
-{! var ownProperties = data.properties.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !}
+{! var ownProperties = data.properties.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !}
{! var ownMethods = data.methods.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !}
{! var ownEvents = data.events.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !}
-
{! var global = data; !}
+.. Classes and methods
-..
- Classes and methods
-
-{+ get_type(data) +}{+ data.alias +}
+{+ data.alias +}
================================================================================
-..
- class-title
+.. class-title
<if test="!data.isBuiltin() && (data.isNamespace || data.is('CONSTRUCTOR'))">
{+ data.desc +}
@@ -59,13 +55,13 @@ Constructor
<if test="data.params.length">
<for each="item" in="data.params">
:param {+ item.type +} {+ item.name +}:
- {+ item.desc +} <if test="item.defaultValue">(*Default*: {+item.defaultValue+})</if>
+{+ indentLines(item.desc, 8) +} <if test="item.defaultValue">(*Default*: {+item.defaultValue+})</if>
</for>
</if>
<if test="data.exceptions.length">
<for each="item" in="data.exceptions">
- :throws {+ item.type +}:
- {+ item.name +}: {+ item.desc +}
+ :throws<if test="item.type"> {+ item.type +}</if>:
+ <if test="item.name">{+ item.name +}: </if>{+ item.desc +}
</for>
</if>
<if test="data.returns.length">
@@ -81,8 +77,7 @@ Constructor
Methods
-------
-..
- class-methods
+.. class-methods
<for each="data" in="ownMethods">
@@ -90,14 +85,14 @@ Methods
<if test="data.params.length">
<for each="item" in="data.params">
- :param {+ item.type +} {+ item.name +}:
- {+ item.desc +} <if test="item.defaultValue">(*Default*: {+item.defaultValue+})</if>
+ :param<if test="item.type"> {+ item.type +}</if><if test="item.name"> {+ item.name +}</if>:
+{+ indentLines(item.desc, 8) +} <if test="item.defaultValue">(*Default*: {+item.defaultValue+})</if>
</for>
</if>
<if test="data.exceptions.length">
<for each="item" in="data.exceptions">
- :throws {+ item.type +}:
- {+ item.name +}: {+ item.desc +}
+ :throws<if test="item.type"> {+ item.type +}</if>:
+ <if test="item.name">{+ item.name +}: </if>{+ item.desc +}
</for>
</if>
<if test="data.returns.length">
@@ -146,8 +141,7 @@ Methods
Attributes
----------
-..
- class-attributes
+.. class-attributes
<for each="member" in="ownProperties">
{+ member.name +}
View
30 publish.js
@@ -80,8 +80,12 @@ function resolveLinks(str, from) {
return str;
}
-function publish(symbolSet) {
- var base = JSDOC.opt._[0];
+function publish(symbolSet) {
+ var base = JSDOC.opt._[0];
+ if (base.charAt(base.length-1) == '/') {
+ base = base.slice(0, -1);
+ }
+
publish.conf = { // trailing slash expected for dirs
ext: ".html", // ===> .rst
outDir: JSDOC.opt.d || SYS.pwd+"../out/jsdoc/",
@@ -95,7 +99,8 @@ function publish(symbolSet) {
// create the required templates
try {
var templates = {
- 'class': new JSDOC.JsPlate(publish.conf.templatesDir + "class.tmpl")
+ 'class': new JSDOC.JsPlate(publish.conf.templatesDir + "class.tmpl"),
+ 'toc': new JSDOC.JsPlate(publish.conf.templatesDir + "toc.tmpl")
}
}
catch(e) {
@@ -125,6 +130,8 @@ function publish(symbolSet) {
}
}
+ var tocnames = new Array();
+
// create each of the class pages
for (var i = 0, l = classes.length; i < l; i++) {
var symbol = classes[i];
@@ -138,11 +145,24 @@ function publish(symbolSet) {
var source = symbol.srcFile.replace(base, '').split('/').slice(0, -1).join('/');
var docdir = new File(dir + source);
docdir.mkdirs();
- var filename = ((JSDOC.opt.u) ? Link.filemap[symbol.alias] : symbol.alias) + '.rst';
+ var basename = ((JSDOC.opt.u) ? Link.filemap[symbol.alias] : symbol.alias);
+ var filename = basename + '.rst';
+
+ var tocname = source + '/' + basename;
+ if (tocname.charAt(0) == '/') {
+ tocname = tocname.slice(1);
+ }
+ tocnames.push(tocname);
IO.saveFile(docdir, filename, template);
}
-
+
+ tocnames.sort();
+ var symbols = {};
+ symbols.entries = tocnames;
+ template = templates['toc'].process(symbols);
+ IO.saveFile(publish.conf.outDir, 'toc.rst', template);
+
var base = JSDOC.opt._[0];
// get an array version of the symbolset, useful for filtering
var symbols = symbolSet.toArray();
View
12 toc.tmpl
@@ -0,0 +1,12 @@
+###################
+JsDoc Reference
+###################
+
+<if test="data.entries">
+
+.. toctree::
+
+<for each="entry" in="data.entries">
+ {+ entry +}</for>
+
+</if>
Please sign in to comment.
Something went wrong with that request. Please try again.