michalrus / git-hooks-code-autoformat

Apache License 2.0
87 stars 24 forks source link

indent for text style elements in svg files #11

Closed CWempe closed 7 years ago

CWempe commented 7 years ago

I would like to use this project to autoformat svg files I create with Inkscape.

Unfortunately the code is still not perfectly formated. 😢

I only added one character to the text. See:

image

It would also be great if the style-attributes would be splittet into separate lines as well.

Is this possible?

Thanks

michalrus commented 7 years ago

I don’t know, really. ¯\_(ツ)_/¯

Hmm. We’re only calling external tools to do the formatting. E.g. see for your XML case: https://github.com/michalrus/git-hooks-code-autoformat/blob/master/autoformat/xml

So if you’re able to make xmllint behave how you want it to behave, it’ll work with this project.

I don’t know much about XML, but notice that if <tspan started on the next another line, there’d be whitespace between the previous </tspan> and the next <tspan>, right? Whitespace between tags is a plain text object in XML, therefore the resulting XML would be different semantically.

IMO, xmllint is doing the correct thing here. :slightly_smiling_face:

I’ll close this one as out of scope. It should be an issue for xmllint (or another svg formatter of your choice). But I personally wouldn’t open it there (see above for reasons).

michalrus commented 7 years ago

Also, if you could make a PR adding svgs to https://github.com/michalrus/git-hooks-code-autoformat/blob/master/autoformat/xml.patterns it’d be great!