W3C home > Mailing lists > Public > www-validator@w3.org > July 2001

Re: [Tidy-dev] Re: Unknown Encoding - Post HTMLTidy wrap

From: Terje Bless <link@tss.no>
Date: Sat, 21 Jul 2001 10:09:49 +0200
To: tidy-develop@lists.sourceforge.net
cc: Andrew Barker <boab@agn.net.au>, www-validator@w3.org
Message-ID: <20010722014939-r01010700-35f066c5-0910-010c@192.146.238.92>
On 20.07.01 at 15:49, Bjoern Hoehrmann <derhoermi@gmx.net> wrote:

>* Terje Bless wrote:
>>><meta http-equiv="Content-Type" content=
>>>"text/html; charset=ISO-8859-1">
>
>Increase the width with the -wrap option and/or use
>--wrap-attributes yes. The latter would produce something like
>
>  <meta http-equiv="Content-Type" content="text/html;
>  charset=ISO-8859-1">

Ouch!

How much info do you have available in this context? I.e. do you tokenize
this to the point where you have a DOM-ish node in memory or are you
operating on a text string? If you have the tag tokenized, you can view
each attribute with it's value as an atomic unit and generate the output
formatting based on that. That is, you end up with:

<gi [att1] [att2] [attn]>

where each attribute is immutable (in this context) and the whitespace is
considered the only legal place to break. In the specific example, and
using "auto", you'd end up with...

<meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">

...or...

<meta http-equiv="Content-Type"
      content="text/html; charset=ISO-8859-1">

...or maybe even...

<meta
  http-equiv="Content-Type"
  content="text/html; charset=ISO-8859-1"
>

...depending on which formatting profile is in use.


This then would lead to a logical name along the lines of "Smart" Wrapping;
maybe "--wrap-attributes=[auto,hard,no,yes]". The old behaviour is
preserved with "yes" and "no", "hard" is an alias for "yes", and "auto"
becomes the new default and behaves as above?

In any case, allowing breaking lines inside an attribute value is giving
yourself a headache for no real gain AFAICT; theres a bunch of pitfalls and
leads to unreadable code.
Received on Saturday, 21 July 2001 19:49:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:13:59 GMT