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

On 20.07.01 at 15:49, Bjoern Hoehrmann <> 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">


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"


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

...or maybe even...

  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 UTC