Skip to content

Commit 92329b3

Browse files
committed
docs readme
docs folder refactored
1 parent 6a17328 commit 92329b3

39 files changed

+57
-41
lines changed

docs/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# TRegExpr documentation compilation
2+
3+
Sources from `docs/src/` are compiled by Github Action `docs` to `site/` using
4+
[Material for MkDocs](https://squidfunk.github.io/mkdocs-material/).
5+
6+
The English version (en) is placed at the root of the site, while other
7+
languages, are placed in corresponding subdirectories.
8+
Consequently, by default, the English version is served.
9+
10+
The GitHub action is triggered by pushes to the `main` branch.
11+
After compiling the docs to `site/`, it pushes them to the `gh-pages` branch.
12+
The GitHub repository is configured to serve the gh-pages branch as a
13+
website with the custom domain `regex.sorokin.engineer`.
14+
15+
Use `make en` and similar commands to compile and debug the documentation locally.
16+
To see all available commands, use `make help`.
17+
18+
## A bit of history
19+
20+
In March 2024, I decided to stop struggling with overly complicated [gettext](https://www.gnu.org/software/gettext/)
21+
translations with WebLate and took a significant leap of faith to abandon gettext
22+
translations.
23+
24+
It's not meant for RST files, and maintaining it has been challenging.
25+
26+
There's good reasoning for this decision outlined here:
27+
[Should we use gettext for RST files?](https://github.com/natcap/invest.users-guide/issues/54)
28+
29+
Simultaneously, I opted to transition from Sphinx/RST to Markdown to simplify
30+
things.
31+
32+
With `Material for MkDocs`, RST no longer presents any real advantages.

docs/adjust-rst.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
"""Adjust RST before conversion to markdown.
1+
"""Adjust RST for Markdown conversion.
22
3-
Fix the headers and anchors in the RST file to make it compatible with the pandoc conversion.
3+
Fix headers and anchors for pandoc compatibility.
4+
Used for migration from Sphinx & gettext to MkDocs
45
"""
56
import re
67
import sys

docs/build-docs.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env bash
22
#
3-
# Create docs in docs/
3+
# Render site/ from docs/src/
44
#
55

6-
#./scripts/docstrings.sh
7-
86
for lang in en bg de es fr ru; do # en should be the first language as it clears the root of the site
97
./docs-render-config.sh $lang
108
mkdocs build --config-file _mkdocs.yml
9+
10+
# Additional redirects that is impossible to create with `mkdocs-redirects`
1111
if [ $lang = "en" ]; then
1212
mkdir -p ../site/en
1313
cp -r ../site/latest ../site/en/latest

docs/docs-render-config.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env bash
22
#
3-
# Substitute language and site in mkdocs.yml in _mkdocs.yml
4-
# language should be passed as an argument
3+
# Copy mkdocs.yml to _mkdocs.yml with substitute language and site.
4+
# the language should be passed as an argument
5+
# Place CSS to appropriate docs/src/ folder.
56
#
67

78
lang=$1
@@ -13,4 +14,4 @@ if [ $lang = "en" ]; then
1314
else
1415
sed -i'' -e "s/SITE_PLACEHOLDER/$lang/g" _mkdocs.yml
1516
fi
16-
cp -r css $lang/_css/ # mkdocs expects css to be in the root of the docs folder
17+
cp -r css src/$lang/_css/ # mkdocs expects css to be in the root of the docs folder

docs/docstrings.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

docs/fix_folder_redirects.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
"""File redirects instead of directory ones.
2+
3+
`mkdocs-redirects` respects option `use_directory_urls`, which is set to True for more readable URLs,
4+
hence it generates folder URLs for both redirect sources and targets.
5+
6+
However, our old site utilized file URLs, necessitating redirects from these old file URLs to the new folder URLs.
7+
8+
This script generates file redirect sources for all the folder redirects created by mkdocs-redirects.
9+
"""
110
import os
211
import shutil
312
import argparse

docs/mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ site_author: Andrey Sorokin
77
repo_name: TRegExpr
88
repo_url: https://github.com/andgineer/TRegExpr
99
edit_uri: edit/master/docs
10-
docs_dir: 'LANG_PLACEHOLDER'
10+
docs_dir: 'src/LANG_PLACEHOLDER'
1111
site_dir: '../site/SITE_PLACEHOLDER'
1212

1313
extra_css:
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)