Files
gitea-docs/loop_docs-zh-cn.sh
HesterG c911962cd6 fix typo and some seds for <empty> (#15)
# Before:

![Screen Shot 2023-05-26 at 15.48.12](/attachments/09d9a965-1587-40c9-b81b-e8416ac0c226)![Screen Shot 2023-05-26 at 15.48.17](/attachments/8beda8a1-5c49-4c87-95e7-e4aa95e56ec9)![Screen Shot 2023-05-26 at 15.48.57](/attachments/21dad81e-eed1-4280-bbb4-eeda039bec41)![Screen Shot 2023-05-26 at 16.14.44](/attachments/07a3148a-52ea-43bb-8e07-c0d8f31d1c24)

# After:

![Screen Shot 2023-05-26 at 16.02.38](/attachments/24239f32-6e9a-487c-8532-b6bd22ca6a50)(/attachments/85c184f3-58ca-4616-bb9d-9afacbc59290)![Screen Shot 2023-05-26 at 16.03.02](/attachments/4952880a-3254-4139-8943-ff37a9797bd7)![Screen Shot 2023-05-26 at 16.05.03](/attachments/ef77be92-2c60-4962-8b0a-efeed63a663b)![Screen Shot 2023-05-26 at 16.15.22](/attachments/22ea1d0b-2838-488d-92c7-e2db8e53ebae)

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/15
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
2023-05-26 17:49:55 +08:00

62 lines
2.4 KiB
Bash

#!/bin/bash
set -xe
if sed --version 2>/dev/null | grep -q GNU; then
SED_INPLACE="sed -i"
else
SED_INPLACE="sed -i ''"
fi
$SED_INPLACE 's/\\<empty>/<empty\\>/' i18n/zh-cn/docusaurus-plugin-content-docs/current/installation/with-docker.zh-cn.md
$SED_INPLACE 's/\\<empty\\>/<empty\\>/' i18n/zh-cn/docusaurus-plugin-content-docs/current/administration/config-cheat-sheet.zh-cn.md
$SED_INPLACE 's/^url:.*//' i18n/zh-cn/docusaurus-plugin-content-docs/current/intro.md
$SED_INPLACE 's/^slug:.*/slug: \//' i18n/zh-cn/docusaurus-plugin-content-docs/current/intro.md
$SED_INPLACE 's/.\/guidelines-frontend.md/.\/guidelines-frontend/' i18n/zh-cn/docusaurus-plugin-content-docs/current/development/hacking-on-gitea.zh-cn.md
$SED_INPLACE 's/"version":.*/"version":"1.20-dev"/' static/latest-swagger.json
for file in `find ./i18n/zh-cn/docusaurus-plugin-content-docs/current/ -name "*.md"`; do
# note only works on linux, forget about it when attempting to run on macos
# 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/" >}}//g' $file
$SED_INPLACE 's/\*\*Table of Contents\*\*//' $file
$SED_INPLACE 's/weight:/sidebar_position:/g' $file
done
for file in i18n/zh-cn/docusaurus-plugin-content-docs/current/*; do
if [ -d $file ]; then
continue
fi
if [ "$file" == "i18n/zh-cn/docusaurus-plugin-content-docs/current/intro.md" ]; then
continue
fi
rm $file
done
for file in `find ./i18n/zh-cn/docusaurus-plugin-content-docs/current/ -name "*.zh-cn.md"`; do
mv "${file}" "${file/.zh-cn/}"
done
# for file in `find ./i18n/zh-cn/docusaurus-plugin-content-docs/current/ -name "*.md"`; do
# trimmed=$(echo $file | cut -f 2 -d '.')
# mv $file .$trimmed.md
# done
# for file in `find ./i18n/zh-tw/docusaurus-plugin-content-docs/zh-cn/current/ -name "*.md"`; do
# trimmed=$(echo $file | cut -f 2 -d '.')
# mv $file .$trimmed.md
# done
# for file in `find ./i18n/fr-fr/docusaurus-plugin-content-docs/zh-cn/current/ -name "*.md"`; do
# trimmed=$(echo $file | cut -f 2 -d '.')
# mv $file .$trimmed.md
# done
# for file in `find ./i18n/zh-cn/docusaurus-plugin-content-docs/zh-cn/current/ -name "*.md"`; do
# trimmed=$(echo $file | cut -f 2 -d '.')
# mv $file .$trimmed.md
# done