Re: no newlines in as_HTML?
Gisle Aas (aas@bergen.sn.no)
Mon, 15 Jul 1996 19:28:00 +0200
In message <9607150734.aa06235@q2.ics.uci.edu>, Fred Douglis writes:
> Something else that has changed from b5 to 5.0 (without any particular mentio
n
> in the ChangeLog from what I can tell)
It is hidden as:
o New start for $html->as_HTML().
> is the lack of newlines in generated
> HTML. Seems like the library used to insert newlines in any constructs that
> weren't configured not to insert them. Now it just builds a list of elements
> and joins them with the null separator followed by one newline at the end.
>
> Normally HTML is insensitive to the lack of newlines, but when parsing and
> regenerating a large document, missing newlines can be annoying. In fact, I
> used to use "GET -o html file:..." to pretty-print a file that had poor
> structure and turn it into something that was nicely indented. I really miss
> that -- is there a way to do that still?
No, but I will try to add formatted HTML once again. Using a
recursive as_HTML() was a dead end. Sorry about that.
> Anyway, my temporary fix was to change the join construct in as_HTML to join
> with newlines, but I'm not sure that's guaranteed to work.
You sometimes change the meaning of HTML by introducing whitespace
(e.g. newlines) between elements. <i>some</i><b>thing</b>
> I don't want to modify every
> script to use a new class in place of HTML. If I don't want to touch the
> original library, is it sufficient to redefine it directly, as in:
>
> require HTML::Element;
> {
> package HTML::Element;
>
> sub as_HTML
> {
> # ... new version goes here
> }
> }
Yes, you can do this but 'perl -w' will give you a warning.
Regards,
Gisle