mirror of
https://github.com/hendricius/the-sourdough-framework
synced 2025-11-09 04:31:11 -06:00
Merge branch 'main' into 225-ebook-situation
This commit is contained in:
2
.github/workflows/validate-book-build.yml
vendored
2
.github/workflows/validate-book-build.yml
vendored
@@ -29,4 +29,4 @@ jobs:
|
|||||||
options: -v ${{ github.workspace }}:/app
|
options: -v ${{ github.workspace }}:/app
|
||||||
run: |
|
run: |
|
||||||
cd /app/book
|
cd /app/book
|
||||||
make -j build_pdf build_serif_ebook
|
make -j build_pdf build_ebook
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ RUN apt-get update && \
|
|||||||
wget \
|
wget \
|
||||||
ruby3.1 \
|
ruby3.1 \
|
||||||
ruby-dev \
|
ruby-dev \
|
||||||
|
imagemagick \
|
||||||
build-essential
|
build-essential
|
||||||
|
|
||||||
WORKDIR /root
|
WORKDIR /root
|
||||||
@@ -31,9 +32,4 @@ COPY website/Gemfile /root
|
|||||||
COPY website/.ruby-version /root
|
COPY website/.ruby-version /root
|
||||||
RUN bundle install
|
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"]
|
CMD ["/bin/bash"]
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ make
|
|||||||
|
|
||||||
Then you can check out the file `book/book.pdf`
|
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
|
```console
|
||||||
make bake
|
make bake
|
||||||
@@ -50,7 +51,8 @@ cd book/
|
|||||||
make
|
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
|
```console
|
||||||
cd book/
|
cd book/
|
||||||
|
|||||||
@@ -5,6 +5,11 @@ WEBSITE := make4ht --lua -c website.cfg -a debug -uf html5+tidy+common_domfilter
|
|||||||
CLEAN := latexmk -cd -lualatex -c -use-make
|
CLEAN := latexmk -cd -lualatex -c -use-make
|
||||||
CHECK_1 := lacheck
|
CHECK_1 := lacheck
|
||||||
CHECK_2 := chktex
|
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
|
# We want bash as shell
|
||||||
SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
|
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 += $(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)/*/*.jpg))
|
||||||
images += $(foreach directory, $(chapters), $(wildcard $(directory)/*.png))
|
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))
|
bw_images := $(addprefix bw-book-epub/OEBPS/, $(images))
|
||||||
|
|
||||||
src_all := $(src_tex) $(src_figures) $(src_tables) tex4ebook.cfg book.mk4 $(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)
|
book_sans_serif/book_sans_serif.pdf: $(src_all)
|
||||||
$(LATEX) -output-directory=book_sans_serif book_sans_serif.tex
|
$(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
|
epub/%.epub: %.tex $(src_all) cover/cover-page.xbb
|
||||||
$(EBOOK) -f epub $<
|
$(EBOOK) -f epub $<
|
||||||
|
|
||||||
copy_ebook_files: build_ebook
|
bw-book-epub:
|
||||||
mkdir -p bw-book-epub/
|
mkdir -p bw-book-epub
|
||||||
rsync -au --exclude "book.epub" book-epub/ bw-book-epub/
|
|
||||||
|
|
||||||
convert_ebook_images: copy_ebook_files
|
copy_ebook_files: build_ebook | bw-book-epub
|
||||||
mogrify -resize '800x800>' \
|
$(RSYNC) book-epub/ bw-book-epub/
|
||||||
tstrip -interlace Plane -gaussian-blur 0.05 -quality 85\% \
|
|
||||||
-set colorspace Gray -separate -evaluate-sequence Mean $(bw_images)
|
|
||||||
|
|
||||||
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
|
zip -qXr9D bw_ebook.zip bw-book-epub
|
||||||
|
|
||||||
epub/bw_book.epub: bw_ebook.zip
|
epub/bw_book.epub: bw_ebook.zip
|
||||||
mv bw_ebook.zip epub/bw_book.epub
|
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
|
# Now with the rules
|
||||||
# Expected usual rules first
|
# 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_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
|
.PHONY: export_figures check
|
||||||
# Requires that you have docker running on your computer.
|
# Requires that you have docker running on your computer.
|
||||||
@@ -229,18 +245,19 @@ mrproper: clean
|
|||||||
-rm -rf $(website_dir)
|
-rm -rf $(website_dir)
|
||||||
|
|
||||||
# top level releases rules
|
# 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
|
bake: release_serif release_sans_serif
|
||||||
|
|
||||||
make_release_dir:
|
release:
|
||||||
mkdir -p 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 book_serif/book.pdf release/TheBreadCode-The-Sourdough-Framework.pdf
|
||||||
cp epub/book.epub release/TheBreadCode-The-Sourdough-Framework.epub
|
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
|
cp book_sans_serif/book_sans_serif.pdf release/TheBreadCode-The-Sourdough-Framework-sans-serif.pdf
|
||||||
|
|
||||||
# Website stuff
|
# Website stuff
|
||||||
@@ -297,6 +314,10 @@ show_tools_version: # Show version of tools used on the build machine
|
|||||||
@echo ""
|
@echo ""
|
||||||
- ruby --version
|
- ruby --version
|
||||||
@echo ""
|
@echo ""
|
||||||
|
- convert --version
|
||||||
|
@echo ""
|
||||||
|
- rsync --version
|
||||||
|
|
||||||
|
|
||||||
# You can find the value of variable X with the following command:
|
# You can find the value of variable X with the following command:
|
||||||
# make print-X
|
# make print-X
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
\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
|
\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.
|
Room temperature & The easiest option. Best for bread that is eaten within a day.
|
||||||
Crust typically stays crisp when humidity not too high.
|
Crust typically stays crisp when humidity not too high.
|
||||||
& Bread dries out very quickly.\\
|
& Bread dries out very quickly.\\
|
||||||
@@ -13,6 +15,5 @@ Fridge & Bread stays good for weeks. Can dry out a little
|
|||||||
|
|
||||||
Freezer & Bread stays good for years.
|
Freezer & Bread stays good for years.
|
||||||
& Requires thawing and then toasting. Requires freezer and energy.\\
|
& Requires thawing and then toasting. Requires freezer and energy.\\
|
||||||
|
|
||||||
\bottomrule
|
\bottomrule
|
||||||
\end{tabular}
|
\end{tabular}
|
||||||
|
|||||||
2
makefile
2
makefile
@@ -22,7 +22,7 @@ website: mrproper
|
|||||||
|
|
||||||
.PHONY: validate
|
.PHONY: validate
|
||||||
validate: mrproper
|
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
|
.PHONY: mrproper
|
||||||
mrproper:
|
mrproper:
|
||||||
|
|||||||
Reference in New Issue
Block a user