mirror of
https://codeberg.org/openpgp/notes.git
synced 2025-09-10 11:49:40 +02:00
Add make target to convert all SVGs to plain SVG before rendering
Adapt HTML and EPUB targets to run conversion target before rendering EPUB or HTML output. Fixes https://codeberg.org/openpgp/notes/issues/166 Signed-off-by: David Runge <dave@sleepmap.de>
This commit is contained in:
parent
9848143e77
commit
bacbecc77f
5 changed files with 15 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@
|
||||||
|
|
||||||
.idea
|
.idea
|
||||||
book/build/
|
book/build/
|
||||||
|
book/source/diag_converted
|
||||||
|
|
|
@ -18,7 +18,7 @@ steps:
|
||||||
image: archlinux:latest
|
image: archlinux:latest
|
||||||
commands:
|
commands:
|
||||||
- pacman -Sy --needed --noconfirm archlinux-keyring
|
- 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
|
# 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"
|
- patch -Np1 -d /usr/lib/python3.11/site-packages/ -i "$(pwd)/book/patches/sphinx-11766.patch"
|
||||||
- make -C book epub-check
|
- make -C book epub-check
|
||||||
|
|
|
@ -19,5 +19,5 @@ steps:
|
||||||
image: archlinux:latest
|
image: archlinux:latest
|
||||||
commands:
|
commands:
|
||||||
- pacman -Sy --needed --noconfirm archlinux-keyring
|
- 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
|
- make -C book html-linkcheck
|
||||||
|
|
|
@ -7,7 +7,7 @@ WORKDIR /book
|
||||||
# fix EPUB rendering: https://github.com/sphinx-doc/sphinx/issues/11598
|
# fix EPUB rendering: https://github.com/sphinx-doc/sphinx/issues/11598
|
||||||
RUN \
|
RUN \
|
||||||
pacman -Sy --needed --noconfirm archlinux-keyring \
|
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 \
|
&& patch -Np1 -d /usr/lib/python3.11/site-packages/ -i /book/patches/sphinx-11766.patch \
|
||||||
&& make epub html
|
&& make epub html
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
CODESPELL ?= codespell
|
CODESPELL ?= codespell
|
||||||
EBOOK_VIEWER ?= ebook-viewer
|
EBOOK_VIEWER ?= ebook-viewer
|
||||||
EPUBCHECK ?= epubcheck
|
EPUBCHECK ?= epubcheck
|
||||||
|
INKSCAPE ?= inkscape
|
||||||
SPHINXOPTS ?= -W
|
SPHINXOPTS ?= -W
|
||||||
SPHINXBUILD ?= sphinx-build
|
SPHINXBUILD ?= sphinx-build
|
||||||
LYCHEE ?= lychee
|
LYCHEE ?= lychee
|
||||||
|
@ -17,6 +18,13 @@ WATCHEXEC ?= watchexec
|
||||||
SOURCEDIR = source
|
SOURCEDIR = source
|
||||||
BUILDDIR = build
|
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
|
epub-check: clean epub
|
||||||
@$(EPUBCHECK) "$(BUILDDIR)/epub/"*.epub
|
@$(EPUBCHECK) "$(BUILDDIR)/epub/"*.epub
|
||||||
|
|
||||||
|
@ -29,6 +37,9 @@ epub-watch:
|
||||||
help:
|
help:
|
||||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||||
|
|
||||||
|
html: convert-svg
|
||||||
|
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||||
|
|
||||||
html-linkcheck: clean html
|
html-linkcheck: clean html
|
||||||
@$(LYCHEE) "$(BUILDDIR)/html/"*.html
|
@$(LYCHEE) "$(BUILDDIR)/html/"*.html
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue