✌️
This commit is contained in:
parent
3bcdbe151f
commit
e1cc715589
@ -1,9 +1,6 @@
|
||||
extends ../../layout.pug
|
||||
include ../mixins
|
||||
|
||||
block title
|
||||
| #{endpoint} | Misskey API
|
||||
|
||||
block meta
|
||||
link(rel="stylesheet" href="/assets/docs/api/endpoints/style.css")
|
||||
|
||||
|
@ -1,9 +1,6 @@
|
||||
extends ../../layout.pug
|
||||
include ../mixins
|
||||
|
||||
block title
|
||||
| #{name} | Misskey API
|
||||
|
||||
block meta
|
||||
link(rel="stylesheet" href="/assets/docs/api/entities/style.css")
|
||||
|
||||
|
@ -108,12 +108,13 @@ gulp.task('doc:api:endpoints', () => {
|
||||
paramDefs: extractDefs(ep.params),
|
||||
res: sortParams(ep.res.map(p => parseParam(p))),
|
||||
resDefs: extractDefs(ep.res),
|
||||
kebab,
|
||||
common: commonVars
|
||||
};
|
||||
langs.forEach(lang => {
|
||||
pug.renderFile('./src/web/docs/api/endpoints/view.pug', Object.assign({}, vars, {
|
||||
lang
|
||||
lang,
|
||||
title: ep.endpoint,
|
||||
kebab,
|
||||
common: commonVars
|
||||
}), (renderErr, html) => {
|
||||
if (renderErr) {
|
||||
console.error(renderErr);
|
||||
@ -146,12 +147,13 @@ gulp.task('doc:api:entities', () => {
|
||||
desc: entity.desc,
|
||||
props: sortParams(entity.props.map(p => parseParam(p))),
|
||||
propDefs: extractDefs(entity.props),
|
||||
kebab,
|
||||
common: commonVars
|
||||
};
|
||||
langs.forEach(lang => {
|
||||
pug.renderFile('./src/web/docs/api/entities/view.pug', Object.assign({}, vars, {
|
||||
lang
|
||||
lang,
|
||||
title: entity.name,
|
||||
kebab,
|
||||
common: commonVars
|
||||
}), (renderErr, html) => {
|
||||
if (renderErr) {
|
||||
console.error(renderErr);
|
||||
|
@ -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');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,9 +1,3 @@
|
||||
extends ./layout.pug
|
||||
h1 Misskey Docs
|
||||
|
||||
block title
|
||||
| Misskey Docs
|
||||
|
||||
block main
|
||||
h1 Misskey Docs
|
||||
|
||||
p Welcome to docs of Misskey.
|
||||
p Welcome to docs of Misskey.
|
||||
|
@ -1,9 +1,3 @@
|
||||
extends ./layout.pug
|
||||
h1 Misskey ドキュメント
|
||||
|
||||
block title
|
||||
| Misskey ドキュメント
|
||||
|
||||
block main
|
||||
h1 Misskey ドキュメント
|
||||
|
||||
p Misskeyのドキュメントへようこそ
|
||||
p Misskeyのドキュメントへようこそ
|
||||
|
@ -5,7 +5,7 @@ html(lang= lang)
|
||||
meta(charset="UTF-8")
|
||||
meta(name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no")
|
||||
title
|
||||
block title
|
||||
| #{title} | Misskey Docs
|
||||
link(rel="stylesheet" href="/assets/docs/style.css")
|
||||
block meta
|
||||
|
||||
@ -27,3 +27,5 @@ html(lang= lang)
|
||||
li: a(href=`/docs/${lang}/api/endpoints/${common.kebab(endpoint)}`)= endpoint
|
||||
main
|
||||
block main
|
||||
if content
|
||||
| !{content}
|
||||
|
@ -27,7 +27,7 @@ export default function() {
|
||||
title: {}
|
||||
};
|
||||
}
|
||||
vars['docs'][name]['title'][lang] = fs.readFileSync(x, 'utf-8').match(/\r?\n\th1 (.+?)\r?\n/)[1];
|
||||
vars['docs'][name]['title'][lang] = fs.readFileSync(x, 'utf-8').match(/^h1 (.+?)\r?\n/)[1];
|
||||
});
|
||||
|
||||
vars['kebab'] = string => string.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/\s+/g, '-').toLowerCase();
|
||||
|
Loading…
Reference in New Issue
Block a user