Re: Working with Tidy and HTML comments

How about this:

# add line breaks to concatenated comments
while ($tidied_data =~ />\s?<!--/) {
     $tidied_data =~ s/\s*(<!--.*?-->)\s*/\n$1\n/gsi;
}


Please find attached an updated version of my perl function that passes 
HTML content to tidy and fixes up some flaws before returning the tidied 
content.


sebastian

At 16:15 18.05.2000 +0900, Peter Evans wrote:
> > <!-- END GRAPHIC -->
> >
> > <!-- SECOND TABLE STARTS HERE -->
> >
> > Tidy concatinates the two comments like this.
> >
> > <!-- END GRAPHIC --><!-- SECOND TABLE STARTS HERE
> > -->
>
>If this is a problem -- and I suppose that yes, it might impede
>legibility -- then I'd just run Tidy's output through some filter.
>Being too lazy to do any programming, I don't use perl myself, but I'd
>guess that such a perl routine would be easy to write.  The program I
>use is the underpublicized and pricy but excellent shareware SNR; it's
>easy to write a translation table that for example adds two line breaks
>to the middle of any example of "--><!--".
>
>++++++++++++++++
>Peter Evans mailto:evans@i.hosei.ac.jp
--
Sebastian Lange
http://www.sl-chat.de/
Maybe the first chat site that validates as HTML
4.0 even though user input may contain HTML codes.

Courtesy to Dave Raggett's HTML Tidy:
http://www.w3.org/People/Raggett/tidy/

Received on Thursday, 18 May 2000 04:41:44 UTC