diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-12-16 00:19:10 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-12-16 00:19:10 +0900 |
| commit | e1cc715589f83147b64a76bf0962b7a77dd2d19c (patch) | |
| tree | c5590ef63f9325bf9ae0bf3b9a8fb6e12cf9e1e5 /src/web/docs/gulpfile.ts | |
| parent | :v: (diff) | |
| download | sharkey-e1cc715589f83147b64a76bf0962b7a77dd2d19c.tar.gz sharkey-e1cc715589f83147b64a76bf0962b7a77dd2d19c.tar.bz2 sharkey-e1cc715589f83147b64a76bf0962b7a77dd2d19c.zip | |
:v:
Diffstat (limited to 'src/web/docs/gulpfile.ts')
| -rw-r--r-- | src/web/docs/gulpfile.ts | 24 |
1 files changed, 17 insertions, 7 deletions
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'); + }); }); }); }); |