Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/generate-ebooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
######################################
## 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.
#
name: Generate ebooks

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: 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
2 changes: 1 addition & 1 deletion src/config/2025.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
17 changes: 17 additions & 0 deletions src/config/last_updated.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 7 additions & 3 deletions src/templates/base/base_ebook.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down