From a1eec0d84f8131a35f39f070371f3a8e853c787f Mon Sep 17 00:00:00 2001 From: Ced Date: Tue, 31 Oct 2023 09:21:42 +0000 Subject: [PATCH 1/5] Clean up makefile after BW ebook Accumulated some debts through panic debug as CI was broken... Nothing dramatic but could do with a bit of cleanup. Simplify dependency graph, might also make the whole thing faster when run in parallel --- book/makefile | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/book/makefile b/book/makefile index 7a71ac4a..0e8c81c3 100644 --- a/book/makefile +++ b/book/makefile @@ -87,33 +87,27 @@ book_serif/book.pdf: $(src_all) book_sans_serif/book_sans_serif.pdf: $(src_all) $(LATEX) -output-directory=book_sans_serif book_sans_serif.tex -.PHONY: bw_epub copy_ebook_files +.PHONY: copy_ebook_files epub/%.epub: %.tex $(src_all) cover/cover-page.xbb $(EBOOK) -f epub $< -bw-book-epub: - mkdir -p bw-book-epub - -bw-book-epub/OEBPS: bw-book-epub - mkdir -p bw-book-epub/OEBPS - -copy_ebook_files: build_ebook | bw-book-epub +copy_ebook_files: build_ebook $(RSYNC) book-epub/ bw-book-epub/ # We not convert SVG to B&W or lower res for now as they are super small # anyway -bw-book-epub/OEBPS/%.jpg: %.jpg copy_ebook_files +bw-book-epub/OEBPS/%.jpg: %.jpg + mkdir -p $(dir $@) $(CONVERT_PIC) $< $(REDUCE_PIC) $@ -bw-book-epub/OEBPS/%.png: %.png copy_ebook_files +bw-book-epub/OEBPS/%.png: %.png + mkdir -p $(dir $@) $(CONVERT_PIC) $< $(REDUCE_PIC) $@ epub/bw_book.epub: copy_ebook_files $(bw_images) cd bw-book-epub; zip -q9XrD ../epub/bw_book.epub ./ -bw_epub: epub/bw_book.epub | bw-book-epub - # Now with the rules # Expected usual rules first .PHONY: all @@ -279,9 +273,10 @@ website: html ../website/_bundle_install_done $(ruby_src) cd ../website && ruby modify_build.rb # Debug Stuff from now on -.PHONY: quick show_tools_version printvars +.PHONY: quick quick_ebook show_tools_version printvars # Those 2 targets allow fast debug cycles but not resolving references etc +# They also ignore dependencies and run each time you call them. quick: # run latex only once no biber, no references etc... $(LATEX) -e '$$max_repeat=1' -output-directory=book_serif book.tex From 5d89f81d526b22fec018a3925d05ecc34ea5492f Mon Sep 17 00:00:00 2001 From: Ced Date: Tue, 31 Oct 2023 14:34:34 +0000 Subject: [PATCH 2/5] Remove sans-serif ebook hacks Those are not needed anymore. - Symbolic links - Update .gitignore files --- .gitignore | 40 +++++++++------------------------------- book/book_sans_serif.tex | 4 +--- book/sourdough_book.tex | 1 - 3 files changed, 10 insertions(+), 35 deletions(-) delete mode 120000 book/sourdough_book.tex diff --git a/.gitignore b/.gitignore index 12d6473e..d0c26f21 100644 --- a/.gitignore +++ b/.gitignore @@ -12,53 +12,31 @@ *.run.xml *.html *.dlog +*.bak +*.opf book/book.out .vscode/ -book/book.synctex* -book/tikz-cache/* book/bookch* -book/content.opf -book/output-epub book/figures/*.png book/figures/*.pdf book/figures/*.in -book/tables/*.png -book/tables/*.pdf -book/release/* book/book*.4ct book/book*.4tc -book/book*.aux -book/book*.bbl -book/book*.bcf -book/book*.blg book/book*.css book/book*.dvi -book/book*.html book/book*.idv book/book*.lg -book/book*.log -book/book*.mobi -book/book*.azw3 -book/book*.epub book/book*.ncx book/book*.out -book/book*.pdf -book/book*.run.xml book/book*.tmp -book/book*.toc book/book*.xref -book/book*.html book/book*.svg -book/book-epub/ -book/book-mobi/ -book/book-azw3/ -*.bak -book_sans_serif/ -book_serif/ -release_sans_serif/ -book/book_sans_serif-epub/ +# Directories created during build +book/book_sans_serif/* +book/book_serif/* book/static_website_html/* +book/website/static_website_html/* +book/epub/ +book/book-epub/ book/bw-book-epub/* -epub/ -*.opf -website/static_website_html/* +book/release/* diff --git a/book/book_sans_serif.tex b/book/book_sans_serif.tex index 0377a38c..4174a9f7 100644 --- a/book/book_sans_serif.tex +++ b/book/book_sans_serif.tex @@ -1,4 +1,2 @@ \def\isaccessible{1} -% We have to use a symlink to book.tex to prevent tex4ebook to load book.ht4 -% before loading any other package and create conflicts -\input{sourdough_book.tex} +\input{book.tex} diff --git a/book/sourdough_book.tex b/book/sourdough_book.tex deleted file mode 120000 index c0a4f0d6..00000000 --- a/book/sourdough_book.tex +++ /dev/null @@ -1 +0,0 @@ -book.tex \ No newline at end of file From ec254e80e03bc475dee021698110cf11a2dbace3 Mon Sep 17 00:00:00 2001 From: Ced Date: Wed, 1 Nov 2023 12:04:12 +0000 Subject: [PATCH 3/5] Fix the MIME type for BW ebook last fix only fixed the xml container not the MIME type :( --- book/makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/book/makefile b/book/makefile index 0e8c81c3..b87fa333 100644 --- a/book/makefile +++ b/book/makefile @@ -106,6 +106,7 @@ bw-book-epub/OEBPS/%.png: %.png $(CONVERT_PIC) $< $(REDUCE_PIC) $@ epub/bw_book.epub: copy_ebook_files $(bw_images) + cd bw-book-epub; zip -q0X ../epub/bw_book.epub mimetype cd bw-book-epub; zip -q9XrD ../epub/bw_book.epub ./ # Now with the rules From d495757e15305086f9d88b695415b5298bf594f2 Mon Sep 17 00:00:00 2001 From: Ced Date: Thu, 2 Nov 2023 09:28:28 +0000 Subject: [PATCH 4/5] Stop on first error in quick target This is only useful when debugging so makes sense not to wait for the entire compilation. so support for epub though would require to change the config file with Make:htlatex { latex_par="-halt-on-error"} --- book/makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/makefile b/book/makefile index b87fa333..24b61495 100644 --- a/book/makefile +++ b/book/makefile @@ -279,7 +279,7 @@ website: html ../website/_bundle_install_done $(ruby_src) # Those 2 targets allow fast debug cycles but not resolving references etc # They also ignore dependencies and run each time you call them. quick: # run latex only once no biber, no references etc... - $(LATEX) -e '$$max_repeat=1' -output-directory=book_serif book.tex + $(LATEX) -e '$$max_repeat=1' -halt-on-error -output-directory=book_serif book.tex quick_ebook: cover/cover-page.xbb # run latex only once no biber, ref etc... $(EBOOK) --mode draft -f epub book.tex From c7744097596bb2b27321939107adb10a9dfcf5b5 Mon Sep 17 00:00:00 2001 From: Ced Date: Thu, 2 Nov 2023 09:31:08 +0000 Subject: [PATCH 5/5] Factorize epub format We only build that right now so let's put in main macro --- book/makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/book/makefile b/book/makefile index 24b61495..fb9f4f8e 100644 --- a/book/makefile +++ b/book/makefile @@ -1,6 +1,6 @@ # Macros for commands LATEX := latexmk -cd -pdflua -lualatex="lualatex -interaction=nonstopmode" -synctex=1 -use-make -EBOOK := tex4ebook --lua -d epub -c tex4ebook.cfg +EBOOK := tex4ebook --lua -d epub -f epub -c tex4ebook.cfg WEBSITE := make4ht --lua -c website.cfg -a debug -uf html5+tidy+common_domfilters+dvisvgm_hashes CLEAN := latexmk -cd -lualatex -c -use-make CHECK_1 := lacheck @@ -90,7 +90,7 @@ book_sans_serif/book_sans_serif.pdf: $(src_all) .PHONY: copy_ebook_files epub/%.epub: %.tex $(src_all) cover/cover-page.xbb - $(EBOOK) -f epub $< + $(EBOOK) $< copy_ebook_files: build_ebook $(RSYNC) book-epub/ bw-book-epub/ @@ -282,7 +282,7 @@ quick: # run latex only once no biber, no references etc... $(LATEX) -e '$$max_repeat=1' -halt-on-error -output-directory=book_serif book.tex quick_ebook: cover/cover-page.xbb # run latex only once no biber, ref etc... - $(EBOOK) --mode draft -f epub book.tex + $(EBOOK) --mode draft book.tex show_tools_version: # Show version of tools used on the build machine - git log -n 1