diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build.sh | 7 | ||||
-rwxr-xr-x | scripts/build_showcase.sh | 39 |
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 | } |
12 | export -f handle | ||
11 | 13 | ||
12 | mkdir -p output | 14 | mkdir -p output |
13 | 15 | ||
14 | find "src" \ | 16 | find "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 | |||
3 | mkdir -p showcase | ||
4 | |||
5 | mapfile -d $'\0' icon_files < <(find "output" \ | ||
6 | -type f \ | ||
7 | -name "*.svg" \ | ||
8 | -print0) | ||
9 | |||
10 | icons="[]" | ||
11 | |||
12 | for 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 | } ]") | ||
23 | done | ||
24 | |||
25 | meta_file=$(mktemp) | ||
26 | |||
27 | icons=$(echo "$icons" | jq "sort_by(.title)") | ||
28 | |||
29 | echo "{ icons: $icons }" > "$meta_file" | ||
30 | |||
31 | pandoc 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 | |||
39 | rm "$meta_file" | ||