Merge branch 'main' into 225-ebook-situation

This commit is contained in:
Ced
2023-10-13 14:17:27 +01:00
6 changed files with 50 additions and 30 deletions

View File

@@ -29,4 +29,4 @@ jobs:
options: -v ${{ github.workspace }}:/app
run: |
cd /app/book
make -j build_pdf build_serif_ebook
make -j build_pdf build_ebook

View File

@@ -20,6 +20,7 @@ RUN apt-get update && \
wget \
ruby3.1 \
ruby-dev \
imagemagick \
build-essential
WORKDIR /root
@@ -31,9 +32,4 @@ COPY website/Gemfile /root
COPY website/.ruby-version /root
RUN bundle install
# Install support to build amazon kindle books
RUN wget https://archive.org/download/kindlegen_linux_2_6_i386_v2_9/kindlegen_linux_2.6_i386_v2_9.tar.gz && \
tar xzf kindlegen_linux_2.6_i386_v2_9.tar.gz && \
mv kindlegen /usr/bin
CMD ["/bin/bash"]

View File

@@ -32,7 +32,8 @@ make
Then you can check out the file `book/book.pdf`
If you want to 🍞 bake all the versions including ebook formats (.pdf, .epub, .mobi, .azw3) run:
If you want to 🍞 bake all the versions including ebook variants (.pdf, .epub
in colour or size optimized Black&White), run:
```console
make bake
@@ -50,7 +51,8 @@ cd book/
make
```
If you want to 🍞 bake all the versions including ebook formats (.pdf, .epub, .mobi, .azw3) run:
If you want to 🍞 bake all the versions including ebook variants (.pdf, .epub
in colour or size optimized Black&White), run:
```console
cd book/

View File

@@ -5,6 +5,11 @@ WEBSITE := make4ht --lua -c website.cfg -a debug -uf html5+tidy+common_domfilter
CLEAN := latexmk -cd -lualatex -c -use-make
CHECK_1 := lacheck
CHECK_2 := chktex
CONVERT_PIC := convert
REDUCE_PIC := -resize '800x800>' \
-strip -interlace Plane -gaussian-blur 0.05 -quality 85\% \
-set colorspace Gray -separate -evaluate-sequence Mean
RSYNC := rsync -au --exclude 'book.epub' --exclude '*.jpg' --exclude '*.png'
# We want bash as shell
SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
@@ -36,8 +41,12 @@ images += $(wildcard images/*.jpg)
images += $(wildcard images/*.png)
images += $(wildcard images/*/*.png)
images += $(foreach directory, $(chapters), $(wildcard $(directory)/*.jpg))
images += $(foreach directory, $(chapters), $(wildcard $(directory)/*/*.jpg))
images += $(foreach directory, $(chapters), $(wildcard $(directory)/*.png))
images += $(foreach directory, $(chapters), $(wildcard $(directory)/*/*.png))
# Black and White ebook, we will just re-zip directory after converting the
# images to lower resolution and greyscale
bw_images := $(addprefix bw-book-epub/OEBPS/, $(images))
src_all := $(src_tex) $(src_figures) $(src_tables) tex4ebook.cfg book.mk4 $(images)
@@ -78,25 +87,32 @@ 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
epub/%.epub: %.tex $(src_all) cover/cover-page.xbb
$(EBOOK) -f epub $<
copy_ebook_files: build_ebook
mkdir -p bw-book-epub/
rsync -au --exclude "book.epub" book-epub/ bw-book-epub/
bw-book-epub:
mkdir -p bw-book-epub
convert_ebook_images: copy_ebook_files
mogrify -resize '800x800>' \
tstrip -interlace Plane -gaussian-blur 0.05 -quality 85\% \
-set colorspace Gray -separate -evaluate-sequence Mean $(bw_images)
copy_ebook_files: build_ebook | bw-book-epub
$(RSYNC) book-epub/ bw-book-epub/
bw_ebook.zip: convert_ebook_images
# We not convert SVG to B&W or lower res for now as they are super small
# anyway
bw-book-epub/OEBPS/%.jpg: %.jpg
$(CONVERT_PIC) $< $(REDUCE_PIC) $@
bw-book-epub/OEBPS/%.png: %.png
$(CONVERT_PIC) $< $(REDUCE_PIC) $@
bw_ebook.zip: copy_ebook_files $(bw_images)
zip -qXr9D bw_ebook.zip bw-book-epub
epub/bw_book.epub: bw_ebook.zip
mv bw_ebook.zip epub/bw_book.epub
bw_epub: epub/bw_book.epub
bw_epub: epub/bw_book.epub | bw-book-epub
# Now with the rules
# Expected usual rules first
@@ -166,9 +182,9 @@ build_serif_pdf: book_serif/book.pdf
build_sans_serif_pdf: book_sans_serif/book_sans_serif.pdf
build_ebook: epub/book.epub | make_release_dir
build_ebook: epub/book.epub
build_bw_ebook: epub/bw_book.epub | make_release_dir
build_bw_ebook: epub/bw_book.epub
.PHONY: export_figures check
# Requires that you have docker running on your computer.
@@ -229,18 +245,19 @@ mrproper: clean
-rm -rf $(website_dir)
# top level releases rules
.PHONY: bake make_release_dir release_serif release_sans_serif
.PHONY: bake release_serif release_sans_serif
bake: release_serif release_sans_serif
make_release_dir:
release:
mkdir -p release
release_serif: build_serif_pdf build_ebook build_bw_ebook | make_release_dir
release_serif: build_serif_pdf build_ebook build_bw_ebook | release
cp book_serif/book.pdf release/TheBreadCode-The-Sourdough-Framework.pdf
cp epub/book.epub release/TheBreadCode-The-Sourdough-Framework.epub
cp epub/bw_book.epub release/TheBreadCode-The-Sourdough-Framework-black-and-white.epub
release_sans_serif: build_sans_serif_pdf | make_release_dir
release_sans_serif: build_sans_serif_pdf | release
cp book_sans_serif/book_sans_serif.pdf release/TheBreadCode-The-Sourdough-Framework-sans-serif.pdf
# Website stuff
@@ -297,6 +314,10 @@ show_tools_version: # Show version of tools used on the build machine
@echo ""
- ruby --version
@echo ""
- convert --version
@echo ""
- rsync --version
# You can find the value of variable X with the following command:
# make print-X

View File

@@ -1,18 +1,19 @@
\begin{tabular}{@{}>{\bfseries}p{0.3\textwidth}p{0.3\textwidth}p{0.3\textwidth}@{}}
\def\arraystretch{1.6}
\begin{tabular}{@{}p{0.23\textwidth}p{0.33\textwidth}p{0.33\textwidth}@{}}
\toprule
\thead{Method} & \thead{Advantages} & \thead{Disadvantages} \\ \midrule
\textbf{Method} & \textbf{Advantages} & \textbf{Disadvantages} \\
\midrule
Room temperature & The easiest option. Best for bread that is eaten within a day.
Crust typically stays crisp when humidity not too high.
& Bread dries out very quickly.\\
& Bread dries out very quickly.\\
Room temperature in container & Good for up to a week. Catches mold more quickly.
& Bread needs to be toasted for crust to become crisp again.\\
& Bread needs to be toasted for crust to become crisp again.\\
Fridge & Bread stays good for weeks. Can dry out a little bit when not using air-tight container.
& Bread needs to be toasted. Requires fridge and energy.\\
& Bread needs to be toasted. Requires fridge and energy.\\
Freezer & Bread stays good for years.
& Requires thawing and then toasting. Requires freezer and energy.\\
\bottomrule
\end{tabular}

View File

@@ -22,7 +22,7 @@ website: mrproper
.PHONY: validate
validate: mrproper
docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make -j build_pdf build_serif_ebook"
docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make -j build_pdf build_ebook"
.PHONY: mrproper
mrproper: