diff options
| author | Volpeon <git@volpeon.ink> | 2021-03-28 15:29:16 +0200 |
|---|---|---|
| committer | Volpeon <git@volpeon.ink> | 2021-03-28 15:29:16 +0200 |
| commit | f784d6f2c67473e2e48166c38c1e09f3d8c69fd0 (patch) | |
| tree | c19084b7e308e2d428e7e498c32726f59deb676f /scripts/build_showcase.sh | |
| parent | Adjusted some icons, added build script (diff) | |
| download | iro-icons-f784d6f2c67473e2e48166c38c1e09f3d8c69fd0.tar.gz iro-icons-f784d6f2c67473e2e48166c38c1e09f3d8c69fd0.tar.bz2 iro-icons-f784d6f2c67473e2e48166c38c1e09f3d8c69fd0.zip | |
Improved build script, added showcase
Diffstat (limited to 'scripts/build_showcase.sh')
| -rwxr-xr-x | scripts/build_showcase.sh | 39 |
1 files changed, 39 insertions, 0 deletions
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" | ||
