From 51858103638c09608bc319cc0d04febf064d0b1b Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Mon, 10 Aug 2026 10:41:15 +0100 Subject: [PATCH 1/7] Enable 2025 ja ebook --- src/config/2025.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/2025.json b/src/config/2025.json index fa147a2a2c7..241112a95fc 100644 --- a/src/config/2025.json +++ b/src/config/2025.json @@ -3,7 +3,7 @@ { "is_live": true, "supported_languages": ["de","en","es","fr","hi","it","ja","nl","pt","ru","tr","uk","zh-CN","zh-TW"], - "ebook_languages": ["en"] + "ebook_languages": ["en","ja"] } ], "outline": [ From d21c36ecc33d9e7b8fc3d6aa7f4e4c2759e8fb89 Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Mon, 10 Aug 2026 11:22:53 +0100 Subject: [PATCH 2/7] Temporarily comment out ebook check --- src/server/tests/helpers_test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/tests/helpers_test.py b/src/server/tests/helpers_test.py index 3f6edc313fd..86b63b43556 100644 --- a/src/server/tests/helpers_test.py +++ b/src/server/tests/helpers_test.py @@ -393,9 +393,9 @@ def test_en_ebook_size_at_least_10_mb(): assert get_ebook_size_in_mb("en", "2019") >= 8 -@pytest.mark.parametrize("config", all_ebooks) -def test_all_configured_ebooks_at_least_10_mb(config): - assert get_ebook_size_in_mb(config[0], config[1]) >= 8 +# @pytest.mark.parametrize("config", all_ebooks) +# def test_all_configured_ebooks_at_least_10_mb(config): +# assert get_ebook_size_in_mb(config[0], config[1]) >= 8 def test_ebook_size_non_existant_language_is_zero(): From 5a3433a35a3ea6fd7e3284579f6c90b3ea481639 Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Mon, 10 Aug 2026 11:24:50 +0100 Subject: [PATCH 3/7] Add generate ebooks workflow --- .github/workflows/generate-ebooks.yml | 65 +++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/generate-ebooks.yml diff --git a/.github/workflows/generate-ebooks.yml b/.github/workflows/generate-ebooks.yml new file mode 100644 index 00000000000..0f460818d7f --- /dev/null +++ b/.github/workflows/generate-ebooks.yml @@ -0,0 +1,65 @@ +###################################### +## Custom Web Almanac GitHub action ## +###################################### +# +# A script that must be run in GitHub Actions to generate the ebooks. +# Useful for those that don't have prince installed locally. +# +# This should be run before every release +# +name: Predeploy script + +env: + # Update periodically from https://www.princexml.com/latest/ + PRINCE_PACKAGE: 'prince_16.1-1_ubuntu24.04_amd64.deb' + +on: + workflow_dispatch: + +jobs: + build: + name: Update Timestamps and Generate Ebooks + runs-on: ubuntu-latest + steps: + - name: Checkout branch + uses: actions/checkout@v7 + - name: Setup Node.js for use with actions + uses: actions/setup-node@v7 + with: + node-version: '24' + - name: Set up Python 3.12 + uses: actions/setup-python@v7 + with: + python-version: '3.12' + - name: Install Asian Fonts + if: ${{ github.event.inputs.ebooks == 'true' }} + run: | + # Install Japanese san-serif font + sudo apt-get install -y fonts-ipafont-gothic + # Install Chinese san-serif font + sudo apt-get install -y fonts-arphic-uming + # Install Korean san-serif font + sudo apt-get install -y fonts-unfonts-core + - name: Install PrinceXML + if: ${{ github.event.inputs.ebooks == 'true' }} + run: | + wget https://www.princexml.com/download/${{ env.PRINCE_PACKAGE }} --directory-prefix=/tmp + DEBIAN_FRONTEND=noninteractive sudo apt install -y /tmp/${{ env.PRINCE_PACKAGE }} + - name: Install pdftk + if: ${{ github.event.inputs.ebooks == 'true' }} + run: sudo apt install pdftk + - name: Run the website + run: ./src/tools/scripts/run_and_test_website.sh + - name: Generating Ebooks + run: | + cd src + mkdir static/pdfs/ + npm run ebooks + - name: Upload PDF artifact + if: ${{ github.event.inputs.ebooks == 'true' }} + uses: actions/upload-artifact@v7 + with: + name: pdfs + path: ./src/static/pdfs/*.pdf + if-no-files-found: warn # 'warn' or 'ignore' are also available, defaults to `warn` + retention-days: 5 # defaults to 90 From 44daf5678559ab9c9372d8a88bc4b67c7becda6a Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Mon, 10 Aug 2026 11:25:27 +0100 Subject: [PATCH 4/7] Rename workflow --- .github/workflows/generate-ebooks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-ebooks.yml b/.github/workflows/generate-ebooks.yml index 0f460818d7f..b13cfe2d244 100644 --- a/.github/workflows/generate-ebooks.yml +++ b/.github/workflows/generate-ebooks.yml @@ -7,7 +7,7 @@ # # This should be run before every release # -name: Predeploy script +name: Generate ebooks env: # Update periodically from https://www.princexml.com/latest/ From 31c2f66ceccf83d52a9b27269ff8bbee045e6eca Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Mon, 10 Aug 2026 12:49:04 +0100 Subject: [PATCH 5/7] Add ebooks --- src/config/last_updated.json | 17 +++++++++++++++++ src/server/tests/helpers_test.py | 6 +++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/config/last_updated.json b/src/config/last_updated.json index d1fd0dcac49..0d5a88b9219 100644 --- a/src/config/last_updated.json +++ b/src/config/last_updated.json @@ -235,6 +235,23 @@ "date_modified": "2026-06-09T00:00:00.000Z", "hash": "1b4f831fe700d22363fcf6a84fffd009", "size": 12 + }, + "/static/pdfs/web_almanac_2025_ja.pdf": { + "date_published": "2026-08-10T00:00:00.000Z", + "date_modified": "2026-08-10T00:00:00.000Z", + "hash": "84fd8a59f723beed0e3f93dba2135542", + "size": 12 + }, + "/static/pdfs/web_almanac_2025_ja_cover_A5.pdf": { + "date_published": "2026-08-10T00:00:00.000Z", + "date_modified": "2026-08-10T00:00:00.000Z", + "hash": "b73962b439e73aadf6f22554e597adfc" + }, + "/static/pdfs/web_almanac_2025_ja_print_A5.pdf": { + "date_published": "2026-08-10T00:00:00.000Z", + "date_modified": "2026-08-10T00:00:00.000Z", + "hash": "05c36794e850f494d862825794301586", + "size": 12 }, "en/2019/chapters/accessibility.html": { "date_published": "2019-11-11T00:00:00.000Z", diff --git a/src/server/tests/helpers_test.py b/src/server/tests/helpers_test.py index 86b63b43556..3f6edc313fd 100644 --- a/src/server/tests/helpers_test.py +++ b/src/server/tests/helpers_test.py @@ -393,9 +393,9 @@ def test_en_ebook_size_at_least_10_mb(): assert get_ebook_size_in_mb("en", "2019") >= 8 -# @pytest.mark.parametrize("config", all_ebooks) -# def test_all_configured_ebooks_at_least_10_mb(config): -# assert get_ebook_size_in_mb(config[0], config[1]) >= 8 +@pytest.mark.parametrize("config", all_ebooks) +def test_all_configured_ebooks_at_least_10_mb(config): + assert get_ebook_size_in_mb(config[0], config[1]) >= 8 def test_ebook_size_non_existant_language_is_zero(): From 06684061374b49bd8fcda628e8b8cee2eb3da989 Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Mon, 10 Aug 2026 13:44:34 +0100 Subject: [PATCH 6/7] Tidy up action --- .github/workflows/generate-ebooks.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/generate-ebooks.yml b/.github/workflows/generate-ebooks.yml index b13cfe2d244..38053001241 100644 --- a/.github/workflows/generate-ebooks.yml +++ b/.github/workflows/generate-ebooks.yml @@ -5,8 +5,6 @@ # A script that must be run in GitHub Actions to generate the ebooks. # Useful for those that don't have prince installed locally. # -# This should be run before every release -# name: Generate ebooks env: @@ -18,7 +16,7 @@ on: jobs: build: - name: Update Timestamps and Generate Ebooks + name: Generate Ebooks runs-on: ubuntu-latest steps: - name: Checkout branch From 5a3b873d80e275417b52e88f8d3949856ffd82b9 Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Mon, 10 Aug 2026 14:13:23 +0100 Subject: [PATCH 7/7] Update spines --- src/templates/base/base_ebook.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/templates/base/base_ebook.html b/src/templates/base/base_ebook.html index 3e65f05f45a..1bd451dfe0c 100644 --- a/src/templates/base/base_ebook.html +++ b/src/templates/base/base_ebook.html @@ -119,11 +119,15 @@ {% set unit = 'mm' %} {% set spine = 25 %} +{% if year == '2019' and lang == 'ja' %}{% set spine = 26.0 %}{% endif %} {% if year == '2020' and lang == 'en' %}{% set spine = 36.0 %}{% endif %} {% if year == '2020' and lang == 'ja' %}{% set spine = 37.0 %}{% endif %} -{% if year == '2021' %}{% set spine = 46.5 %}{% endif %} -{% if year == '2022' %}{% set spine = 42.5 %}{% endif %} -{% if year == '2024' %}{% set spine = 42.5 %}{% endif %} +{% if year == '2021' and lang == 'en' %}{% set spine = 46.5 %}{% endif %} +{% if year == '2022' and lang == 'ja' %}{% set spine = 43.5 %}{% endif %} +{% if year == '2024' and lang == 'en' %}{% set spine = 44.5 %}{% endif %} +{% if year == '2024' and lang == 'ha' %}{% set spine = 46.0 %}{% endif %} +{% if year == '2025' and lang == 'en' %}{% set spine = 33.5 %}{% endif %} +{% if year == '2025' and lang == 'ja' %}{% set spine = 34.5 %}{% endif %} {% set pageWidth = 148 %} {% set pageHeight = 210 %} {% if request.args.get('unit') != None %}{% set unit = request.args.get('unit') %}{% endif %}