Tabs vs. Spaces: please explain

View: New views
6 Messages — Rating Filter:   Alert me  

Tabs vs. Spaces: please explain

by Michiel van Oosterhout :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Ok, this is not about the tabs vs. spaces debate itself. But the fact
that there is a debate (some prefer to call it a holy war) means that
there are those who prefer spaces and those who prefer tabs, both in no
small amount). The sensible thing to do for Tidy then, would be to
support _both_.

However, the documentation states: "Tidy never outputs tabs". I sense
some bitterness in that very short powerfull statement, like it was a
pro-spaces programmer who was fed up with the whole discussion. However,
it is not that simple. Like I said, it would be very good to support
both, and would make _everyone_ more happy.

So, what's the deal? Is Tidy developed by a pro-spaces only team of
programmers? Is anyone going to add some kind of indent-with:
tabs|spaces option? Is this even possible? It's ok if the Tidy
programmers would say no to tabs (I'd be very disappointed), but at
least _explain_ it to me.

Thank you very much.

PS. I'd do it myself, but as you can probably guess, I use HTMLTidy
because I'm a web programmer, so I can't program C or C++



Re: Tabs vs. Spaces: please explain

by Geoff Richards :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Tue, Dec 20, 2005 at 11:44:46AM +0100, Michiel van Oosterhout wrote:
>
> Ok, this is not about the tabs vs. spaces debate itself. But the fact
> that there is a debate (some prefer to call it a holy war) means that
> there are those who prefer spaces and those who prefer tabs, both in no
> small amount). The sensible thing to do for Tidy then, would be to
> support _both_.
>
> However, the documentation states: "Tidy never outputs tabs".
> ...

Can't you postprocess it to add tabs?  Fro example, on Unix/Linux the
command 'unexpand' will turn the right numbers of spaces to tabs:

    tidy ... | unexpand

Presumeably the same sort of things are possible on other operating
systems.

--

--- Geoff Richards -------------><-------------- http://ungwe.org/ ---
"I tried to fling my shadow at the moon,
 The while my blood leapt with a wordless song."  --  Theodore Roethke



Parent Message unknown Re: Tabs vs. Spaces: please explain

by Michiel van Oosterhout :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Or... How about creating this config option:

ident-type: tabs|spaces

-M



Parent Message unknown Re: Tabs vs. Spaces: please explain

by Ahmed aa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 21 Dec 2005 15:38:04 +0100, Michiel van Oosterhout wrote:
>Or... How about creating this config option:
>
>ident-type: tabs|spaces
>
>-M
 
same sort of things are possible on other operating
systems.
--
+92-65461691


Yahoo! DSL Something to write home about. Just $16.99/mo. or less

Re: Tabs vs. Spaces: please explain

by Ujfalusi Sándor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I agree with Michael that a param like indent-type would be nice. Indenting is an important part of formatting and we are restricted to use spaces. If you want to replace them tabs you have to use another formatter tool otherwise it will replaces all spaces (space groups) not only which are for indent or write a script for this. But why should you do this when you have a formatter program?

Re: Tabs vs. Spaces: please explain

by Andre Majorel-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 2005-12-20 11:44 +0100, Michiel van Oosterhout wrote:

> However, the documentation states: "Tidy never outputs tabs".
> [...] Like I said, it would be very good to support both, and
> would make _everyone_ more happy. [...] Is anyone going to add
> some kind of indent-with: tabs|spaces option? Is this even
> possible? It's ok if the Tidy programmers would say no to tabs
> (I'd be very disappointed), but at least _explain_ it to me.

Perhaps because then someone would ask "if we have 9 spaces,
couldn't Tidy output a tab and a space ?" and they'd have to add
yet another option and write the accompanying documentation.

Piping the output of tidy into

  unexpand -t 1 | sed 's/^ /\t/'
 
will turn each leading space into a tab. Works for me with GNU
unexpand and GNU sed. The "\t" bit is not portable. If it doesn't
work with your version of sed, try entering a literal tab instead
(you may have to hit ^V first).

--
André Majorel <URL:http://www.teaser.fr/~amajorel/>
Do not use this account for regular correspondence.
See the URL above for contact information.