remove empty flowRoot on saving
Steps to reproduce:
- open Inkscape
- Klick on Text
- klick and open a box, and then release mouse-botton
- save as Optimized SVG
- flowRoot.svg
What happened?
scour reports that there exists a flowRoot
What should have happened?
inkscape should remove empty flowRoots
flowRoots sometimes leads to black recktangles see https://www.google.com/search?q=flowRoot+svg+black+rectangle , therefore empty flowRoots should be removed.
I personally use sed, but I'm shure you have better options to do that
sed -ri "s/<flowPara([-[:alnum:]\"\' \.\:\%\=\;\,#\(\)]*)\/>//g;s/<flowRoot([-[:alnum:]\" \.:%=;]*)\/>//g" $i
sed -i 's/<flowSpan[-[:alnum:]=\":;\. ]*>[[:space:]]*<\/flowSpan>//g' $i
sed -ri -e ':a' -e 'N' -e '$!ba' -e "s/<flowRoot([-[:alnum:]\.=\" \:\(\)\%\#\,\';]*)>[[:space:]]*<flowRegion([-[:alnum:]=:\" #;\.%]*)(\/|>[[:space:]]*<(path|rect)([-[:alnum:]\"= \.:;# ]*)\/>[[:space:]]*<\/flowRegion)>[[:space:]]*(<flowDiv\/>|)[[:space:]]*<\/flowRoot>//g" $i #delete empty flowRoot
sed -ri -e ':a' -e 'N' -e '$!ba' -e "s/<flowRoot([-[:alnum:]\.=\" \:\(\)\%\#\,\';]*)>[[:space:]]*<flowRegion([-[:alnum:]=:\" #;\.%]*)>[[:space:]]*(<path[-[:alnum:]\.=\"\ \#]*\/>|<rect([-[:alnum:]\"= \.:;]*) x=\"([[:digit:]\. ]+)\" y=\"([-[:digit:]\. ]+)\"([[:lower:][:digit:]=\.\" \#:;]+)\/>)[[:space:]]*<\/flowRegion>[[:space:]]*(|<flowPara([-[:alnum:]\.=\" \:\#;% ]*)\/>|<flowPara([-[:alnum:]\"= \.\:\#;%]*)>([[:space:] ]*)<\/flowPara>)[[:space:]]*<\/flowRoot>//g" $i ##delete flowRoot only containing spaces
Scour
It is not a scour bug, also there exist two similar issues:
- Enhancement: Delete Empty FlowText https://github.com/scour-project/scour/issues/213
- add a beta-feature to convert FlowRoot to SVG1.1-text https://github.com/scour-project/scour/issues/229
It should be implemented in Inkscape, because empty flowRoots
- cannot be converted to SVG1.1-Text by Inkscape (if marked in the xml-editor)
- cannot be marked in the visible Image
- florwRoots leads to black recktangles https://www.google.com/search?q=flowRoot+svg+black+rectangle
Inkscape Version and Operating System:
- Inkscape Version: 1.1-dev (db22b70, 2020-05-07)
- Operating System: Win10