Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
JoKalliauer committed Feb 10, 2023
2 parents 12b6b55 + 7e7edb3 commit f383f2b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 40 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
*.svg
node_modules/*
*json
*.xsvg
1 change: 1 addition & 0 deletions Folder.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cd /mnt/c/Users/jokal/Dokumente_tooMuch/GitHub/cleanupSVG/
39 changes: 3 additions & 36 deletions T35245singleXcoordinate.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,24 @@
#!/bin/bash

export minfilesize=0 #1..min file size (1...no line breaks)
export meta=0 #0 removes metadata
export outputType="svg" #just to not get asked by Inkscape
export file=min.svg # just used for debugging
export i=min.svg # just used for debugging

#./ScourFull.sh #damit man einzeilTags hat
###./einzeilTags.sh

for file in *.svg;do

## == Remove scecial characters in filename ==
## == Remove special characters in filename ==

#export i=$file #i will be overritan later, just for debugging
export new="${file//[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\.\_\+]/}"
if [ $new == '*.svg' ]; then #new has to be controlled because it might have "-" which confuses bash
echo "no file, (or filename does not contain any default latin character (a-z) )"
echo "no file, (or filename does not contain any default Latin character (a-z) )"
break
fi
export tmp=${new%.svg}

#If you want to overwrite the exisiting file, without any backup, delete the following three lines
#If you want to overwrite the existing file, without any backup, delete the following three lines
export i=${tmp}T.svg
cp ./"${file}" $i
mv ./"${file}" ./${tmp}1.xml

echo
echo $i start:

#<tspan x="7384.68,7487.05,7589.41,7691.78,7794.14" y="-2982.47" font-family="Nimbus Sans L,Liberation Sans,Helvetica" font-size="184.11" stroke-width="18.411" sodipodi:role="line">
sed -ri "s/<tspan([-[:alnum:]\.\"\#\ =\(\)]*) x=\"([-[:digit:]\.]+)( |,)([-[:digit:]\. ,]+)\"([-[:alnum:]\.\"\#\ =\,:\\]*)>/<tspan x=\"\2\"\1\5>/g" $i # remove multipe x-koordinates in text (solves librsvg-Bug)
sed -ri "s/<text([-[:alnum:]\.\"\#\ =\(\)]*) x=\"([-[:digit:]\.]+)( |,)([-[:digit:]\. ,]+)\"([-[:alnum:]\.\"\#\ =\,:\\\(\)]*)>/<text x=\"\2\"\1\5>/g" $i # remove multipe x-koordinates in text (solves librsvg-Bug)

Expand All @@ -42,25 +31,3 @@ echo $i finish


done
#
#./CleanerFull.sh #wegen Inkscape-Bug
#
##./PosibleUngroup.sh
#./UngroupByInkscape.sh #for removing the groups and increasing font-size
##./einzeilTags.sh
#./Rounding.sh #for removing rounding errors
#
#
##./CleanerFull.sh
#./IskartOptimizer.sh #for reducing file size
#
#./svg2validsvg.sh #for correcting the png-files and adding DTD
##./cleaner4compression.sh
##./o4compression.sh #https://github.com/svg/svgo/issues/1001
##./scour4compression.sh #https://github.com/scour-project/scour/issues/202
##./CleanerFull.sh
##./RasterOptimizer.sh
#./fontReplace.sh #for replacing Arial with Liberation Sans
##./validBycleaner.sh
##./svg2validsvg.sh
##./validByScour.sh
8 changes: 4 additions & 4 deletions svgo.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ module.exports = {
name: 'cleanupEnableBackground',
active: true
},
{
/* {
name: 'cleanupIDs',
active: true
},
},*/
/* {
name: 'cleanupListOfValues',//https://github.com/svg/svgo/issues/1402
},*/
Expand Down Expand Up @@ -78,10 +78,10 @@ module.exports = {
name: 'moveGroupAttrsToElems',
active: true
},
{
/* {
name: 'removeAttrs',
active: false
},
},*/
{
name: 'removeComments',
active: true
Expand Down

0 comments on commit f383f2b

Please sign in to comment.