ci: fix gitea wiki 500 errors by stripping .md from links and using static router
All checks were successful
Update Wiki Documentation / generate-docs (push) Successful in 2m12s
All checks were successful
Update Wiki Documentation / generate-docs (push) Successful in 2m12s
This commit is contained in:
@@ -51,15 +51,22 @@ jobs:
|
||||
|
||||
cd wiki_dir
|
||||
|
||||
# Gitea Wiki bezwzględnie wymaga pliku Home.md w głównym katalogu (root).
|
||||
# Spłaszczamy strukturę dla pliku startowego, jeśli trzeba.
|
||||
if [ -f "shared/index.md" ]; then
|
||||
cp shared/index.md Home.md
|
||||
elif [ -f "index.md" ]; then
|
||||
mv index.md Home.md
|
||||
else
|
||||
echo "# RetroHA Documentation" > Home.md
|
||||
echo "Auto-generated by Dokka. Navigate via the sidebar." >> Home.md
|
||||
# Gitea Wiki źle radzi sobie z linkami zawierającymi rozszerzenie .md w URL.
|
||||
# Usuwamy .md z linków wewnętrznych za pomocą Perla (pomijamy linki http/https).
|
||||
find . -type f -name "*.md" -exec perl -pi -e 's/\]\((?!http)(.*?)\.md(?:#(.*?))?\)/\]\($1#$2\)/g' {} +
|
||||
# Sprzątanie pustych anchorów (jeśli #$2 było puste, zostaje '#' na końcu, usuwamy to)
|
||||
find . -type f -name "*.md" -exec perl -pi -e 's/#\)/)/g' {} +
|
||||
|
||||
# Tworzymy statyczną stronę Home.md.
|
||||
# Kopiowanie index.md psuło linki relatywne, więc tworzymy prosty router.
|
||||
echo "# RetroHA Developer Wiki" > Home.md
|
||||
echo "Welcome to the autogenerated API documentation." >> Home.md
|
||||
echo "" >> Home.md
|
||||
if [ -d "shared" ]; then
|
||||
echo "- [Shared Module API Reference](shared/index)" >> Home.md
|
||||
fi
|
||||
if [ -d "app" ]; then
|
||||
echo "- [App Module API Reference](app/index)" >> Home.md
|
||||
fi
|
||||
|
||||
git add .
|
||||
|
||||
Reference in New Issue
Block a user