# HG changeset patch # User Aleksej Bobylev # Date 1502977603 -10800 # Node ID bc95097eff7e0bc18e576fa923326622574d6435 # Parent 1c2beca44d34cb2d0a1fa1e76935db615109ba68 modules/compressor: more svg cleaning with extra options. diff -r 1c2beca44d34 -r bc95097eff7e doc/cookopts.txt --- a/doc/cookopts.txt Sat Aug 12 05:00:42 2017 +0300 +++ b/doc/cookopts.txt Thu Aug 17 16:46:43 2017 +0300 @@ -125,6 +125,13 @@ The presence of this option overrides the default action (all SVG images will be left "as is"). +!svgextra + Default options assumed applying transformation to paths and reducing the + accuracy of the coordinates to the tenth. + The presence of this option overrides the default behaviour (transformations + will not be applied to paths and default numeric precision will be 6 digits + after the dot). + !uiz Default action is to compress Glade UI files. Compression means the removal of insignificant spaces and comments. diff -r 1c2beca44d34 -r bc95097eff7e modules/compressor --- a/modules/compressor Sat Aug 12 05:00:42 2017 +0300 +++ b/modules/compressor Thu Aug 17 16:46:43 2017 +0300 @@ -259,16 +259,18 @@ action 'Compressing svg images...' + [ "${COOKOPTS/!svgextra/}" == "$COOKOPTS" ] && + opts="--apply-transform-to-paths yes --coordinates-precision 1 --paths-coordinates-precision 1" + cleaner_log="$(mktemp)" - IFS=$'\n' - for i in $(find $install -type f -name '*.svg'); do - echo -n "$i: " >> "$cleaner_log" - svgcleaner "$i" "$i" --remove-unresolved-classes false --quiet >> "$cleaner_log" + for i in $(IFS=$'\n' find $install -type f -name '*.svg'); do + out="$(unset IFS; svgcleaner "$i" "$i" --copy-on-error --quiet \ + --multipass --remove-unresolved-classes no $opts 2>&1)" + [ -z "$out" ] || echo -e "$i:\n$out\n" >> "$cleaner_log" done comp_summary "$time0" "$size0" "$(sizes svg)" - sed -i '/: $/d' "$cleaner_log" if [ -s "$cleaner_log" ]; then _ 'Cleaner warnings and errors:' awk '{printf " %s\n", $0;}' "$cleaner_log"