From 5c13cb18d2fa0aada876970216d37dc644135d18 Mon Sep 17 00:00:00 2001 From: HesterG Date: Mon, 29 May 2023 16:24:40 +0000 Subject: [PATCH] Fix relrefs by following formats allowed by docusaurus (#18) relrefs from upstream is in the format of `[text]({{< relref "doc/.md" >}})`, for example, `[instructions]({{< relref "doc/installation/from-source.en-us.md" >}})`. In this PR, use bash scripts to remove `{{< relref "doc/`, `.en-us`/`.zh-cn` and `" >}}` parts so the link can be used by [docusaurus](https://docusaurus.io/docs/markdown-features/links) Related: https://github.com/go-gitea/gitea/pull/24979, might need to backport this PR into 1.19 Co-authored-by: Lunny Xiao Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/18 Reviewed-by: Lunny Xiao Co-authored-by: HesterG Co-committed-by: HesterG --- loop_docs-19-zh-cn.sh | 3 ++- loop_docs-19.sh | 3 ++- loop_docs-zh-cn.sh | 3 ++- loop_docs.sh | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/loop_docs-19-zh-cn.sh b/loop_docs-19-zh-cn.sh index c88a0334..e8d0ecaa 100644 --- a/loop_docs-19-zh-cn.sh +++ b/loop_docs-19-zh-cn.sh @@ -22,7 +22,8 @@ for file in `find ./i18n/zh-cn/docusaurus-plugin-content-docs/version-1.19/ -nam # hide hugo toc $SED_INPLACE 's/{{< toc >}}//' $file $SED_INPLACE 's/{{< version >}}/1.19.0/g' $file - $SED_INPLACE 's/{{< relref "doc/i18n\/zh-cn\/docusaurus-plugin-content-docs\/version-1.19/g' $file + $SED_INPLACE 's/{{< relref "doc\///g' $file + $SED_INPLACE 's/.zh-cn.md/.md/g' $file $SED_INPLACE 's/" >}}//g' $file $SED_INPLACE 's/\*\*Table of Contents\*\*//' $file $SED_INPLACE 's/weight:/sidebar_position:/g' $file diff --git a/loop_docs-19.sh b/loop_docs-19.sh index 756d3a24..74aad5d2 100644 --- a/loop_docs-19.sh +++ b/loop_docs-19.sh @@ -19,7 +19,8 @@ for file in `find ./versioned_docs/version-1.19/ -name "*.md"`; do # hide hugo toc $SED_INPLACE 's/{{< toc >}}//' $file $SED_INPLACE 's/{{< version >}}/1.19.3/g' $file - $SED_INPLACE 's/{{< relref "doc/versioned_docs\/version-1.19/g' $file + $SED_INPLACE 's/{{< relref "doc\///g' $file + $SED_INPLACE 's/.en-us.md/.md/g' $file $SED_INPLACE 's/" >}}//g' $file $SED_INPLACE 's/\*\*Table of Contents\*\*//' $file $SED_INPLACE 's/weight:/sidebar_position:/g' $file diff --git a/loop_docs-zh-cn.sh b/loop_docs-zh-cn.sh index 25459427..ae4be462 100644 --- a/loop_docs-zh-cn.sh +++ b/loop_docs-zh-cn.sh @@ -22,7 +22,8 @@ for file in `find ./i18n/zh-cn/docusaurus-plugin-content-docs/current/ -name "*. # hide hugo toc $SED_INPLACE 's/{{< toc >}}//' $file $SED_INPLACE 's/{{< version >}}/1.18.2/g' $file - $SED_INPLACE 's/{{< relref "doc/i18n\/zh-cn\/docusaurus-plugin-content-docs\/current/g' $file + $SED_INPLACE 's/{{< relref "doc\///g' $file + $SED_INPLACE 's/.zh-cn.md/.md/g' $file $SED_INPLACE 's/" >}}//g' $file $SED_INPLACE 's/\*\*Table of Contents\*\*//' $file $SED_INPLACE 's/weight:/sidebar_position:/g' $file diff --git a/loop_docs.sh b/loop_docs.sh index 7dd41ee7..cc947fb7 100644 --- a/loop_docs.sh +++ b/loop_docs.sh @@ -19,7 +19,8 @@ for file in `find ./docs/ -name "*.md"`; do # hide hugo toc $SED_INPLACE 's/{{< toc >}}//' $file $SED_INPLACE 's/{{< version >}}/main-nightly/g' $file - $SED_INPLACE 's/{{< relref "doc/i18n\/en\/docusaurus-plugin-content-docs\/current/g' $file + $SED_INPLACE 's/{{< relref "doc\///g' $file + $SED_INPLACE 's/.en-us.md/.md/g' $file $SED_INPLACE 's/" >}}//g' $file $SED_INPLACE 's/\*\*Table of Contents\*\*//' $file $SED_INPLACE 's/weight:/sidebar_position:/g' $file