RazrFalcon / svgcleaner

svgcleaner could help you to clean up your SVG files from the unnecessary data.
GNU General Public License v2.0
1.63k stars 94 forks source link

keep Doctype-Declaration #156

Open JoKalliauer opened 6 years ago

JoKalliauer commented 6 years ago

I know some decline Doctype-Declaration (DTD): https://jwatt.org/svg/authoring/#doctype-declaration

But I personally prefer Doctype-Declaration, because https://validator.w3.org/ has a different Check for SVGs with DTD, and it does not display any warning. Is there an option to keep DTD?

scour keeps it and for svgo is an option for keeping DTD:

$ svgo -i input.svg -o output.svg --disable=removeDoctype

Or you might can convince me that SVGs should not have DTD.

RazrFalcon commented 6 years ago

It's not possible. I can create a new one if you need.

JoKalliauer commented 6 years ago

I would like such option because I always reinsert it manually, also I think options should kept at a minimal level to be clear for new users.

RazrFalcon commented 6 years ago

options should kept at a minimal level

What do you mean?

JoKalliauer commented 6 years ago

Nothing important. I mean that

svgcleaner.exe --help


svgcleaner could help you to clean up your SVG files from the unnecessary data.

A complete documentation can be found here: https://github.com/RazrFalcon/svgcleaner/blob/master/docs/svgcleaner.adoc

USAGE: svgcleaner [FLAGS] [OPTIONS]

<FLAG> can contain values: true, false, yes, no, y, n

EXAMPLES: clean a file with default options: svgcleaner in.svg out.svg

clean a file with custom options:
svgcleaner --indent=2 --paths-coordinates-precision=5 --join-arcto-flags=yes in.svg out.svg

clean a file without default options:
svgcleaner --no-defaults --remove-comments=yes in.svg out.svg

clean a stream using UNIX pipes:
cat in.svg | svgcleaner -c - > out.svg

FLAGS: -h, --help Print help information -V, --version Print version information -c, --stdout Print result to the standard output --no-defaults Reset default flags to 'no' --multipass Clean a file multiple times --allow-bigger-file Allow bigger file --copy-on-error Copy an original file to the destination on error --quiet Show only warnings and errors

OPTIONS: Elements: --remove-comments Remove XML comments [default: yes] --remove-declarations Remove XML declarations [default: yes] --remove-nonsvg-elements Remove non-SVG elements [default: yes] --remove-unused-defs Remove unused referenced elements [default: yes] --convert-shapes Convert basic shapes into paths [default: yes] --remove-title Remove 'title' element [default: yes] --remove-desc Remove 'desc' element [default: yes] --remove-metadata Remove 'metadata' element [default: yes] --remove-dupl-lineargradient Remove duplicated 'linearGradient' elements [default: yes] --remove-dupl-radialgradient Remove duplicated 'radialGradient' elements [default: yes] --remove-dupl-fegaussianblur Remove duplicated 'feGaussianBlur' elements [default: yes] --ungroup-groups Ungroup groups [default: yes] --ungroup-defs Ungroup 'defs' element [default: yes] --group-by-style Group elements by equal styles [default: yes] --merge-gradients Merge gradients [default: yes] --regroup-gradient-stops Regroup gradient 'stop' elements [default: yes] --remove-invalid-stops Remove invalid 'stop' elements [default: yes] --remove-invisible-elements Remove invisible elements [default: yes] --resolve-use Resolve 'use' elements [default: yes]

Attributes: --remove-version Remove 'version' and 'baseProfile' attributes [default: yes] --remove-nonsvg-attributes Remove non-SVG attributes [default: yes] --remove-unreferenced-ids Remove unreferenced 'id' attributes [default: yes] --trim-ids Trim 'id' attributes [default: yes] --remove-text-attributes Remove text-related attributes if there is no text [default: yes] --remove-unused-coordinates Remove unused coordinate attributes [default: yes] --remove-default-attributes Remove attributes with default values [default: yes] --remove-xmlns-xlink-attribute Remove an unused 'xmlns:xlink' attribute [default: yes] --remove-needless-attributes Remove attributes that doesn't belong to this element [default: yes] --remove-gradient-attributes Remove inheritable gradient attributes [default: no] --join-style-attributes Join presentational attributes [values: no, some, all] [default: some] --apply-transform-to-gradients Apply transformations to gradients [default: yes] --apply-transform-to-shapes Apply transformations to shapes [default: yes] --remove-unresolved-classes Remove unresolved classes from 'class' attributes [default: yes]

Paths: --paths-to-relative Convert path segments into relative ones [default: yes] --remove-unused-segments Remove unused path segments [default: yes] --convert-segments Convert path segments into shorter ones [default: yes] --apply-transform-to-paths Apply transformations to paths [default: no] --trim-paths Use compact notation for paths [default: yes] --join-arcto-flags Join ArcTo flags [default: no] --remove-dupl-cmd-in-paths Remove subsequent segments command from paths [default: yes] --use-implicit-cmds Use implicit LineTo commands [default: yes]

Output: --trim-colors Use #RGB notation [default: yes] --simplify-transforms Simplify transform matrices [default: yes] --coordinates-precision Set coordinates numeric precision (1..12) [default: 6] --properties-precision Set properties numeric precision (1..12) [default: 6] --transforms-precision Set transform values numeric precision (1..12) [default: 8] --paths-coordinates-precision Set path's coordinates numeric precision (1..12) [default: 8] --list-separator Set number list separator [values: space, comma, comma-space] [default: s pace] --indent Set XML nodes indent [values: none, 0, 1, 2, 3, 4, tabs] [default: none]

ARGS:

Input file Output file ``` is quite long (which is perfect for advanced users, like me), but for new users it is not easy to not find the function the users is searching for, especially if he/she does not have the knowledge to understand the explanations. (But that's not critics, that is just that you maybe have to do a tradeoff.) But If you ask me: I would like the option `--removeDoctype no` (or `keepDTD` or `insertDTD`, or something similar)
RazrFalcon commented 6 years ago

Ok. I will add it.

for new users it is not easy to not find the function

That's why the GUI exists. I don't plan to simplify the help output for now.

JoKalliauer commented 6 years ago

Just for Information:

Since some weeks https://validator.w3.org/check only checks SVGs with Doctype (or you have to specify it manually before the check)

See f.e. :https://validator.w3.org/check?uri=https%3A%2F%2Fcommons.wikimedia.org%2Fwiki%2FSpecial%3AFilepath%2FSVG_example_path.svg&ss=1#source