eerohele / exalt

A Sublime Text plugin for validating and formatting XML documents
MIT License
22 stars 3 forks source link

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

Open RockyMM opened 7 years ago

RockyMM commented 7 years ago

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 commented 7 years ago

Sorry for the late reply.

I addressed this issue in https://github.com/eerohele/exalt/issues/1#issuecomment-233311727.

RockyMM commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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