normalizing svg files

Allen Winter winter at kde.org
Thu Sep 8 23:12:56 UTC 2016


Good stuff.

1. I'm going to make Krazy detect xmllint failures with svg files
2. How about adding normalize.sh to the kde-dev-scripts repo?  (call it svg-normalize.sh)
3. Is there a techbase wiki on this? if not, could you start one?

On Tuesday, September 06, 2016 11:58:57 AM Jos van den Oever wrote:
> Hi all,
> 
> Icons in breeze are stored as uncompressed SVG. That should make diffs more 
> readable. In practice, diffs can be quite hard to read due to different ways of 
> writing out XML by different applications, application versions and settings.
> 
> A solution to this is to use XML normalization (c14n). xmllint provides this.
> 
> I've attached a script that will normalize XML files. I've used a similar 
> script for quite some time.
> 
>   "$xmllint" --nonet --c14n11 "$1" \
>     | XMLLINT_INDENT=' ' \
>       "$xmllint" --nonet --format --encode utf-8 --xmlout --nsclean - \
>     | "$perl" -p -e 's/[ \t]+$//g' - \
>     > "$tmpfile" || "$rm" "$tmpfile"
> 
> The script follows the c14n11 transform with a formatting. The formatting 
> changes <a></a> to <a/> and adds an initial <?xml .. ?>.
> 
> The most notable feature is that attributes are sorted and placed on one line.
> 
> Like whitespace discussions, the actual choice is not that important, but for 
> nice diffs, consistency is.
> 
> There's a slight space saving (1MB out of 64MB).
> 
> Cheers,
> Jos



More information about the Kde-frameworks-devel mailing list