-
Notifications
You must be signed in to change notification settings - Fork 1
/
FormatCSS.sh
executable file
·56 lines (38 loc) · 1.61 KB
/
FormatCSS.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
#Author: Johannes Kalliauer (JoKalliauer)
#created: 2017-10
#Last Edits:
#2017-10-29 13h14 new filename (by JoKalliauer)
#2017-11-01 delte style in text, Doctype minior changes, Remove stroke-width in text, not adding lineforwards, english explantations (by JoKalliauer)
#2017-11-20 dasharray due to stroke-dasharray="37.10, 37.10"
#2017-11-22 xml:space="preserve" in simple text removed
#2017-11-22 remove empty text;
#2017-11-22 Remove style in text with .
#2017-11-22 Remove stroke-width in text with .
#2017-11-27 remove style in text also if "[-\#\(\)]" is before
#2017-11-27 remove fill in text if x="..." y="..." is before
#2017-11-27 Remove stroke-width in text edited
#2017-11-27 Remove stroke-width in tspan
#2018-04-07 10h17 put no-filebreakc after definiton of $new, deleted the removement of spaces
#2018-04-28 not remove stroke-width in text
#2018-05-05 restructured
for file in *.svg;do
mv "$file" `echo ${file} | tr ' ' '_'` ;
## == Remove scecial 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) )"
break
fi
export tmp=${new%.svg}
#If you want to overwrite the exisiting file, without any backup, delete the following three lines
export i=${tmp}m.svg
cp ./"${file}" $i
mv ./"${file}" ./${tmp}1.xml
echo
echo $i start:
sed -i "s/}#/}\n#/g" $i
sed -i "s/}./}\n./g" $i
echo $i finish
done