summaryrefslogtreecommitdiff
path: root/src/docs/api
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-07-17 03:57:34 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-07-17 03:57:34 +0900
commitf88ac3c04e5d335860a41e59d3936fa38d1d9989 (patch)
tree7a3b63b44381d2e1e509d6b02aa0152f6e652167 /src/docs/api
parent:art: (diff)
downloadsharkey-f88ac3c04e5d335860a41e59d3936fa38d1d9989.tar.gz
sharkey-f88ac3c04e5d335860a41e59d3936fa38d1d9989.tar.bz2
sharkey-f88ac3c04e5d335860a41e59d3936fa38d1d9989.zip
Improve doc
Diffstat (limited to 'src/docs/api')
-rw-r--r--src/docs/api/endpoints/view.pug25
-rw-r--r--src/docs/api/mixins.pug41
2 files changed, 41 insertions, 25 deletions
diff --git a/src/docs/api/endpoints/view.pug b/src/docs/api/endpoints/view.pug
index b8955511f1..4a11c4cd02 100644
--- a/src/docs/api/endpoints/view.pug
+++ b/src/docs/api/endpoints/view.pug
@@ -47,10 +47,23 @@ block main
if res
section
h2= i18n('docs.api.endpoints.res')
- +propTable(res)
- if resDefs
- each resDef in resDefs
- section(id= resDef.name)
- h3= resDef.name
- +propTable(resDef.props)
+ if resProps
+ +propTable(resProps)
+
+ if resDefs
+ each resDef in resDefs
+ section(id= resDef.name)
+ h3= resDef.name
+ +propTable(resDef.props)
+ else
+ if res.type.startsWith('entity')
+ a(href=`/docs/${lang}/api/entities/${kebab(res.entity)}`)= res.entity
+
+block footer
+ div.ui.info: p
+ i.fas.fa-info-circle(style="margin-right: 4px")
+ = i18n('docs.api.endpoints.generated')
+ p
+ = i18n('docs.api.endpoints.show-src')
+ a(href=src target="_blank")= i18n('docs.api.endpoints.show-src-link')
diff --git a/src/docs/api/mixins.pug b/src/docs/api/mixins.pug
index 9e03abefeb..925aab2934 100644
--- a/src/docs/api/mixins.pug
+++ b/src/docs/api/mixins.pug
@@ -1,3 +1,24 @@
+mixin type(prop)
+ i= prop.type
+ if prop.kind == 'id'
+ if prop.entity
+ | (
+ a(href=`/docs/${lang}/api/entities/${kebab(prop.entity)}`)= prop.entity
+ | ID)
+ else
+ | (ID)
+ else if prop.kind == 'entity'
+ | (
+ a(href=`/docs/${lang}/api/entities/${kebab(prop.entity)}`)= prop.entity
+ | )
+ else if prop.kind == 'object'
+ if prop.hasDef
+ | (
+ a(href=`#${prop.name}`)= prop.name
+ | )
+ else if prop.kind == 'date'
+ | (Date)
+
mixin propTable(props)
table.props
thead: tr
@@ -9,23 +30,5 @@ mixin propTable(props)
tr
td.name= prop.name
td.type
- i= prop.type
- if prop.kind == 'id'
- if prop.entity
- | (
- a(href=`/docs/${lang}/api/entities/${kebab(prop.entity)}`)= prop.entity
- | ID)
- else
- | (ID)
- else if prop.kind == 'entity'
- | (
- a(href=`/docs/${lang}/api/entities/${kebab(prop.entity)}`)= prop.entity
- | )
- else if prop.kind == 'object'
- if prop.hasDef
- | (
- a(href=`#${prop.name}`)= prop.name
- | )
- else if prop.kind == 'date'
- | (Date)
+ +type(prop)
td.desc!= prop.desc ? prop.desc[lang] || prop.desc['ja'] : null