mkdocs: Replace TOC in Translations
Signed-off-by: Yifei Ding<yifeiding@protonmail.com>
This commit is contained in:
parent
7c8cf7661b
commit
9047702a00
|
@ -27,6 +27,16 @@ while IFS="," read dirname langsite langdesc langsearch; do
|
||||||
new_docs_dir="${WORK_DIR}lang/${langsite}/docs/"
|
new_docs_dir="${WORK_DIR}lang/${langsite}/docs/"
|
||||||
locale_dir="${TRANS_DIR}/docs/locales/${dirname}"
|
locale_dir="${TRANS_DIR}/docs/locales/${dirname}"
|
||||||
|
|
||||||
|
# read toc
|
||||||
|
title=$(sed -n '1p' ${locale_dir}/Navigation.md)
|
||||||
|
installation_and_configuration=$(sed -n '3p' ${locale_dir}/Navigation.md)
|
||||||
|
configuration_reference=$(sed -n '5p' ${locale_dir}/Navigation.md)
|
||||||
|
bed_level=$(sed -n '7p' ${locale_dir}/Navigation.md)
|
||||||
|
resonance_compensation=$(sed -n '9p' ${locale_dir}/Navigation.md)
|
||||||
|
command_template=$(sed -n '11p' ${locale_dir}/Navigation.md)
|
||||||
|
developer_documentation=$(sed -n '13p' ${locale_dir}/Navigation.md)
|
||||||
|
device_specific_documents=$(sed -n '15p' ${locale_dir}/Navigation.md)
|
||||||
|
|
||||||
# Copy markdown files to new_docs_dir
|
# Copy markdown files to new_docs_dir
|
||||||
echo "Copying $dirname to $langsite"
|
echo "Copying $dirname to $langsite"
|
||||||
mkdir -p "${new_docs_dir}"
|
mkdir -p "${new_docs_dir}"
|
||||||
|
@ -56,6 +66,16 @@ while IFS="," read dirname langsite langdesc langsearch; do
|
||||||
echo "replace site language"
|
echo "replace site language"
|
||||||
sed -i "s%^ language: en$% language: ${langsite}%" "${new_mkdocs_file}"
|
sed -i "s%^ language: en$% language: ${langsite}%" "${new_mkdocs_file}"
|
||||||
|
|
||||||
|
echo "replace toc"
|
||||||
|
sed -i "s%Klipper documentation$%${title}%" "${new_mkdocs_file}"
|
||||||
|
sed -i "s%Installation and Configuration:$%${installation_and_configuration}:%" "${new_mkdocs_file}"
|
||||||
|
sed -i "s%Configuration Reference:$%${configuration_reference}:%" "${new_mkdocs_file}"
|
||||||
|
sed -i "s%Bed Level:$%${bed_level}:%" "${new_mkdocs_file}"
|
||||||
|
sed -i "s%Resonance Compensation:$%${resonance_compensation}:%" "${new_mkdocs_file}"
|
||||||
|
sed -i "s%Command templates:$%${command_template}:%" "${new_mkdocs_file}"
|
||||||
|
sed -i "s%Developer Documentation:$%${developer_documentation}:%" "${new_mkdocs_file}"
|
||||||
|
sed -i "s%Device Specific Documents:$%${device_specific_documents}:%" "${new_mkdocs_file}"
|
||||||
|
|
||||||
# Build site
|
# Build site
|
||||||
echo "building site for ${langsite}"
|
echo "building site for ${langsite}"
|
||||||
mkdir -p "${PWD}/site/${langsite}/"
|
mkdir -p "${PWD}/site/${langsite}/"
|
||||||
|
|
Loading…
Reference in New Issue