mirror of
https://gitea.com/gitea/docs.git
synced 2026-06-28 15:14:22 +00:00
Add api page (#32)
# Changes - Added [redocusaurus](https://github.com/rohit-gohri/redocusaurus) package to display swagger api with reference to [woodpecker](https://github.com/woodpecker-ci/woodpecker/tree/master/docs) - Change `sed` for swagger.json for proper version and baseurl. - Add a dropdown for different api versions. (screenshot below) - On API pages, only API version dropdown will show(hide locale dropdown, version dropdown for doc, and doc search) - Allow build CSR API pages for development so it saves building time. # Screenshots     Search:  Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/32 Co-authored-by: HesterG <hestergong@gmail.com> Co-committed-by: HesterG <hestergong@gmail.com>
This commit is contained in:
13
loop_docs.sh
13
loop_docs.sh
@@ -15,7 +15,7 @@ SED_INPLACE() {
|
||||
}
|
||||
|
||||
version="$1"
|
||||
if [ "$version" != "lastest" ]; then
|
||||
if [ "$version" != "latest" ]; then
|
||||
version="1.$1"
|
||||
fi
|
||||
locale="$2"
|
||||
@@ -31,7 +31,7 @@ elif ["$version" == "1.20"]; then
|
||||
fi
|
||||
|
||||
docs_dir="versioned_docs/version-$version"
|
||||
if [ "$version" == "lastest" ]; then
|
||||
if [ "$version" == "latest" ]; then
|
||||
if [ "$locale" == "en-us" ]; then
|
||||
docs_dir="docs"
|
||||
else
|
||||
@@ -58,13 +58,14 @@ SED_INPLACE "s/{{< min-go-version >}}/$minGoVer/" "$docs_dir/installation/from-s
|
||||
|
||||
# TODO: improve this sed
|
||||
# need confirmation
|
||||
if [ "$version" == "lastest" ]; then
|
||||
SED_INPLACE 's/"version":.*/"version":"1.21-dev"/' static/latest-swagger.json
|
||||
if [ "$version" == "latest" ]; then
|
||||
SED_INPLACE 's/"version": "{{AppVer | JSEscape | Safe}}"/"version": "1.21-dev"/' static/swagger-latest.json
|
||||
elif [ "$version" == "1.20" ]; then
|
||||
SED_INPLACE 's/"version":.*/"version":"1.20.0-rc2"/' static/20-swagger.json
|
||||
SED_INPLACE 's/"version": "{{AppVer | JSEscape | Safe}}"/"version": "1.20.0-rc2"/' static/swagger-20.json
|
||||
elif [ "$version" == "1.19" ]; then
|
||||
SED_INPLACE 's/"version":.*/"version":"1.19.3"/' static/19-swagger.json
|
||||
SED_INPLACE 's/"version": "{{AppVer | JSEscape | Safe}}"/"version": "1.19.3"/' static/swagger-19.json
|
||||
fi
|
||||
SED_INPLACE 's/"basePath": "{{AppSubUrl | JSEscape | Safe}}/"basePath": "https:\/\/gitea.com/' static/swagger-"$1".json
|
||||
|
||||
for file in `find ./"$docs_dir" -name "*.md"`; do
|
||||
# hide hugo toc
|
||||
|
||||
Reference in New Issue
Block a user