1
0
mirror of https://github.com/bitcoinbook/bitcoinbook synced 2024-11-21 15:48:09 +00:00

Add tools/image-report

This commit is contained in:
David A. Harding 2023-09-01 12:59:17 +02:00
parent ab1803246f
commit 3d924b461a
3 changed files with 37 additions and 0 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ _build/
dist/
_build/
build/
book.html

View File

@ -2,32 +2,46 @@
include::preface.asciidoc[]
//IMAGE_REPORT:NEW_CHAPTER
include::intro.adoc[]
//IMAGE_REPORT:NEW_CHAPTER
include::overview.adoc[]
//IMAGE_REPORT:NEW_CHAPTER
include::bitcoin-core.adoc[]
//IMAGE_REPORT:NEW_CHAPTER
include::keys.adoc[]
//IMAGE_REPORT:NEW_CHAPTER
include::wallets.adoc[]
//IMAGE_REPORT:NEW_CHAPTER
include::transactions.adoc[]
//IMAGE_REPORT:NEW_CHAPTER
include::authorization-authentication.adoc[]
//IMAGE_REPORT:NEW_CHAPTER
include::signatures.adoc[]
//IMAGE_REPORT:NEW_CHAPTER
include::fees.adoc[]
//IMAGE_REPORT:NEW_CHAPTER
include::network.adoc[]
//IMAGE_REPORT:NEW_CHAPTER
include::blockchain.adoc[]
//IMAGE_REPORT:NEW_CHAPTER
include::mining.adoc[]
//IMAGE_REPORT:NEW_CHAPTER
include::security.adoc[]
//IMAGE_REPORT:NEW_CHAPTER
include::applications.adoc[]
include::whitepaper.adoc[]

22
tools/image-report Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash -eu
BUILDDIR=$( mktemp -d )
# Generate a CSV of all images for sending to O'Reilly
files=$(
grep -A1 IMAGE_REPORT:NEW_CHAPTER book.adoc \
| sed '/^--/d; /IMAGE_REPORT/d; s/^include:://; s/\[]$//'
)
chapter=0
for file in $files ; do
chapter=$(( chapter + 1 ))
images=$BUILDDIR/$( basename $file )
grep ^image:: $file > $images || true
for image in $( seq 1 $( cat $images | wc -l ) ) ; do
echo -n "${chapter}-${image},"
sed -n "${image}{s/^image:://; s/\[.*//; p}" $images
done
done