From f784d6f2c67473e2e48166c38c1e09f3d8c69fd0 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sun, 28 Mar 2021 15:29:16 +0200 Subject: Improved build script, added showcase --- scripts/build.sh | 7 +++---- scripts/build_showcase.sh | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 4 deletions(-) create mode 100755 scripts/build_showcase.sh (limited to 'scripts') 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 () { --enable-id-stripping \ --enable-comment-stripping \ --remove-descriptive-elements \ + --strip-xml-prolog \ --shorten-ids } +export -f handle mkdir -p output find "src" \ -type f \ -name "*.svg" \ - | while read file_in - do - handle "$file_in" - done + -print0 | parallel -0 handle {} 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 @@ +#!/bin/bash + +mkdir -p showcase + +mapfile -d $'\0' icon_files < <(find "output" \ + -type f \ + -name "*.svg" \ + -print0) + +icons="[]" + +for icon in "${icon_files[@]}"; do + title=$icon + title=${title#output/} + title=${title%.svg} + + content=$(cat "$icon" | sed -z 's/\\/\\\\/g;s/\n/\\n/g;s/"/\\"/g') + + icons=$(echo "$icons" | jq ". += [ { \ + content: \"$content\", \ + title: \"$title\", \ + } ]") +done + +meta_file=$(mktemp) + +icons=$(echo "$icons" | jq "sort_by(.title)") + +echo "{ icons: $icons }" > "$meta_file" + +pandoc showcase.md \ + -f markdown \ + -t html5 \ + --no-highlight \ + --template "showcase_tpl.html" \ + -o "showcase/index.html" \ + --metadata-file "$meta_file" + +rm "$meta_file" -- cgit v1.2.3-70-g09d2