Skip to content
This repository has been archived by the owner on Oct 30, 2021. It is now read-only.

svgcleaner produces syntax-error #140

Open
JoKalliauer opened this issue Apr 9, 2018 · 3 comments
Open

svgcleaner produces syntax-error #140

JoKalliauer opened this issue Apr 9, 2018 · 3 comments
Labels

Comments

@JoKalliauer
Copy link
Contributor

Prozessing Oriflamme1.svg with

svgcleaner 20110228162947!Oriflamme1.svg output.svg --indent 1 --remove-nonsvg-attributes no

leads to a syntax-error: <font-face font-family="&quot" Dominican="mall Caps&quot" src="url('#FontID0') format(svg)"/>

input.svg.txt

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg height="3508" viewBox="0 0 248000 350742" width="2480" xmlns="http://www.w3.org/2000/svg" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg">
 <defs>
  <font font-family="Dominican Small Caps" font-weight="400" horiz-adv-x="1">
   <font-face id="font-face2" font-family="Dominican Small Caps"/>
  </font>
  <style type="text/css">font-face { font-family:&quot;Dominican Small Caps&quot;;src:url('#FontID0') format(svg)}</style>
 </defs>
</svg>

output.svg.txt

<svg height="3508" viewBox="0 0 248000 350742" width="2480" xmlns="http://www.w3.org/2000/svg" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg">
 <defs>
  <font horiz-adv-x="1">
   <font-face font-family="&quot" Dominican="mall Caps&quot" src="url('#FontID0') format(svg)"/>
  </font>
 </defs>
</svg>
@RazrFalcon RazrFalcon added the Bug label Apr 9, 2018
@RazrFalcon
Copy link
Owner

The original file will be processed correctly (with an error). Did you modified it beforehand? Because the original one doesn't have &quot;.

@JoKalliauer
Copy link
Contributor Author

Yes, and I know it is my fault, because I was a bit careless.

Actually I use: https://github.com/JoKalliauer/cleanupSVG which uses sed (stringedit), inkscape, scour, svgo and svgcleaner.

The easiest way to reproduce this error:

  1. svg2validsvg.sh adds xmlns:xlink="http://www.w3.org/1999/xlink" in the <svg -tag
  2. o4compression.sh calls svgo (for this case just use default options), which adds &quot; (You could use https://jakearchibald.github.io/svgomg/ with quite similar result, but the graphical interface also adds src:url(&quot;#FontID0&quot;) with default options, which would lead to an error in svgcleaner)
  3. Now that's my fault: I changed @font-face to font-face (Just noticed changing to .font-face would work properly)
  4. Then started svgcleaner

Maybe you can just close this bug, since there are too many unrealistic things: A problematic file prozessed with svgo, which (wrongly?) adds &quot; and a "stupid" user that just removes the @ without thinking, just to overcome the svgcleaner-error. (Here it is the users fault.)

@RazrFalcon
Copy link
Owner

Well, the &quot; parsing is still a bug. So I had to fix it.

@font-face cannot be changed to font-face or .font-face.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants