On MeatballWikiBugs, something like this occurred:
Another simple idea is to treat runs of spaces as tabs - say 4 per tab, at least when they come at the beginnings of lines. -- DaveHarris
While this would be nice, it breaks code formatting. -- SunirShah
I don't see why. -- DaveHarris
What I actually wrote was, "I don't see why code shouldn't be formatted with tabs". I suspect at least some of the following debate is due to the difference between what I meant and what I wrote - and also because what I wrote was then taken out of context. I didn't mean to advocate using tabs. Indeed, I had just written about how difficult tabs are to use with my browser. Instead the idea is for people to use spaces only, and since runs of spaces are collapsed by HTML to translate them into indents using <UL> or similar. -- DaveHarris
Because tabs aren't of universal width. On one machine they are 4 spaces, another 6, another 8. Moreover, programmers habitually alter their tab width preferences to be anything from 2 to 10 spaces. Consequently, the code won't line up properly and will look really bad. On the other hand, if you don't distinguish between the two cases /\ {4}*/ and /\t*/, you will match against C-style long block comments ala
/* This is a long block comment that illustrates bad * matches against <SPACE>x4. In particular, this line. */
Anyway, the standard rule is that Code must be untabified before being published. This improves universal readability. -- SunirShah
Be consistent - either use "4 spaces to an indent" or "1 tab to an indent". Either way we will be able to format code nicely on Wiki. It will line up no matter what width tabs are. I disagree that the "untabify" rule is standard, but if it is, it doesn't cause a problem. As far as I can tell, the point of the block comment example is that it uses 3 spaces in some places and 4 in others. Don't do that. If your indents are 4 spaces, use them consistently. The second line should be 1 indent + 1 space. -- DaveHarris
The problem is not whether or not people are using good style or bad, but whether they care to change their code because you happen to prefer a particular style. As it is difficult enough to post code, making it harder is the wrong direction in my opinion. If I have 200 lines of code to post and I have to hand edit each line so that it looks pretty on this particular Wiki, I won't want to post the code. Or I'll just let it get gretcherized.
Basically, the input format is out of our hands. The only thing we can do is deal with (reasonably) possible input formats gracefully.
I also forgot to mention people (like me) mix spaces and tabs if they are using a poor editor. -- SunirShah
If you post code to the web which uses a mixture of tabs and spaces, it is going to look bad precisely because the tab indents vary between systems. -- DaveHarris
I think using tab as a special character is just asking for trouble anyway as it is a bit magic. -- SunirShah
Here's the style they use where I work.
/* * This line is fubared. */
Other forms of preformatted text will also have problems, come to think of it.-- SunirShah
Why is it fubared? In my ideal system that would be entered as is, with 4 spaces, and rendered by HTML like:
<ul> <br>/* <br>* This line is fubared. <br>*/ </ul>No tabs in sight, and indentation courtesy of HTML tags. -- DaveHarris
The more I deal with tabs, the less I like them. (BTW, I use 2-space indents in the UseModWiki source.) For me, the last word on the topic is from the W3C HTML spec: