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

When formatting XML used tab size is always 2 spaces #12

Open
RockyMM opened this issue Oct 6, 2017 · 7 comments
Open

When formatting XML used tab size is always 2 spaces #12

RockyMM opened this issue Oct 6, 2017 · 7 comments

Comments

@RockyMM
Copy link

RockyMM commented Oct 6, 2017

On Windows, Sublime 3143, Exalt 0.3.3 when I format an XML the tabs are 2 spaces instead of 4 as it is specified in the default Sublime preferences.

@eerohele
Copy link
Owner

Sorry for the late reply.

I addressed this issue in #1 (comment).

@RockyMM
Copy link
Author

RockyMM commented Oct 25, 2017

I would like to leave this ticket open - it's really like sand in shoes having tabs as 2 spaces :) I'll pursue solution from within lxml.

@eerohele
Copy link
Owner

Sure thing! If you find anything, please let me know and I'll definitely see about implementing it.

There was a post on Hacker News a couple a days ago about a single-file Python XML formatter that might be serve as alternative solution. I'll see if I can find it.

@RockyMM
Copy link
Author

RockyMM commented Oct 25, 2017

Maybe this http://effbot.org/zone/element-lib.htm#prettyprint? Even lxml mentions this element library.

I have to admit that I'm Python noob so I'm not sure how usable this might be for you.

@eerohele
Copy link
Owner

The thing is that other than defining the indent width, lxml's pretty-printer works really well. Most other pretty-printers seem to rely on regular expressions and fall apart pretty quickly. That's why it's not necessarily very easy to find a replacement for lxml.

@henrycjc
Copy link

lxml seems to be calling the C code in here https://github.com/ConradIrwin/libxml2/blob/master/HTMLtree.c

Doesn't seem like an easy fix which seems crazy given how common an indent_spaces type param is for pretty printing functionality

@RockyMM
Copy link
Author

RockyMM commented Nov 17, 2017

Yep, the situation is really perplexing. I guess I have to live with it and do some post find/replace myself :|

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

3 participants