As always; any comments, criticism or advice on doing this better is appreciated.
package HTML::Sanitizer; require HTML::Filter; @ISA=qw(HTML::Filter); my $data=''; my %keep=( a => 1, p => 1, img => 1 ); sub output{ my $self=shift; my $d=$_[0]; if($d=~/\<\s*\/?\s*(\w+)/){ if(exists $keep{lc($1)}){ $data.=$d; } }else{ $data.=$d; } } my $p=HTML::Sanitizer->new(); $p->parse_file("index.html"); print $data;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: HTML Sanitizer (removes unwanted tags)
by merlyn (Sage) on Aug 08, 2000 at 07:20 UTC | |
|
Re: HTML Sanitizer (removes unwanted tags)
by ehdonhon (Curate) on Apr 20, 2005 at 01:10 UTC | |
by lhoward (Vicar) on Apr 20, 2005 at 10:58 UTC |