Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option --keepDefaults #228

Open
JoKalliauer opened this issue Jul 6, 2019 · 2 comments
Open

add option --keepDefaults #228

JoKalliauer opened this issue Jul 6, 2019 · 2 comments

Comments

@JoKalliauer
Copy link

Processing File:Comparison_satellite_navigation_orbits.svg:

scour Input.svg.txt Output.svg.txt

Input

Input.svg.txt

<?xml version="1.0" encoding="UTF-8"?>
<svg font-family="Helvetica,Arial,sans-serif" font-size="40px" version="1.1" viewBox="-123.73 -429.12 549.32 69.014" xmlns="http://www.w3.org/2000/svg">
 <style type="text/css">#main{text-anchor:end}</style>
 <g id="main">
  <text x="150" y="-400" style="fill:#f00">Graveyard orbit<tspan x="230" y="-366" font-size="28px">(GEO+300 km)</tspan></text>
  <text x="150" y="-400" style="fill:#000;text-anchor:start">Graveyard orbit<tspan x="230" y="-366" font-size="28px">(GEO+300 km)</tspan></text>
 </g>
</svg>

Input

Output

Output.svg.txt

<?xml version="1.0" encoding="UTF-8"?>
<svg font-family="Helvetica,Arial,sans-serif" font-size="40px" version="1.1" viewBox="-123.73 -429.12 549.32 69.014" xmlns="http://www.w3.org/2000/svg">
 <style type="text/css">#main{text-anchor:end}</style>
 <g id="main">
  <text x="150" y="-400" style="fill:#f00">Graveyard orbit<tspan x="230" y="-366" font-size="28px">(GEO+300 km)</tspan></text>
  <text x="150" y="-400">Graveyard orbit<tspan x="230" y="-366" font-size="28px">(GEO+300 km)</tspan></text>
 </g>
</svg>

Output

Not duplicate of #174

There might be several resons why you would like to keep default values, therfore it is independed to CSS.

Copyright

source: https://commons.wikimedia.org/wiki/File:Comparison_satellite_navigation_orbits.svg

author: Cmglee, Geo Swan

license: CC-BY-SA 3.0

@Ede123
Copy link
Member

Ede123 commented Jul 6, 2019

There might be several resons why you would like to keep default values, therfore it is independed to CSS.

Can you mention a few?

As long as inheritance rules are properly cascaded (and that is #174), default attributes would be kept if necessary and this specific issue would not occur.

Are there any valid reasons why we would like to keep unnecessary default attributes (which this issue seems to request)?

@JoKalliauer
Copy link
Author

Can you mention a few?

Are there any valid reasons why we would like to keep unnecessary default attributes (which this issue seems to request)?

To be honest I did not think about it, and I personally would not use it (except for bug-avoiding), but

  • svgo has an optional plugin to delete defaults https://github.com/svg/svgo/blob/master/plugins/removeUnknownsAndDefaults.js so I assume there will be reasons for it.
  • you copy parts from one SVG to anther one, and you want that this part behaves identical
  • you would like to modify some options in a group, (e.g. the color of the text, but some text should always be black, independend on the default group-color.)
  • you write a (buggy) script that can only handle available definitins, if a definition is missing the script will fail (e.g. https://github.com/JoKalliauer/cleanupSVG/blob/master/FFlow2TextBySed.py might only work if flowRoot contains font-size, otherwise it might not convert FlowRoot2Text)
  • the file should be human-readable, and because inherit's options might be difficult to find out (expecially in a >1GB-file, where you "can't" scroll in many editors any more, it might be better to repeat them (e.g. you grep for all lines containing <text and what to ensure that they have a minimum font-size)

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

No branches or pull requests

2 participants