Comparing version 0.0.2 to 0.0.3
@@ -6,4 +6,6 @@ var fs = require('fs'); | ||
this.output = options.output; | ||
options.template = __dirname + '/../templates/simple.md'; | ||
this.input = options.input; | ||
options.template = options.template || __dirname + '/../templates/simple.md'; | ||
var template = fs.readFileSync(options.template).toString(); | ||
@@ -16,7 +18,18 @@ | ||
Renderer.prototype.write = function(data){ | ||
var str = this.render(data); | ||
//console.log(data); | ||
//console.log(str); | ||
fs.writeFileSync(this.output, str); | ||
Renderer.prototype.write = function(classes){ | ||
var input = fs.readFileSync(this.input).toString(); | ||
for(var cls in classes){ | ||
if(classes.hasOwnProperty(cls)){ | ||
for(var method in classes[cls]){ | ||
if(classes[cls].hasOwnProperty(method)){ | ||
var tmp = this.render(classes[cls][method]); | ||
input = input.replace('{{' + cls + '.' + method + '()}}', tmp); | ||
} | ||
} | ||
} | ||
} | ||
fs.writeFileSync(this.output, input); | ||
}; | ||
@@ -23,0 +36,0 @@ |
@@ -29,19 +29,14 @@ var Transformer = module.exports = function(results){ | ||
Transformer.prototype.transform = function(){ | ||
var sections = {}; | ||
var classes = {}; | ||
for(var i = 0; i < this.results.length; i++){ | ||
var entry = this.results[i]; | ||
if(!entry.ignore){ | ||
var tags = this.parseTags(entry.tags); | ||
var section_names = tags.section ? tags.section.split('/') : []; | ||
var section = sections; | ||
for(var s = 0; s < section_names.length; s++){ | ||
if(s > 0) section = section.subsections; | ||
section = section[section_names[s]] = section[section_names[s]] || {name: section_names[s], depth:s, descriptions:[], examples:[], methods: [], subsections:{}}; | ||
} | ||
if(tags.method){ | ||
var method = { | ||
name: tags.method, | ||
cls: tags.class, | ||
params: tags.params, | ||
@@ -59,6 +54,8 @@ options: tags.options, | ||
classes[section_names[0]] = classes[section_names[0]] || {}; | ||
classes[section_names[0]][tags.method] = method; | ||
if(tags.class){ | ||
classes[tags.class] = classes[tags.class] || {}; | ||
classes[tags.class][tags.method] = method; | ||
classes[tags.class][tags.alias] = method; | ||
} | ||
section.methods.push(method); | ||
} | ||
@@ -80,3 +77,4 @@ | ||
} | ||
return sections; | ||
return classes; | ||
}; | ||
@@ -83,0 +81,0 @@ |
{ | ||
"name": "docu", | ||
"version": "0.0.2", | ||
"description": "Documentation generator based on dox", | ||
"keywords": ["documentation", "dox"], | ||
"author": "Philipp Waldmann <philipp.waldmann@s-team.at>", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/PhilWaldmann/docu.git" | ||
}, | ||
"dependencies": { | ||
"dox": ">= 0.4.x", | ||
"glob": ">= 3.2.x", | ||
"commander": ">= 2.1.x", | ||
"handlebars": ">= 2.0.x" | ||
}, | ||
"main": "./lib/", | ||
"bin": { | ||
"docu": "./bin/docu" | ||
}, | ||
"engines": { | ||
"node": ">=0.8.7" | ||
} | ||
} | ||
"name": "docu", | ||
"version": "0.0.3", | ||
"description": "Documentation generator based on dox", | ||
"keywords": [ | ||
"documentation", | ||
"dox" | ||
], | ||
"author": { | ||
"name": "Philipp Waldmann", | ||
"email": "philipp.waldmann@s-team.at" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/PhilWaldmann/docu.git" | ||
}, | ||
"dependencies": { | ||
"dox": ">= 0.4.x", | ||
"glob": ">= 3.2.x", | ||
"commander": ">= 2.1.x", | ||
"handlebars": ">= 2.0.x" | ||
}, | ||
"main": "./lib/", | ||
"bin": { | ||
"docu": "./bin/docu" | ||
}, | ||
"engines": { | ||
"node": ">=0.8.7" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/PhilWaldmann/docu/issues" | ||
}, | ||
"readme": "ERROR: No README data found!", | ||
"homepage": "https://github.com/PhilWaldmann/docu", | ||
"_id": "docu@0.0.2", | ||
"_from": "docu@latest" | ||
} |
@@ -1,6 +0,2 @@ | ||
{{#each .}} | ||
{{{headline name}}} | ||
{{#each methods}} | ||
### {{name}}({{{inline_params}}}) | ||
### {{cls}}.{{name}}({{{inline_params}}}) | ||
{{&description.full}} | ||
@@ -17,8 +13,2 @@ {{{params}}} | ||
```` | ||
{{/examples}} | ||
{{/each}} | ||
{{#subsections}} | ||
{{> subsections}} | ||
{{/subsections}} | ||
{{/each}} | ||
{{/examples}} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
8073
215
0