From e1cc715589f83147b64a76bf0962b7a77dd2d19c Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 16 Dec 2017 00:19:10 +0900 Subject: :v: --- src/web/docs/gulpfile.ts | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/web/docs/gulpfile.ts') diff --git a/src/web/docs/gulpfile.ts b/src/web/docs/gulpfile.ts index 6f2351dacb..2377844650 100644 --- a/src/web/docs/gulpfile.ts +++ b/src/web/docs/gulpfile.ts @@ -36,20 +36,30 @@ gulp.task('doc:docs', () => { const [, name, lang] = file.match(/docs\/(.+?)\.(.+?)\.pug$/); const vars = { common: commonVars, - lang: lang + lang: lang, + title: fs.readFileSync(file, 'utf-8').match(/^h1 (.+?)\r?\n/)[1] }; - pug.renderFile(file, vars, (renderErr, html) => { + pug.renderFile(file, vars, (renderErr, content) => { if (renderErr) { console.error(renderErr); return; } - const htmlPath = `./built/web/docs/${lang}/${name}.html`; - mkdirp(path.dirname(htmlPath), (mkdirErr) => { - if (mkdirErr) { - console.error(mkdirErr); + + pug.renderFile('./src/web/docs/layout.pug', Object.assign({}, vars, { + content + }), (renderErr2, html) => { + if (renderErr2) { + console.error(renderErr2); return; } - fs.writeFileSync(htmlPath, html, 'utf-8'); + const htmlPath = `./built/web/docs/${lang}/${name}.html`; + mkdirp(path.dirname(htmlPath), (mkdirErr) => { + if (mkdirErr) { + console.error(mkdirErr); + return; + } + fs.writeFileSync(htmlPath, html, 'utf-8'); + }); }); }); }); -- cgit v1.2.3-freya