-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.sh
45 lines (35 loc) · 1.29 KB
/
README.sh
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
#!/bin/bash
: >README.md
cat << EOF > README.md
<!-- generated with
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░█▀▄▀█ ▄▀█ █▀█ █▄▀ █░█ █▀█ ░ ░░█ █▀ █▀█ █▄░█░░
░░█░▀░█ █▀█ █▀▄ █░█ █▄█ █▀▀ ▄ █▄█ ▄█ █▄█ █░▀█░░
░░ github.com/metaory/markup.json ░░░░░░░░░░░░░ -->
EOF
command -v markup >/dev/null || npm i -g markup.json
command -v jq >/dev/null || exit 1
source .env
function parse {
while [ "$1" ]; do
envsubst <"src/${1:?MISS}.json" | markup >>README.md
shift
done
}
parse header stats
function hr { echo '["div",{"align":"center"},["img",{"sr":"'"${ASSETS}/hr$((RANDOM % 4))"'.png"}]]'; }
for i in {1..4}; do
jq '["",'"$(hr)"',["div",{align:"center"},
(["h3",.[0]]), (
.[1]|map(
["img", {
alt:.,
src:["${SICO}/"+.+"?",{viewbox:"auto"}],
width:"$IH",
height:"$IH"
}]
).[]
)]]' <"src/list_${i}.json" | envsubst | markup >>README.md
done
parse streaks footer
# vim: ft=bash