Generate API docs from swagger
This commit is contained in:
parent
9fb26f7c85
commit
f0c99a6925
11 changed files with 32 additions and 2174 deletions
|
@ -16,9 +16,11 @@ for f in "$1"/{head,nav,footer}.html; do
|
|||
fi
|
||||
done
|
||||
|
||||
files=gen/*.html
|
||||
|
||||
perl -MFile::Slurp -pi -e 'BEGIN { $header = read_file("'$HEADER'") } s#<head>#<head>$header
|
||||
<link rel="stylesheet" href="//matrix.org/docs/guides/css/docs_overrides.css">
|
||||
#' gen/specification.html gen/howtos.html
|
||||
#' ${files}
|
||||
|
||||
perl -MFile::Slurp -pi -e 'BEGIN { $nav = read_file("'$NAV_BAR'") } s#<body># <body class="blog et_fixed_nav et_cover_background et_right_sidebar">
|
||||
<div id="page-wrapper">
|
||||
|
@ -27,7 +29,7 @@ perl -MFile::Slurp -pi -e 'BEGIN { $nav = read_file("'$NAV_BAR'") } s#<body># <
|
|||
<div id="main-content">
|
||||
<div class="wrapper" id="wrapper">
|
||||
<div class="document_foo" id="document">
|
||||
#' gen/specification.html gen/howtos.html
|
||||
#' ${files}
|
||||
|
||||
perl -MFile::Slurp -pi -e 'BEGIN { $footer = read_file("'$FOOTER'") } s#</body>#
|
||||
</div>
|
||||
|
@ -39,4 +41,4 @@ perl -MFile::Slurp -pi -e 'BEGIN { $footer = read_file("'$FOOTER'") } s#</body>#
|
|||
$footer
|
||||
</div>
|
||||
</div>
|
||||
</body>#' gen/specification.html gen/howtos.html
|
||||
</body>#' ${files}
|
||||
|
|
27
scripts/generate-http-docs.sh
Executable file
27
scripts/generate-http-docs.sh
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash -eu
|
||||
|
||||
# This script generates an HTML page containing all of the client-server API docs.
|
||||
# It takes all of the swagger YAML files for the client-server API, and turns
|
||||
# them into API docs, with none of the narrative found in the rst files which
|
||||
# normally wrap these API docs.
|
||||
|
||||
cd "$(dirname $0)"
|
||||
|
||||
mkdir -p tmp gen
|
||||
|
||||
cat >tmp/http_apis <<EOF
|
||||
Matrix Client-Server API Reference
|
||||
==================================
|
||||
|
||||
This contains the client-server API for the reference implementation of the home server.
|
||||
|
||||
|
||||
EOF
|
||||
|
||||
for f in ../api/client-server/*/*.yaml; do
|
||||
f="$(basename "${f/.yaml/_http_api}")"
|
||||
echo "{{${f/-/_}}}" >> tmp/http_apis
|
||||
done
|
||||
|
||||
(cd ../templating ; python build.py -i matrix_templates -o ../scripts/gen ../scripts/tmp/http_apis)
|
||||
rst2html.py --stylesheet-path=$(echo css/*.css | tr ' ' ',') gen/http_apis > gen/http_apis.html
|
Loading…
Add table
Add a link
Reference in a new issue