Mercurial > dottes
annotate makeBooke.sh @ 1045:41f73f8bfd2c build-default-377
Another go at Ladies Pleasure.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Sun, 12 Apr 2020 03:40:43 +0100 |
parents | 7cc06a68a572 |
children |
rev | line source |
---|---|
266
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
1 #!/bin/bash |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
2 # |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
3 # Build the Booke. Move subfiles into place and build the Booke into a PDF. |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
4 # |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
5 # The Booke tune content and all EPS and PDF tune graphics must be |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
6 # present already. Run makeGraphics.sh first and then |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
7 # makeBookeTunePages.sh. |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
8 # |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
9 |
603
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
10 if [ $# -lt 2 ]; then |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
11 echo "Usage: makeBooke.sh <A4|A5> <book dir name> [<book dir name>...]" |
266
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
12 exit 1 |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
13 fi |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
14 |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
15 dir=`pwd` |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
16 |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
17 builddir=$dir/build |
603
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
18 booketex=$builddir/dottes.tex |
266
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
19 bookepdf=$builddir/dottes.pdf |
748
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
677
diff
changeset
|
20 usecompact="" |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
677
diff
changeset
|
21 |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
677
diff
changeset
|
22 if [ "$1" = "--use-compact" ]; then |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
677
diff
changeset
|
23 usecompact="yes" |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
677
diff
changeset
|
24 shift |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
677
diff
changeset
|
25 fi |
266
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
26 |
603
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
27 papersize=$1 |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
28 shift |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
29 |
266
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
30 mkdir -p $builddir |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
31 |
603
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
32 if [ $# -eq 1 ]; then |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
33 bookename=$1 |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
34 for item in title subtitle instrument |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
35 do |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
36 rm -f $builddir/$item.txt |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
37 if [ -r $1/$item.txt ]; then |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
38 cp $dir/$1/$item.txt $builddir/$item.txt |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
39 else |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
40 touch $builddir/$item.txt |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
41 fi |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
42 done |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
43 else |
606
d5357ee6b4b2
Rework makeAll.sh to make multiple Bookes and a Bumper Booke too.
Jim Hague <jim.hague@acm.org>
parents:
603
diff
changeset
|
44 bookename="Bumper" |
603
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
45 echo "The Bumper Booke" > $builddir/title.txt |
606
d5357ee6b4b2
Rework makeAll.sh to make multiple Bookes and a Bumper Booke too.
Jim Hague <jim.hague@acm.org>
parents:
603
diff
changeset
|
46 echo "The collected Bookes of Dottes" > $builddir/subtitle.txt |
603
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
47 rm -f $builddir/instrument.txt |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
48 if [ -r $1/instrument.txt ]; then |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
49 cp $1/instrument.txt $builddir/instrument.txt |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
50 else |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
51 touch $builddir/instrument.txt |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
52 fi |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
53 fi |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
54 |
266
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
55 cp dottes.tex $builddir |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
56 cp buildno.txt $builddir |
304
9c5cabaabbec
Replace buzzard EPS with cropped PDF.
Jim Hague <jim.hague@acm.org>
parents:
266
diff
changeset
|
57 cp buzzard.pdf $builddir |
603
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
58 |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
59 rm -f $builddir/tunes.tex |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
60 rm -f $builddir/firstlines.tex |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
61 |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
62 while [ $# -gt 0 ] |
266
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
63 do |
603
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
64 section=$dir/$1 |
675
7ad6c0aa958d
Strip any '-<instrument>' from section name for booke text.
Jim Hague <jim.hague@acm.org>
parents:
606
diff
changeset
|
65 # Section name - strip any instrument name off the end. |
7ad6c0aa958d
Strip any '-<instrument>' from section name for booke text.
Jim Hague <jim.hague@acm.org>
parents:
606
diff
changeset
|
66 sectionname=${1/-*/} |
603
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
67 |
814
f5f6517a8bdf
Add section picture to the section title page on printed Bookes only.
Jim Hague <jim.hague@acm.org>
parents:
748
diff
changeset
|
68 for item in title.txt subtitle.txt instrument.txt image.jpg |
603
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
69 do |
814
f5f6517a8bdf
Add section picture to the section title page on printed Bookes only.
Jim Hague <jim.hague@acm.org>
parents:
748
diff
changeset
|
70 rm -f $builddir/$1-$item |
f5f6517a8bdf
Add section picture to the section title page on printed Bookes only.
Jim Hague <jim.hague@acm.org>
parents:
748
diff
changeset
|
71 if [ -r $section/$item ]; then |
f5f6517a8bdf
Add section picture to the section title page on printed Bookes only.
Jim Hague <jim.hague@acm.org>
parents:
748
diff
changeset
|
72 cp $section/$item $builddir/$1-$item |
603
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
73 else |
814
f5f6517a8bdf
Add section picture to the section title page on printed Bookes only.
Jim Hague <jim.hague@acm.org>
parents:
748
diff
changeset
|
74 touch $builddir/$1-$item |
603
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
75 fi |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
76 done |
869
7cc06a68a572
Add optional image caption taken from <section>/image.md.
Jim Hague <jim.hague@acm.org>
parents:
814
diff
changeset
|
77 for item in intro image |
603
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
78 do |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
79 rm -f $builddir/$1-$item.tex |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
80 if [ -r $section/$item.md ]; then |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
81 pandoc --from=markdown --to=latex --output=$builddir/$1-$item.tex $section/$item.md |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
82 else |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
83 touch $builddir/$1-$item.tex |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
84 fi |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
85 done |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
86 |
869
7cc06a68a572
Add optional image caption taken from <section>/image.md.
Jim Hague <jim.hague@acm.org>
parents:
814
diff
changeset
|
87 sed -e "s/@SECTION@/$1/g" -e "s/@SECTIONNAME@/$sectionname/g" dottes.tex.section-tunes >> $builddir/tunes.tex |
7cc06a68a572
Add optional image caption taken from <section>/image.md.
Jim Hague <jim.hague@acm.org>
parents:
814
diff
changeset
|
88 sed -e "s/@SECTION@/$1/g" -e "s/@SECTIONNAME@/$sectionname/g" dottes.tex.section-firstlines >> $builddir/firstlines.tex |
603
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
89 |
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
90 shift |
266
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
91 done |
601
507d853433ef
Create a section title page in the print version.
Jim Hague <jim.hague@acm.org>
parents:
582
diff
changeset
|
92 |
266
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
93 for filename in $dir/*.${papersize}.tex |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
94 do |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
95 name=`basename $filename .${papersize}.tex` |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
96 cp $filename $builddir/$name.tex |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
97 done |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
98 |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
99 cd $builddir |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
100 |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
101 xelatex $booketex |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
102 xelatex $booketex |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
103 xelatex $booketex |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
104 |
603
ef0d66742e01
Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents:
602
diff
changeset
|
105 mv $bookepdf $dir/$bookename-${papersize}.pdf |
266
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
106 |
06e140f48543
Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff
changeset
|
107 cd $dir |