Files
gitea-docs/loop_docs-19-zh-cn.sh
HesterG 1ba3ac7c99 Add outdated component to outdated documents (#25)
- `git log` needs all commit history to compare latest commit of files, so changed `git clone --depth=1` to `git clone`. This will make the step take longer, so might be improved if there is a better way.

- `src/theme/MDXContent/index.js` is from [ejecting of the component](https://docusaurus.io/docs/swizzling#ejecting) inside `@docusaurus/theme-classic` plugin, and this one is safe to eject according to docusaurus

    ![Screen Shot 2023-06-06 at 12.12.28](/attachments/17a3a84b-cec0-4849-8bd6-9e0471d9536f)

    ![Screen Shot 2023-06-06 at 12.12.15](/attachments/58bba321-3cfb-4a8b-8aeb-84422a06c472)

- [Outdated component style reference](https://mui.com/material-ui/react-alert/)

- Added [`Translate` component](https://docusaurus.io/docs/next/docusaurus-core#translate) to `Outdated` so it can be localized. [reference](https://docusaurus.io/docs/next/i18n/tutorial#translate-your-react-code)

- One way to check for the specific outdated documents:

    search for `lastest commit timestamp` in [prepare nightly docs and prepare 1.19 docs steps](https://gitea.com/gitea/gitea-docusaurus/actions/runs/74)

# After

The Chinese documents that are outdated (latest commit is ealier than laster commit of English version):

![Screen Shot 2023-06-06 at 13.04.24](/attachments/e5d16267-d8d8-434e-89b1-138d04ec92a3)

![Screen Shot 2023-06-06 at 13.05.07](/attachments/af8f996a-5318-4f89-841f-b27a4903a27d)

![Screen Shot 2023-06-06 at 13.05.14](/attachments/e6aba31b-46ba-4a32-ad81-81007e0f711e)

Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/25
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: HesterG <hestergong@gmail.com>
Co-committed-by: HesterG <hestergong@gmail.com>
2023-06-08 03:34:23 +00:00

67 lines
3.1 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/version-1.19/installation/with-docker.zh-cn.md
$SED_INPLACE 's/\\<empty\\>/<empty\\>/' i18n/zh-cn/docusaurus-plugin-content-docs/version-1.19/administration/config-cheat-sheet.zh-cn.md
$SED_INPLACE 's/^url:.*//' i18n/zh-cn/docusaurus-plugin-content-docs/version-1.19/intro.md
$SED_INPLACE 's/^slug:.*/slug: \//' i18n/zh-cn/docusaurus-plugin-content-docs/version-1.19/intro.md
$SED_INPLACE 's/.\/guidelines-frontend.md/.\/guidelines-frontend/' i18n/zh-cn/docusaurus-plugin-content-docs/version-1.19/development/hacking-on-gitea.zh-cn.md
$SED_INPLACE 's/{{< min-node-version >}}/16/' i18n/zh-cn/docusaurus-plugin-content-docs/version-1.19/development/hacking-on-gitea.zh-cn.md
$SED_INPLACE 's/{{< min-go-version >}}/1.19/' i18n/zh-cn/docusaurus-plugin-content-docs/version-1.19/development/hacking-on-gitea.zh-cn.md
$SED_INPLACE 's/{{< go-version >}}/1.20/' i18n/zh-cn/docusaurus-plugin-content-docs/version-1.19/development/hacking-on-gitea.zh-cn.md
$SED_INPLACE 's/{{< min-node-version >}}/16/' i18n/zh-cn/docusaurus-plugin-content-docs/version-1.19/installation/from-source.zh-cn.md
$SED_INPLACE 's/{{< min-go-version >}}/1.19/' i18n/zh-cn/docusaurus-plugin-content-docs/version-1.19/installation/from-source.zh-cn.md
$SED_INPLACE 's/"version":.*/"version":"1.19.0"/' static/19-swagger.json
for file in `find ./i18n/zh-cn/docusaurus-plugin-content-docs/version-1.19 -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.19.0/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
done
for file in i18n/zh-cn/docusaurus-plugin-content-docs/version-1.19/*; do
if [ -d $file ]; then
continue
fi
if [ "$file" == "i18n/zh-cn/docusaurus-plugin-content-docs/version-1.19/intro.md" ]; then
continue
fi
rm $file
done
for file in `find ./i18n/zh-cn/docusaurus-plugin-content-docs/version-1.19 -name "*.zh-cn.md"`; do
mv "${file}" "${file/.zh-cn/}"
done
# for file in `find ./version ed_docs/version-1.19/zh-cn/ -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/version-1.19/ -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/version-1.19/ -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/version-1.19/ -name "*.md"`; do
# trimmed=$(echo $file | cut -f 2 -d '.')
# mv $file .$trimmed.md
# done