blob: d4b04e7fa7ceef6a46b23a9b371f24d43d672968 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#!/bin/bash
set -eu
input=$1
output=$2
firstname ()
{
local -r fullname=$1
local name=${fullname%% *}
echo ${name,}
}
generate-parameters ()
{
read fullname
cat <<EOF
title='${fullname}'
stylesheets=(membre)
transforms=("\$(transform-li-dropdown-current-a quatuor)"
"\$(transform-li-current-a $(firstname "${fullname}"))")
EOF
}
generate-main ()
{
read fullname
read instrument
read h1
read dt
local -r name=$(firstname "${fullname}")
cat <<EOF
<main>
<div class="bio-title" style="${h1}">
<h1>${fullname}</h1>
<h2>${instrument}</h2>
</div>
<div class="bio" style="${dt}">
EOF
while read line
do
if ! [[ ${line} =~ ([^:?]+[:?] )(.+) ]]
then
>&2 echo "Invalid line: ${line}"
fi
cat <<EOF
<dl>
<dt>${BASH_REMATCH[1]}</dt>
<dd>${BASH_REMATCH[2]}</dd>
</dl>
EOF
done
cat <<EOF
</div>
<img src="images/${name}/portrait.png" style="background-image: url(images/${name}/bg.jpg)">
</main>
EOF
}
./build.sh <(generate-main < "${input}") \
<(generate-parameters < "${input}") \
"${output}"
|