Fix relrefs by following formats allowed by docusaurus (#18)

relrefs from upstream is in the format of `[text]({{< relref "doc/<path under 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 <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/18
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
This commit is contained in:
HesterG
2023-05-29 16:24:40 +00:00
committed by Lunny Xiao
parent c123ee5449
commit 5c13cb18d2
4 changed files with 8 additions and 4 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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