RE: [ROOT] Bug in THtml

From: Axel Naumann (axel-naumann@gmx.de)
Date: Mon Jul 08 2002 - 22:32:23 MEST


Hi,

I know Christian, that's how this THtml <pre> suppression business started.
I have written a little patch for THtml now:

source            -> html output
================================
Begin_Html        -> "<pre>"
Begin_Html <pre>  -> "<pre>"
Begin_Html </pre> -> "<pre></pre>"

(and accordingly for End_Html). The exact behavior:
THtml keeps track of whether there is an open <pre> (e.g. due to Begin_Html)
or not. If there is an open <pre> all other opening <pre>s will be ignored,
only closing </pre>s will be accepted. This allows code like in TMinuit,
where </pre> is closed directly after Begin_Html, but where there are other
<pre>...</pre> code blocks inside the same Begin/End_Html block. This
"algorithm" is far from perfect, but it should work for simple cases.

THtml's code is not getting any nicer (yak: yet another kluge); Christian
Holm Christensen and I are planning / working on a complete rewrite of
THtml. For me it's a spare time project, so it might take a while. Until
then, provided rootdev decides to apply this patch, this is what THtml does
to pres in Begin/End_Html blocks.

Cheers, Axel.

> -----Original Message-----
> From: owner-roottalk@pcroot.cern.ch
> [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Christian Holm
> Christensen
> Sent: Monday, July 08, 2002 1:49 PM
> To: axel@fnal.gov
> Cc: GENTIT@dapnia.cea.fr; roottalk@pcroot.cern.ch
> Subject: Re: [ROOT] Bug in THtml
>
>
> Hi Axel, Francois-Xavier, and others,
>
> Just a short note on this.
>
> On Sat, 06 Jul 2002 08:55:51 +0200
> axel@fnal.gov wrote
> concerning "Re: [ROOT] Bug in THtml":
> > Hi,
> >
> > * <pre> tags within Begin_html and End_html are ignored as THtml
> > generates enclosing pre tags for documentation found in sources /
> > headers automatically. If THtml would allow additional contained pre
> > layers some browsers can't display the page properly anymore. I will
> > add a little bit of brain to THtml to allow it to see if there's
> > another layer of pres opened (in which case the pre /pre tags are
> > removed) or if the Begin/End_html's pres are closed (in which case
> > they'll make it into the html output).
>
> I believe that '<pre>' does not allow nested '<pre>', and so the
> browsers that does not render the page correctly are doing The Right
> Thing(tm) - that is being standard compliant.  I tried the following
> fragment on W3C HTML validator [1], and indeed, it doesn't check:
>
>     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
>     <HTML>
>       <HEAD>
>         <META HTTP-EQUIV="Content-Type"
>               CONTENT="text/html; charset=ISO-8859-1">
>         <TITLE>A test of nested PRE's</TITLE>
>       </HEAD>
>       <BODY>
>         <PRE>
>           Hello World
>           <PRE>
>             FUBAR
>           </PRE>
>         </PRE>
>       </BODY>
>     </HTML>
>
>
> Of course, one can work with the (shady) knowledge that THtml outputs
> '<pre>' tags, and do something like
>
>     // don't make lines like this extend column 70 - it makes the code
>     // easier to read
>     //____________________________________________________________________
>     /*Begin_Html
>     </pre>
>       This text is rendered with superflous white-space removed.  We
>       can put in a
>     <pre>
>       &lt;PRE&gt; element here, if we need that.
>     </pre>
>     However, it's impartive that we start a new <tt>&lt;PRE&gt;</tt>
>     element before leaving this bleck, so the rest of the page comes
>     out alright.  You should <strong>always</string>
>     <a href="http://validator.w3.org/check/referer">check</a> your
>     HTML code for validity, so that you're sure that all (conforming)
>     browsers will render you code correctly.
>     <PRE>
>     */End_Html
>
>
> Yours,
>
>  ____ |  Christian Holm Christensen
>   |_| |
> -------------------------------------------------------------
>     | |	 Address: Sankt Hansgade 23, 1. th.  Phone:  (+45)
> 35 35 96 91
>      _|	          DK-2200 Copenhagen N       Cell:   (+45)
> 24 61 85 91
>     _|	          Denmark                    Office: (+45)
> 353  25 305
>  ____|	 Email:   cholm@nbi.dk               Web:
www.nbi.dk/~cholm
 | |


[1] http://validator.w3.org/



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:59 MET