Skip to content

Commit 77e888a

Browse files
authored
Enable 2025 ja ebook (#4531)
* Enable 2025 ja ebook * Temporarily comment out ebook check * Add generate ebooks workflow * Rename workflow * Add ebooks * Tidy up action * Update spines
1 parent 315cd15 commit 77e888a

4 files changed

Lines changed: 88 additions & 4 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
######################################
2+
## Custom Web Almanac GitHub action ##
3+
######################################
4+
#
5+
# A script that must be run in GitHub Actions to generate the ebooks.
6+
# Useful for those that don't have prince installed locally.
7+
#
8+
name: Generate ebooks
9+
10+
env:
11+
# Update periodically from https://www.princexml.com/latest/
12+
PRINCE_PACKAGE: 'prince_16.1-1_ubuntu24.04_amd64.deb'
13+
14+
on:
15+
workflow_dispatch:
16+
17+
jobs:
18+
build:
19+
name: Generate Ebooks
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout branch
23+
uses: actions/checkout@v7
24+
- name: Setup Node.js for use with actions
25+
uses: actions/setup-node@v7
26+
with:
27+
node-version: '24'
28+
- name: Set up Python 3.12
29+
uses: actions/setup-python@v7
30+
with:
31+
python-version: '3.12'
32+
- name: Install Asian Fonts
33+
if: ${{ github.event.inputs.ebooks == 'true' }}
34+
run: |
35+
# Install Japanese san-serif font
36+
sudo apt-get install -y fonts-ipafont-gothic
37+
# Install Chinese san-serif font
38+
sudo apt-get install -y fonts-arphic-uming
39+
# Install Korean san-serif font
40+
sudo apt-get install -y fonts-unfonts-core
41+
- name: Install PrinceXML
42+
if: ${{ github.event.inputs.ebooks == 'true' }}
43+
run: |
44+
wget https://www.princexml.com/download/${{ env.PRINCE_PACKAGE }} --directory-prefix=/tmp
45+
DEBIAN_FRONTEND=noninteractive sudo apt install -y /tmp/${{ env.PRINCE_PACKAGE }}
46+
- name: Install pdftk
47+
if: ${{ github.event.inputs.ebooks == 'true' }}
48+
run: sudo apt install pdftk
49+
- name: Run the website
50+
run: ./src/tools/scripts/run_and_test_website.sh
51+
- name: Generating Ebooks
52+
run: |
53+
cd src
54+
mkdir static/pdfs/
55+
npm run ebooks
56+
- name: Upload PDF artifact
57+
if: ${{ github.event.inputs.ebooks == 'true' }}
58+
uses: actions/upload-artifact@v7
59+
with:
60+
name: pdfs
61+
path: ./src/static/pdfs/*.pdf
62+
if-no-files-found: warn # 'warn' or 'ignore' are also available, defaults to `warn`
63+
retention-days: 5 # defaults to 90

src/config/2025.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"is_live": true,
55
"supported_languages": ["de","en","es","fr","hi","it","ja","nl","pt","ru","tr","uk","zh-CN","zh-TW"],
6-
"ebook_languages": ["en"]
6+
"ebook_languages": ["en","ja"]
77
}
88
],
99
"outline": [

src/config/last_updated.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,23 @@
235235
"date_modified": "2026-06-09T00:00:00.000Z",
236236
"hash": "1b4f831fe700d22363fcf6a84fffd009",
237237
"size": 12
238+
},
239+
"/static/pdfs/web_almanac_2025_ja.pdf": {
240+
"date_published": "2026-08-10T00:00:00.000Z",
241+
"date_modified": "2026-08-10T00:00:00.000Z",
242+
"hash": "84fd8a59f723beed0e3f93dba2135542",
243+
"size": 12
244+
},
245+
"/static/pdfs/web_almanac_2025_ja_cover_A5.pdf": {
246+
"date_published": "2026-08-10T00:00:00.000Z",
247+
"date_modified": "2026-08-10T00:00:00.000Z",
248+
"hash": "b73962b439e73aadf6f22554e597adfc"
249+
},
250+
"/static/pdfs/web_almanac_2025_ja_print_A5.pdf": {
251+
"date_published": "2026-08-10T00:00:00.000Z",
252+
"date_modified": "2026-08-10T00:00:00.000Z",
253+
"hash": "05c36794e850f494d862825794301586",
254+
"size": 12
238255
},
239256
"en/2019/chapters/accessibility.html": {
240257
"date_published": "2019-11-11T00:00:00.000Z",

src/templates/base/base_ebook.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,15 @@
119119

120120
{% set unit = 'mm' %}
121121
{% set spine = 25 %}
122+
{% if year == '2019' and lang == 'ja' %}{% set spine = 26.0 %}{% endif %}
122123
{% if year == '2020' and lang == 'en' %}{% set spine = 36.0 %}{% endif %}
123124
{% if year == '2020' and lang == 'ja' %}{% set spine = 37.0 %}{% endif %}
124-
{% if year == '2021' %}{% set spine = 46.5 %}{% endif %}
125-
{% if year == '2022' %}{% set spine = 42.5 %}{% endif %}
126-
{% if year == '2024' %}{% set spine = 42.5 %}{% endif %}
125+
{% if year == '2021' and lang == 'en' %}{% set spine = 46.5 %}{% endif %}
126+
{% if year == '2022' and lang == 'ja' %}{% set spine = 43.5 %}{% endif %}
127+
{% if year == '2024' and lang == 'en' %}{% set spine = 44.5 %}{% endif %}
128+
{% if year == '2024' and lang == 'ha' %}{% set spine = 46.0 %}{% endif %}
129+
{% if year == '2025' and lang == 'en' %}{% set spine = 33.5 %}{% endif %}
130+
{% if year == '2025' and lang == 'ja' %}{% set spine = 34.5 %}{% endif %}
127131
{% set pageWidth = 148 %}
128132
{% set pageHeight = 210 %}
129133
{% if request.args.get('unit') != None %}{% set unit = request.args.get('unit') %}{% endif %}

0 commit comments

Comments
 (0)