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

Re: Bug tydiing <A HREF...></A>

From: <html-tidy@war-of-the-worlds.org>
Date: Tue, 20 Jun 2000 14:03:14 -0500
Message-Id: <p04320401b575645be7df@[216.229.13.10]>
To: html-tidy@w3.org
FITZ Michael <michael.fitz@creditanstalt.co.at> wrote:

>Hi,

<SPAN CLASS="SimpsonsDrNick">Hi, Michael Fitz!</SPAN>

>This is the original:
>
><DL>
><A HREF="#BookI1"><DT>Item1<DD>This is Item1</A>
><A HREF="#BookI2"><DT>Item2<DD>This is Item2</A>
></DL>
>
>This is what Tidy says:

I'll diagram the process as I did the other message on the H1 in CAPTION
error, except this time, since the errors aren't one after another, I'll
include before and after shots.

===

Before Error:

<DL>
	+
<A HREF="#BookI1"><DT>Item1<DD>This is Item1</A>
<A HREF="#BookI2"><DT>Item2<DD>This is Item2</A>
</DL>

>line 11 column 1 - Warning: missing <dd>

After error:

<DL>
	<DD>
		+
<A HREF="#BookI1"><DT>Item1<DD>This is Item1</A>
<A HREF="#BookI2"><DT>Item2<DD>This is Item2</A>
</DL>

===

Before error:

<DL>
	<DD>
		<A HREF="#BookI1">
			+
<DT>Item1<DD>This is Item1</A>
<A HREF="#BookI2"><DT>Item2<DD>This is Item2</A>
</DL>

>line 11 column 19 - Warning: missing </a> before <dt>

After error:

<DL>
	<DD>
		<A HREF="#BookI1">
		</A>
		+
<DT>Item1<DD>This is Item1</A>
<A HREF="#BookI2"><DT>Item2<DD>This is Item2</A>
</DL>

===

<DL>
	<DD>
		<A HREF="#BookI1">
		</A>
	<DT>
		Item1
	<DD>
		This is Item1
		+
</A>
<A HREF="#BookI2"><DT>Item2<DD>This is Item2</A>
</DL>

>line 11 column 45 - Warning: discarding unexpected </a>

<DL>
	<DD>
		<A HREF="#BookI1">
		</A>
	<DT>
		Item1
	<DD>
		This is Item1
		+
<A HREF="#BookI2"><DT>Item2<DD>This is Item2</A>
</DL>

===

<DL>
	<DD>
		<A HREF="#BookI1">
		</A>
	<DT>
		Item1
	<DD>
		This is Item1
		<A HREF="#BookI2">
			+
<DT>Item2<DD>This is Item2</A>
</DL>

Note that, because you didn't explicitly close the <DD> with </DD>, the
next <A> is treated as part of that DD.  It doesn't close implicitly until
the <DT>.

>line 12 column 19 - Warning: missing </a> before <dt>

<DL>
	<DD>
		<A HREF="#BookI1">
		</A>
	<DT>
		Item1
	<DD>
		This is Item1
		<A HREF="#BookI2">
		</A>
		+
<DT>Item2<DD>This is Item2</A>
</DL>

===

<DL>
	<DD>
		<A HREF="#BookI1">
		</A>
	<DT>
		Item1
	<DD>
		This is Item1
		<A HREF="#BookI2">
		</A>
	<DT>
		Item2
	<DD>
		This is Item2
		+
</A>
</DL>

>line 12 column 45 - Warning: discarding unexpected </a>

<DL>
	<DD>
		<A HREF="#BookI1">
		</A>
	<DT>
		Item1
	<DD>
		This is Item1
		<A HREF="#BookI2">
		</A>
	<DT>
		Item2
	<DD>
		This is Item2
		+
</DL>

===

>line 17 column 15 - Warning: missing </a> before <p>
>line 19 column 13 - Warning: discarding unexpected </a>

These errors seem to be extraneous to the snippet.  Looks like a case of
<A><P>...</A>.  You can write it as <P><A>...</A> instead with the same
result and no parsing error.

>This is was Tidy produces:
>
><DL>
><DD><A HREF="#BookI1"></A></DD>
>
><DT>Item1</DT>
>
><DD>This is Item1 <A HREF="#BookI2"></A></DD>
>
><DT>Item2</DT>
>
><DD>This is Item2</DD>
></DL>

Yup, that agrees with the above with the addition of the explicit tag closure.

>I really wanted the complete DT/DD-Pair to be a link...

That's not legal markup.

<!ELEMENT DL - - (DT|DD)+              -- definition list -->

A definition list can only contain definition list terms and definition
list definitions.  Anchors (<A>) are invalid markup and Tidy is right to
complain and adjust for them.

>The same is true if
>two (or more paragraphs <P>) are contained within one link.

Ah, I guess then the example above should have been <A><P>...<P>...</A>
being translated to the legal <P><A>...</A><P><A>...</A> (or, preferably,
<P><A>...</A></P><P><A>...</A></P>

>I think that
>tidy should not bother about the contents of a link (<SPAN>, <I> etc are yet
>accepted)

That's because they're legal inside an anchor and DL, DT, DD, and P (just
to name a very few) are not:

<!ENTITY % fontstyle
 "TT | I | B | U | S | STRIKE | BIG | SMALL">

<!ENTITY % special
   "A | IMG | APPLET | OBJECT | FONT | BASEFONT | BR | SCRIPT |
    MAP | Q | SUB | SUP | SPAN | BDO | IFRAME">

<!-- %inline; covers inline or "text-level" elements -->
<!ENTITY % inline "#PCDATA | %fontstyle; | %phrase; | %special; | %formctrl;">

<!ELEMENT A - - (%inline;)* -(A)       -- anchor -->

>and accept allthing within.

That is tag soup.  Tidy is supposed to correct the errors present in tag
soup, not preserve them.

>The above example I would manually
>tidy to:
>
><DL>
>
><A HREF="#BookI1">
><DT>Item1</DT>
><DD>This is Item1</DD>
></A>
>
><A HREF="#BookI2">
><DT>Item2</DT>
><DD>This is Item2</DD>
></A>
>
></DL>

I'd manually tidy it to:

<DL>
<DT><A HREF="#BookI1">Item1</A></DT>
<DD><A HREF="#BookI1">This is Item1</A></DD>

<DT><A HREF="#BookI2">Item2</A></DT>
<DD><A HREF="#BookI2">This is Item2</A></DD>
</DL>

That would be valid, and it would be nice if Tidy had the option to
propagate illegal (specifically reversed block-inline) nesting into the
tags to the places where it would be legal (as a tag-soup author like
Michael would intend).  I thought we were doing this already with
presentational markup; why not expand it beyond just %fontstyle; and
%phrase; markup and include some elements of %special; (A, Q, SUB, SUP,
SPAN, BDO)?
Received on Tuesday, 20 June 2000 15:03:19 GMT

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