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

Creates W3C errors #236

Open
Jonteemil opened this issue May 9, 2021 · 4 comments
Open

Creates W3C errors #236

Jonteemil opened this issue May 9, 2021 · 4 comments

Comments

@Jonteemil
Copy link

Hello!

On https://en.wikipedia.org/wiki/File:UEFA_Champions_League_logo_2.svg svgcleaner, which is incorporated in the bot that uploaded the newest version, created two W3C errors. I thought I should report it so here I am.

@JoKalliauer
Copy link
Contributor

JoKalliauer commented May 9, 2021

@Jonteemil Can you provide the image before optimization? I might have been invalid before, but not recognized by the validator.

Generally you should not care about Validation that much, see https://commons.wikimedia.org/wiki/User:JoKalliauer/Optimization#why_validation_is_generally_not_desired .

@JoKalliauer
Copy link
Contributor

JoKalliauer commented May 11, 2021

@Jonteemil : You could e.g. use svgcleaner input.svg output.svg --allow-bigger-file --indent 1 --remove-declarations no --resolve-use no for this file.
Generally for a bot I would recommend to use "safe" options, as recommended in https://commons.wikimedia.org/wiki/User:JoKalliauer/Optimization#svgcleaner , see also #159 .
Maybe for fair-use-files, as in your case, it makes sense for legal reasons to compress SVGs further, with "dangerous" options.

Minimal working example:

Input:

input.svg.txt

<?xml version="1.0" encoding="UTF-8"?>
<svg height="114.51" viewBox="0 0 31.512 30.297" width="119.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
 <defs>
  <clipPath id="a">
   <use height="100%" width="100%" xlink:href="#b"/>
  </clipPath>
  <path id="b" d="m0 0h118.2v113.6h-118.2z"/>
 </defs>
 <path clip-path="url(#a)" d="m1 1 1 1" fill="#0e2050"/>
</svg>

Output with --resolve-use yes

<?xml version="1.0" encoding="UTF-8"?>
<svg height="114.51" viewBox="0 0 31.512 30.297" width="119.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
 <clipPath id="a">
  <path d="m0 0h118.2v113.6h-118.2z" height="100%" width="100%"/>
 </clipPath>
 <path clip-path="url(#a)" d="m1 1 1 1" fill="#0e2050"/>
</svg>

PS: I'm not a contributor (just did once a linkfix), I'm just an ordinary user.

@Jonteemil
Copy link
Author

@JoKalliauer Hello! The bot is not mine, I just reported the error. Thanks anyway for the info regarding validation and such!

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

No branches or pull requests

2 participants