Skip to content

Commit

Permalink
added build script for help page
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmerfield committed Dec 7, 2017
1 parent 198ecfb commit 247b18d
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions scripts/build/help.js
Expand Up @@ -24,15 +24,17 @@ forEach(readdir(source), function(path, next){
// Remove leading number and period
var title = basename(path).slice(2).trim();
var slug = makeSlug(title);
var content = '# ' + title + '\n\n' + loadFiles(path);
var res = loadFiles(path);
var subsections = res[1];
var content = res[0];

convert(content, function(err, html){

var output_path = joinpath(output, slug + '.html');

write(output_path, html);

sections.push({html: html, title: title, slug: slug});
sections.push({html: html, title: title, slug: slug, subsections: subsections});

next();
});
Expand Down Expand Up @@ -82,11 +84,21 @@ function readdir (path) {
function loadFiles (path) {

var res = '';
var subsections = [];

var contents = readdir(path);

contents.forEach(function(p){
p = p.slice(p.lastIndexOf('/'));
console.log(p);
p = p.slice(p.indexOf('.') + 1, p.lastIndexOf('.'));
p = p.trim();

subsections.push({subsection: p});
});

for (var i = 0; i < contents.length;i++)
res += read(contents[i]) + '\n\n';

return res;
return [res, subsections];
}

0 comments on commit 247b18d

Please sign in to comment.