W3C home > Mailing lists > Public > html-tidy@w3.org > October to December 2004

Hint tidy that br is always empty

From: Markus Bertheau <twanger@bluetwanger.de>
Date: Mon, 15 Nov 2004 13:01:04 +0100
To: html-tidy@w3.org
Message-Id: <1100520064.3333.6.camel@dicaprio.akademie1.de>

Hi,

I'm using tidy to auto-correct (incorrect) XHTML text. The text is only
a part of the whole XHTML document, so there's no <html>, no <body> and
so on. Therefore I'm using the input-xml option. Now tidy corrects

Foo bar.<br>
Baz bbo.<br><br>

to

<br>Baz bbo.
<br></br></br>

Which I have two problems with:

1. The first text node is lost. I can get around this by wrapping the
string in <?xml version="1.0" encoding="UTF-8"?><a> and </a> and
removing that afterwards. With that I get:

Foo bar.
<br>Baz bbo.
<br></br></br>

2. Because <br> is an empty element in HTML its contents is not rendered
by the browser. How can I teach tidy that when it sees <br> to just make
that <br/>? How can I teach it XHTML semantics (while still allowing
arbitrary valid tags)?

Thanks

-- 
Markus Bertheau <twanger@bluetwanger.de>
Received on Monday, 15 November 2004 12:09:04 GMT

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