1
0
mirror of https://github.com/bitcoinbook/bitcoinbook synced 2024-11-21 23:58: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/ dist/
_build/ _build/
build/ build/
book.html

View File

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