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 --- .gitignore | 1 + Makefile | 13 ++++++-- scripts/build.sh | 7 ++-- scripts/build_showcase.sh | 39 ++++++++++++++++++++++ showcase.md | 0 showcase_tpl.html | 42 ++++++++++++++++++++++++ src/building.svg | 84 ++++++++++++++++++++++------------------------- src/list-ordered.svg | 8 ++--- 8 files changed, 138 insertions(+), 56 deletions(-) create mode 100755 scripts/build_showcase.sh create mode 100644 showcase.md create mode 100644 showcase_tpl.html diff --git a/.gitignore b/.gitignore index 53752db..acf9b50 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ output +showcase diff --git a/Makefile b/Makefile index 627f045..4e7d6d4 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,17 @@ all: build -clean: +clean_output: @mkdir -p output @rm -rf output/* -build: clean +clean_showcase: + @mkdir -p showcase + @rm -rf showcase/* + +build: clean_output @scripts/build.sh -.PHONY: all clean build +showcase: clean_showcase + @scripts/build_showcase.sh + +.PHONY: all clean build showcase 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" diff --git a/showcase.md b/showcase.md new file mode 100644 index 0000000..e69de29 diff --git a/showcase_tpl.html b/showcase_tpl.html new file mode 100644 index 0000000..d20596b --- /dev/null +++ b/showcase_tpl.html @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + iro icons showcase + + + + $for(icons)$ +
+ $it.content$ +
+ $endfor$ + + + diff --git a/src/building.svg b/src/building.svg index bec43d9..c609da3 100644 --- a/src/building.svg +++ b/src/building.svg @@ -13,7 +13,7 @@ version="1.1" id="svg10" sodipodi:docname="building.svg" - inkscape:version="0.92.4 5da689c313, 2019-01-14" + inkscape:version="1.0.2 (e86c870879, 2021-01-15)" inkscape:export-xdpi="192" inkscape:export-ydpi="192" style="fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round"> @@ -40,60 +40,54 @@ guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:window-width="3840" - inkscape:window-height="1983" + inkscape:window-width="1920" + inkscape:window-height="992" id="namedview12" showgrid="true" - inkscape:zoom="64" - inkscape:cx="5.2592609" - inkscape:cy="9.5758391" - inkscape:window-x="0" + inkscape:zoom="32" + inkscape:cx="7.3141016" + inkscape:cy="7.2610707" + inkscape:window-x="1536" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:current-layer="svg10" - showguides="true"> + showguides="false" + inkscape:document-rotation="0"> - - - - + - - + d="m 7.75,12.25 h 0.5 v 2.5 h -0.5 z m 6.999841,2.499925 H 1.25 M 3.5,1.75 h 9.000159 c 0.4155,0 0.75,0.3345 0.75,0.75 V 14 c 0,0.4155 -0.3345,0.75 -0.75,0.75 H 3.5 C 3.0845,14.75 2.75,14.4155 2.75,14 V 2.5 C 2.75,2.0845 3.0845,1.75 3.5,1.75 Z" + sodipodi:nodetypes="cccccccsssssssss" /> + + + diff --git a/src/list-ordered.svg b/src/list-ordered.svg index 8e9a83f..22def41 100644 --- a/src/list-ordered.svg +++ b/src/list-ordered.svg @@ -44,9 +44,9 @@ inkscape:window-height="992" id="namedview12" showgrid="true" - inkscape:zoom="8" - inkscape:cx="-16.587334" - inkscape:cy="9.4358757" + inkscape:zoom="32" + inkscape:cx="-2.7301153" + inkscape:cy="3.9523496" inkscape:window-x="1536" inkscape:window-y="0" inkscape:window-maximized="1" @@ -71,7 +71,7 @@ style="fill:none;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> -- cgit v1.2.3-70-g09d2