diff --git a/.gitignore b/.gitignore index ad3d966..e5c4802 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .idea book/build/ +book/source/diag_converted diff --git a/.woodpecker/epub.yml b/.woodpecker/epub.yml index 798fbea..07c6951 100644 --- a/.woodpecker/epub.yml +++ b/.woodpecker/epub.yml @@ -18,7 +18,7 @@ steps: image: archlinux:latest commands: - pacman -Sy --needed --noconfirm archlinux-keyring - - pacman -Syu --needed --noconfirm epubcheck make patch python-myst-parser python-sphinx + - pacman -Syu --needed --noconfirm epubcheck inkscape make patch python-myst-parser python-sphinx # fix sphinx: https://github.com/sphinx-doc/sphinx/issues/11598 - patch -Np1 -d /usr/lib/python3.11/site-packages/ -i "$(pwd)/book/patches/sphinx-11766.patch" - make -C book epub-check diff --git a/.woodpecker/links.yml b/.woodpecker/links.yml index 01acf6b..825d37f 100644 --- a/.woodpecker/links.yml +++ b/.woodpecker/links.yml @@ -19,5 +19,5 @@ steps: image: archlinux:latest commands: - pacman -Sy --needed --noconfirm archlinux-keyring - - pacman -Syu --needed --noconfirm lychee make python-myst-parser python-sphinx + - pacman -Syu --needed --noconfirm inkscape lychee make python-myst-parser python-sphinx - make -C book html-linkcheck diff --git a/Dockerfile b/Dockerfile index 24aadea..5cca0cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ WORKDIR /book # fix EPUB rendering: https://github.com/sphinx-doc/sphinx/issues/11598 RUN \ pacman -Sy --needed --noconfirm archlinux-keyring \ - && pacman -Syu --needed --noconfirm epubcheck make patch python-myst-parser python-sphinx \ + && pacman -Syu --needed --noconfirm inkscape make patch python-myst-parser python-sphinx \ && patch -Np1 -d /usr/lib/python3.11/site-packages/ -i /book/patches/sphinx-11766.patch \ && make epub html diff --git a/book/Makefile b/book/Makefile index 16e7343..5551bc3 100644 --- a/book/Makefile +++ b/book/Makefile @@ -9,6 +9,7 @@ CODESPELL ?= codespell EBOOK_VIEWER ?= ebook-viewer EPUBCHECK ?= epubcheck +INKSCAPE ?= inkscape SPHINXOPTS ?= -W SPHINXBUILD ?= sphinx-build LYCHEE ?= lychee @@ -17,6 +18,13 @@ WATCHEXEC ?= watchexec SOURCEDIR = source BUILDDIR = build +# convert all SVG to plain SVGs without metadata and paths instead of text +convert-svg: + for file in $(SOURCEDIR)/diag/*.svg; do $(INKSCAPE) --export-text-to-path --export-plain-svg --export-filename=$(SOURCEDIR)/diag_converted/$$(basename $$file) $$file; done + +epub: convert-svg + @$(SPHINXBUILD) -M epub "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + epub-check: clean epub @$(EPUBCHECK) "$(BUILDDIR)/epub/"*.epub @@ -29,6 +37,9 @@ epub-watch: help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) +html: convert-svg + @$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + html-linkcheck: clean html @$(LYCHEE) "$(BUILDDIR)/html/"*.html