lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Lynx-dev] Feature request: handle style=white-space: pre


From: Chuck Houpt
Subject: RE: [Lynx-dev] Feature request: handle style=white-space: pre
Date: Wed, 14 May 2008 15:46:11 -0400

<div style="white-space: pre; font-family: monospace">
Some formatted text
with a smiley <img src="smiley.png"> in the middle.
</div>

That validates against the HTML4 DTD, but Lynx doesn't render it correctly.

Thanks for the example, the restrictions on PRE are annoying.

I think it is a little harsh to say Lynx is not rendering the DIV correctly. Certainly, Lynx is not rendering the DIV as intended, but Lynx is faithfully renders the HTML structure of the document. If a DIV has no internal structure, Lynx has no choice but to render it as regular text.

To give the DIV internal structure, I think you could add BRs, and (if needed) replace spaces with non-breaking spaces (this seems to be the method used by some web source-code pretty-printing systems). For example:

<div style="...">
Some formatted text<br>
with a smiley <img src="smiley.png"> in the middle.<br>
</div>

The fact that CSS can make un-structured text appear to be structured, doesn't mean the text actually has structure. Adding BRs gives structure to the DIV's text, so Lynx can render it as intended.

Even if/when Lynx supports CSS, I'd argue that you'd still need to structure the text with BRs, because many systems will need the structure to correctly interpret the document (search engine robots, text-to-speech systems, etc.)

On a lighter note, without BRs for structure, a page won't be able to participate in CSS Naked Day: http://naked.dustindiaz.com/

Cheers - Chuck

---
Example structural replacement of PRE:

<PRE>
some text
   indented text
</PRE>

<DIV>
some&nbsp;text<BR>
&nbsp;&nbsp;&nbsp;indented&nbsp;text<BR>
</DIV>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]