Skip to content

Commit 1dc612c

Browse files
happiclaude
andcommitted
Add auto-incrementing version number to front matter
Computes version as 1.0.N where N is the commit count since the v1.0 tag. Passed as an AsciiDoc attribute to all build targets (PDF, EPUB, HTML). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1ad86fb commit 1dc612c

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
ASSET_CHAPTERS = $(shell find chapters -type f)
2+
VERSION = 1.0.$(shell git rev-list v1.0..HEAD --count)
23

34
.PHONY: all pdf pdf-a4 pdf-publish epub html docker docker-build clean serve
45

@@ -41,6 +42,7 @@ beam-book-a4.pdf: style/pdf-online-theme.yml style/pdf-theme.yml chapters/opcode
4142
-a source-highlighter=rouge \
4243
-a rouge-style=pastie \
4344
-a rouge-linenums-mode=table \
45+
-a version=$(VERSION) \
4446
online-book.asciidoc -o $@
4547

4648
# Print-ready 6×9 for PoD
@@ -55,6 +57,7 @@ beam-book-publish.pdf: style/custom-print-highlight-theme.yml style/pdf-publish-
5557
-a source-highlighter=rouge \
5658
-a rouge-style=pastie \
5759
-a rouge-linenums-mode=table \
60+
-a version=$(VERSION) \
5861
print-book.asciidoc -o $@ --trace
5962

6063
# EPUB version
@@ -66,6 +69,7 @@ beam-book.epub: chapters/opcodes_doc.asciidoc epub-book.asciidoc book.asciidoc c
6669
-a config=./style/ditaa.cfg \
6770
-a source-highlighter=rouge \
6871
-a rouge-style=pastie \
72+
-a version=$(VERSION) \
6973
epub-book.asciidoc -o $@ --trace
7074

7175

@@ -76,7 +80,8 @@ html: chapters/contributors.txt $(ASSET_CHAPTERS)
7680
-o site/index.html online-book.asciidoc --trace \
7781
-a source-highlighter=rouge \
7882
-a rouge-style=thankful_eyes \
79-
-a rouge-linenums-mode=table
83+
-a rouge-linenums-mode=table \
84+
-a version=$(VERSION)
8085
rsync -R code/*/*.png site
8186

8287
code/book/ebin/generate_op_doc.beam: code/book/src/generate_op_doc.erl

book.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ under the Creative Commons license. This printed edition is provided for conveni
5454
For more information on the Creative Commons license, visit:
5555
link:https://creativecommons.org/licenses/by/4.0/[].
5656

57-
First Edition, 2025
57+
First Edition, 2025 — Version {version}
5858
ISBN: 978-91-531-4253-9
5959
[.text-center]
6060
© 2025 Erik Stenman.

0 commit comments

Comments
 (0)