diff --git a/.github/workflows/docs.yml b/.github/workflows/website.yml similarity index 55% rename from .github/workflows/docs.yml rename to .github/workflows/website.yml index d717c75f8..4174b0c10 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/website.yml @@ -16,21 +16,28 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout uutils.github.io Repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: repository: uutils/uutils.github.io path: './uutils.github.io' fetch-depth: 0 - name: Checkout Coreutils Repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: repository: uutils/coreutils path: './coreutils' fetch-depth: 0 + - name: Checkout Coreutils L10n Repository + uses: actions/checkout@v5 + with: + repository: uutils/coreutils-l10n + path: './coreutils-l10n' + fetch-depth: 0 + - name: Checkout Findutils Repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: repository: uutils/findutils path: './findutils' @@ -39,34 +46,73 @@ jobs: - name: Install `rust` toolchain uses: dtolnay/rust-toolchain@stable - - name: Install `libacl` + - name: Install system deps run: | - sudo apt install libacl1-dev - - - name: Download tldr archive - run: | - curl https://tldr.sh/assets/tldr.zip --output coreutils/docs/tldr.zip + sudo apt install libacl1-dev libselinux1-dev libsystemd-dev + pip install babel - name: Install necessary tools (mdbook and mdbook-toc) uses: taiki-e/install-action@v2 with: tool: mdbook,mdbook-toc + - name: Copy l10n locales into coreutils + run: | + # Only copy locales into utilities that already exist in coreutils + # Exclude en-US.ftl to preserve the coreutils English originals + for util_dir in coreutils-l10n/src/uu/*/; do + util=$(basename "$util_dir") + if [ -d "coreutils/src/uu/$util/locales" ]; then + for ftl in "$util_dir"/locales/*.ftl; do + [ -f "$ftl" ] || continue + [ "$(basename "$ftl")" = "en-US.ftl" ] && continue + cp "$ftl" "coreutils/src/uu/$util/locales/" + done + fi + done + # Copy uucore l10n files, excluding en-US.ftl + if [ -d "coreutils-l10n/src/uucore/locales" ]; then + for ftl in coreutils-l10n/src/uucore/locales/*.ftl; do + [ -f "$ftl" ] || continue + [ "$(basename "$ftl")" = "en-US.ftl" ] && continue + cp "$ftl" "coreutils/src/uucore/locales/" + done + fi + + - name: Patch mdbook theme with language selector + run: | + uutils.github.io/scripts/patch-mdbook-theme.sh coreutils/docs coreutils-l10n + - name: Build Coreutils Docs run: | cd coreutils + # Download and repack tldr zip: uudoc expects pages/common/ prefix + curl -sfL https://github.com/tldr-pages/tldr/releases/download/v2.3/tldr-pages.zip -o /tmp/tldr-raw.zip || true + if [ -f /tmp/tldr-raw.zip ]; then + mkdir -p /tmp/tldr-repack/pages + cd /tmp/tldr-repack && unzip -o /tmp/tldr-raw.zip -d pages/ > /dev/null + zip -r "$OLDPWD/docs/tldr.zip" pages/ > /dev/null + cd "$OLDPWD" + fi cargo run --bin uudoc --all-features cd docs + # Remove deprecated 'multilingual' field unsupported by newer mdbook + sed -i '/^multilingual/d' book.toml mdbook build + - name: Build Coreutils Docs (translations) + run: | + uutils.github.io/scripts/build-docs-l10n.sh coreutils + - name: Build Findutils Docs run: | - cd findutils - cd docs + cd findutils/docs + # Remove deprecated 'multilingual' field unsupported by newer mdbook + sed -i '/^multilingual/d' book.toml mdbook build - + - name: Run Zola - uses: shalzz/zola-deploy-action@v0.18.0 + uses: shalzz/zola-deploy-action@v0.21.0 env: BUILD_DIR: uutils.github.io BUILD_ONLY: true @@ -76,6 +122,12 @@ jobs: cp -r uutils.github.io/public public cp -r coreutils/docs/book public/coreutils/docs cp -r findutils/docs/book public/findutils/docs + # Copy translated docs to /coreutils/docs-{lang}/ + for lang_dir in coreutils/docs/book-*/; do + [ -d "$lang_dir" ] || continue + lang=$(basename "$lang_dir" | sed 's/^book-//') + cp -r "$lang_dir" "public/coreutils/docs-${lang}" + done - name: Upload artifact for checking the output uses: actions/upload-artifact@v4 @@ -83,7 +135,7 @@ jobs: path: ./public - name: Upload artifact for pages - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@v4 with: path: ./public @@ -158,6 +210,7 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest needs: build + if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'schedule' steps: - name: Deploy to GitHub Pages id: deployment diff --git a/.gitignore b/.gitignore index 15ce475e7..d90d7f863 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -/public/ \ No newline at end of file +/public/ +/static/syntax-* diff --git a/README.md b/README.md index 2baf0d1c4..f67b8508e 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,10 @@ This repository generates the user and dev documentations of https://github.com/ ## User documentation It is available on: -https://uutils.github.io/user/ +https://uutils.github.io/coreutils/docs/ Can be generated with: -``` +```bash cargo run --bin uudoc --all-features cd docs mdbook build @@ -20,7 +20,7 @@ It is available on: https://uutils.github.io/dev/coreutils/ Can be generated with: -``` +```bash cargo doc --no-deps --all-features --workspace ``` diff --git a/config.toml b/config.toml index be03294fa..35730ecbb 100644 --- a/config.toml +++ b/config.toml @@ -7,10 +7,13 @@ description = "" default_language = "en" -paginate_by = 10 - -generate_feed = true +generate_feeds = true [markdown] highlight_code = true -highlight_theme = "OneHalfLight" +highlight_theme = "css" + +highlight_themes_css = [ + { theme = "OneHalfDark", filename = "syntax-theme-dark.css" }, + { theme = "OneHalfLight", filename = "syntax-theme-light.css" }, +] diff --git a/content/_index.md b/content/_index.md index f25cb1b4b..d5781f237 100644 --- a/content/_index.md +++ b/content/_index.md @@ -4,21 +4,26 @@ template = "index.html" +++
- The commands you use everyday: ls, cp, etc.
+ The commands you use everyday: ls, cp, etc. Production ready!