467,907 Members | 1,097 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,907 developers. It's quick & easy.

any guarantees how tabs in <PRE> will be rendered?

In wdg-html-reference/html40/block/pre.html there is no mention about
how ASCII tabs (^I) are to be rendered. I suppose all bets are off?

Wait, my docs go thru html-tidy first, and it says
tab-size: number
Sets the number of columns between successive tab stops. The
default is 4. It is used to map tabs to spaces when reading
files. Tidy never outputs files with tabs.

However, in emacs, tab-width's value is 8. Solution:
$ echo tab-size: 8 >> ~/.tidyrc

Is 4 more common than 8? Why would tidy pick 4?
Jul 20 '05 #1
  • viewed: 3186
Share:
1 Reply
Dan Jacobson <ji*****@jidanni.org> wrote:
In wdg-html-reference/html40/block/pre.html
You presumably mean
http://www.htmlhelp.com/reference/html40/block/pre.html
there is no mention about
how ASCII tabs (^I) are to be rendered. I suppose all bets are off?
If you check the specification (using e.g. links at the bottom of that
page), you will see that there is a definition on how tabs should be
dealt with in <pre> content _and_ a remark that you should not rely on
that since browser behavior varies. Well, the HTML 4 wording has
actually even removed the _definition_ and replaced it with a
_description_:
"The horizontal tab character (decimal 9 in [ISO10646] and [ISO88591] )
is usually interpreted by visual user agents as the smallest non-zero
number of spaces necessary to line characters up along tab stops that
are every 8 characters. We strongly discourage using horizontal tabs in
preformatted text since it is common practice, when editing, to set the
tab-spacing to other values, leading to misaligned documents."
Source: http://www.w3.org/TR/html4/struct/text.html#edef-PRE
Wait, my docs go thru html-tidy first, and it says
tab-size: number
Sets the number of columns between successive tab stops. The
default is 4. It is used to map tabs to spaces when reading
files. Tidy never outputs files with tabs.


That's rather illogical, though understandable (since in many contexts
outside HTML, such tab stop settings are common). It means that a valid
HTML document (the use of tabs is valid, though not recommended) will
be converted to a document with a different meaning as per the old
specifications, since in <pre> content the amount of white space is
significant.

But why would this matter, in HTML authoring for the WWW? If your data
is tabular, you should probably not use <pre> at all but <table>.
And if you have existing data with tabs, and for some reason you are
not going to convert it to table format, then you should run a
conversion that replaces tabs by spaces _as adequate for the data_.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

21 posts views Thread by Headless | last post: by
1 post views Thread by Alan Illeman | last post: by
3 posts views Thread by Michael Shell | last post: by
9 posts views Thread by Eric Lindsay | last post: by
14 posts views Thread by Schraalhans Keukenmeester | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.