W3C home > Mailing lists > Public > html-tidy@w3.org > April to June 2000

Re: Tidy Wraps Between an Attribute and its Value: Problem?

From: <html-tidy@war-of-the-worlds.org>
Date: Sat, 29 Apr 2000 12:35:45 -0500
Message-Id: <p04310100b530c8f7c7ac@[216.229.13.10]>
To: html-tidy@w3.org
Mr Israel Steinmetz <MrData@mail.com> wrote:

>Dear Dave Raggett,

Well, I'm not Dave, but maybe I can answer your question.  I've dealt with
it myself.

>I'm disturbed at the way Tidy wraps lines by inserting a space between
>an attribute's equal sign and its value. For example, one might see Tidy
>wrap as follows:
>
><a href=
>"http://www.mrdata.net/">
>
>Is this a problem? Everywhere I look, I see the HTML specification for
>an attribute in the following form: attribute="value"

Whitespace is allowed on both sides of the equals sign in the
attribute=value pair, including newlines.  The specification allows this
and the browsers I've used have had no problems with it.

However, personally, I use a patched version of HTML Tidy that does not
wrap after the equals sign, just because I don't like it.  In pprint.c,
PPrintAttrValue(), I commented out the three ifs after the first "AddC('=',
linelen++);", including the third if's else (the "if (indent + linelen ..."
ifs, the entire block).  If you want to put a switch on the wrapping after
equals, that's where you'd put it:  around those ifs.

I have an additional patch that only quotes attributes when necessary (yes,
I know X*ML requires they all be quoted, which is why I programmed in an
exception for that case), but it isn't tuned the way I want it.  I prefer
free-form CDATA attributes to always be quoted (such as SRC and HREF) and
only leave unquoted those attributes that take key word values.  HTML Tidy
doesn't know the difference (generally doesn't care about attribute values)
so that step is stalled until I motivate myself to teach Tidy these things
(probably an expansion of the global list of attributes).
-- 
         ,=<#)-=#  <http://www.war-of-the-worlds.org/>
    ,_--//--_,
 _-~_-(####)-_~-_  "Did you see that Parkins boy's body in the tunnels?" "Just
(#>_--'~--~`--_<#)  the photos.  Worst thing I've ever seen; kid had no face."
Received on Saturday, 29 April 2000 13:36:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:43 GMT