なんかもうめっちゃ変えた

This commit is contained in:
syuilo
2017-12-17 14:35:30 +09:00
parent 5c36423841
commit d4fb399c95
21 changed files with 185 additions and 118 deletions

View File

@@ -17,7 +17,7 @@ block main
p#desc= desc[lang] || desc['ja']
section
h2= common.i18n[lang]['docs']['api']['endpoints']['params']
h2 %i18n:docs.api.endpoints.params%
+propTable(params)
if paramDefs
@@ -28,5 +28,5 @@ block main
if res
section
h2= common.i18n[lang]['docs']['api']['endpoints']['res']
h2 %i18n:docs.api.endpoints.res%
+propTable(res)

View File

@@ -10,7 +10,7 @@ block main
p#desc= desc[lang] || desc['ja']
section
h2= common.i18n[lang]['docs']['api']['entities']['properties']
h2 %i18n:docs.api.entities.properties%
+propTable(props)
if propDefs

View File

@@ -10,13 +10,16 @@ import * as pug from 'pug';
import * as yaml from 'js-yaml';
import * as mkdirp from 'mkdirp';
import locales from '../../../../locales';
import I18nReplacer from '../../../common/build/i18n';
import fa from '../../../common/build/fa';
import config from './../../../conf';
import generateVars from '../vars';
const commonVars = generateVars();
const langs = Object.keys(commonVars.i18n);
const langs = Object.keys(locales);
const kebab = string => string.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/\s+/g, '-').toLowerCase();
@@ -124,6 +127,9 @@ gulp.task('doc:api:endpoints', () => {
console.error(renderErr);
return;
}
const i18n = new I18nReplacer(lang);
html = html.replace(i18n.pattern, i18n.replacement);
html = fa(html);
const htmlPath = `./built/web/docs/${lang}/api/endpoints/${ep.endpoint}.html`;
mkdirp(path.dirname(htmlPath), (mkdirErr) => {
if (mkdirErr) {
@@ -164,6 +170,9 @@ gulp.task('doc:api:entities', () => {
console.error(renderErr);
return;
}
const i18n = new I18nReplacer(lang);
html = html.replace(i18n.pattern, i18n.replacement);
html = fa(html);
const htmlPath = `./built/web/docs/${lang}/api/entities/${kebab(entity.name)}.html`;
mkdirp(path.dirname(htmlPath), (mkdirErr) => {
if (mkdirErr) {

View File

@@ -1,10 +1,10 @@
mixin propTable(props)
table.props
thead: tr
th= common.i18n[lang]['docs']['api']['props']['name']
th= common.i18n[lang]['docs']['api']['props']['type']
th= common.i18n[lang]['docs']['api']['props']['optional']
th= common.i18n[lang]['docs']['api']['props']['description']
th %i18n:docs.api.props.name%
th %i18n:docs.api.props.type%
th %i18n:docs.api.props.optional%
th %i18n:docs.api.props.description%
tbody
each prop in props
tr
@@ -31,7 +31,7 @@ mixin propTable(props)
| (Date)
td.optional
if prop.optional
= common.i18n[lang]['docs']['api']['props']['yes']
| %i18n:docs.api.props.yes%
else
= common.i18n[lang]['docs']['api']['props']['no']
| %i18n:docs.api.props.no%
td.desc!= prop.desc[lang] || prop.desc['ja']