summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2021-03-28 15:29:16 +0200
committerVolpeon <git@volpeon.ink>2021-03-28 15:29:16 +0200
commitf784d6f2c67473e2e48166c38c1e09f3d8c69fd0 (patch)
treec19084b7e308e2d428e7e498c32726f59deb676f /scripts
parentAdjusted some icons, added build script (diff)
downloadiro-icons-f784d6f2c67473e2e48166c38c1e09f3d8c69fd0.tar.gz
iro-icons-f784d6f2c67473e2e48166c38c1e09f3d8c69fd0.tar.bz2
iro-icons-f784d6f2c67473e2e48166c38c1e09f3d8c69fd0.zip
Improved build script, added showcase
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build.sh7
-rwxr-xr-xscripts/build_showcase.sh39
2 files changed, 42 insertions, 4 deletions
diff --git a/scripts/build.sh b/scripts/build.sh
index 2f5fd79..637c334 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -6,15 +6,14 @@ handle () {
6 --enable-id-stripping \ 6 --enable-id-stripping \
7 --enable-comment-stripping \ 7 --enable-comment-stripping \
8 --remove-descriptive-elements \ 8 --remove-descriptive-elements \
9 --strip-xml-prolog \
9 --shorten-ids 10 --shorten-ids
10} 11}
12export -f handle
11 13
12mkdir -p output 14mkdir -p output
13 15
14find "src" \ 16find "src" \
15 -type f \ 17 -type f \
16 -name "*.svg" \ 18 -name "*.svg" \
17 | while read file_in 19 -print0 | parallel -0 handle {}
18 do
19 handle "$file_in"
20 done
diff --git a/scripts/build_showcase.sh b/scripts/build_showcase.sh
new file mode 100755
index 0000000..8d57b68
--- /dev/null
+++ b/scripts/build_showcase.sh
@@ -0,0 +1,39 @@
1#!/bin/bash
2
3mkdir -p showcase
4
5mapfile -d $'\0' icon_files < <(find "output" \
6 -type f \
7 -name "*.svg" \
8 -print0)
9
10icons="[]"
11
12for icon in "${icon_files[@]}"; do
13 title=$icon
14 title=${title#output/}
15 title=${title%.svg}
16
17 content=$(cat "$icon" | sed -z 's/\\/\\\\/g;s/\n/\\n/g;s/"/\\"/g')
18
19 icons=$(echo "$icons" | jq ". += [ { \
20 content: \"$content\", \
21 title: \"$title\", \
22 } ]")
23done
24
25meta_file=$(mktemp)
26
27icons=$(echo "$icons" | jq "sort_by(.title)")
28
29echo "{ icons: $icons }" > "$meta_file"
30
31pandoc showcase.md \
32 -f markdown \
33 -t html5 \
34 --no-highlight \
35 --template "showcase_tpl.html" \
36 -o "showcase/index.html" \
37 --metadata-file "$meta_file"
38
39rm "$meta_file"