summaryrefslogtreecommitdiffstats
path: root/lib/generators/json.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/generators/json.js')
-rw-r--r--lib/generators/json.js32
1 files changed, 12 insertions, 20 deletions
diff --git a/lib/generators/json.js b/lib/generators/json.js
index 661e587..3023b42 100644
--- a/lib/generators/json.js
+++ b/lib/generators/json.js
@@ -17,33 +17,25 @@ Generator.prototype.transferFile = function(input) { };
Generator.prototype.finish = function() { };
// Convert an input file
-Generator.prototype.convertFile = function(content, input) {
+Generator.prototype.writeParsedFile = function(page, input) {
var that = this;
var json = {
- progress: parse.progress(this.options.navigation, input)
+ progress: [],
+ sections: page.sections
};
- return Q()
- .then(function() {
- return parse.page(content, {
- dir: path.dirname(input) || '/'
- });
- })
- .then(function(parsed) {
- json.lexed = parsed.lexed;
- json.sections = parsed.sections;
- })
- .then(function() {
- return fs.writeFile(
- path.join(that.options.output, input.replace(".md", ".json")),
- JSON.stringify(json, null, 4)
- );
- });
+ var output = path.basename(input, path.extname(input))+".json";
+ output = path.join(that.options.output, output);
+
+ return fs.writeFile(
+ output,
+ JSON.stringify(json, null, 4)
+ );
};
// Generate languages index
// Contains the first languages readme and langs infos
-Generator.prototype.langsIndex = function(langs) {
+/*Generator.prototype.langsIndex = function(langs) {
var that = this;
if (langs.list.length == 0) return Q.reject("Need at least one language");
@@ -68,6 +60,6 @@ Generator.prototype.langsIndex = function(langs) {
JSON.stringify(json, null, 4)
);
});
-};
+};*/
module.exports = Generator;