_klipper3d: Specify mkdocs language config options

Signed-off-by: Yifei Ding <yifeiding@protonmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Yifei Ding 2022-03-19 13:57:56 -07:00 committed by Kevin O'Connor
parent b35b6cb10b
commit 61792e3e31
2 changed files with 14 additions and 2 deletions

View File

@ -15,7 +15,7 @@ git clone --depth 1 https://github.com/Klipper3d/klipper-translations ${TRANS_DI
# Create new mkdocs-main.yml with language links # Create new mkdocs-main.yml with language links
cp ${MKDOCS_DIR}mkdocs.yml ${MKDOCS_MAIN} cp ${MKDOCS_DIR}mkdocs.yml ${MKDOCS_MAIN}
while IFS="," read dirname langsite langdesc langsearch; do while IFS="," read dirname langsite langdesc langsearch; do
sed -i "s%^.*# Alternate language links automatically added here$% - name: ${langdesc}\n link: /${langsite}/\n\0%" ${MKDOCS_MAIN} sed -i "s%^.*# Alternate language links automatically added here$% - name: ${langdesc}\n link: /${langsite}/\n lang: ${langsite}\n\0%" ${MKDOCS_MAIN}
done < <(egrep -v '^ *(#|$)' ${TRANS_FILE}) done < <(egrep -v '^ *(#|$)' ${TRANS_FILE})
# Build main English website # Build main English website
@ -50,6 +50,12 @@ while IFS="," read dirname langsite langdesc langsearch; do
new_mkdocs_file="${new_docs_dir}_klipper3d/mkdocs-lang-${langsite}.yml" new_mkdocs_file="${new_docs_dir}_klipper3d/mkdocs-lang-${langsite}.yml"
cp "${MKDOCS_MAIN}" "${new_mkdocs_file}" cp "${MKDOCS_MAIN}" "${new_mkdocs_file}"
echo "replace search language"
sed -i "s%^ lang: en$% lang: ${langsearch}%" "${new_mkdocs_file}"
echo "replace site language"
sed -i "s%^ language: en$% language: ${langsite}%" "${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}/"

View File

@ -1,5 +1,8 @@
# Main configuration file for mkdocs generation of klipper3d.org website # Main configuration file for mkdocs generation of klipper3d.org website
# Note that the build-translations.sh script expects a certain file
# layout. See that script and the README file for more details.
# Site and directory configuration # Site and directory configuration
site_name: Klipper documentation site_name: Klipper documentation
repo_url: https://github.com/Klipper3d/klipper repo_url: https://github.com/Klipper3d/klipper
@ -19,7 +22,8 @@ markdown_extensions:
- mdx_truly_sane_lists - mdx_truly_sane_lists
- mdx_breakless_lists - mdx_breakless_lists
plugins: plugins:
search: {} search:
lang: en
mkdocs-simple-hooks: mkdocs-simple-hooks:
hooks: hooks:
on_page_markdown: "docs._klipper3d.mkdocs_hooks:transform" on_page_markdown: "docs._klipper3d.mkdocs_hooks:transform"
@ -58,6 +62,7 @@ theme:
- search.suggest - search.suggest
- search.highlight - search.highlight
- search.share - search.share
language: en
extra_css: extra_css:
- _klipper3d/css/extra.css - _klipper3d/css/extra.css
@ -71,6 +76,7 @@ extra:
alternate: alternate:
- name: English - name: English
link: / link: /
lang: en
# Alternate language links automatically added here # Alternate language links automatically added here
# Navigation hierarchy (this should mimic the layout of Overview.md) # Navigation hierarchy (this should mimic the layout of Overview.md)