#!/usr/bin/perl -w # Extract all plain text from an HTML file use strict; use HTML::Parser 3.00 (); my %inside; sub tag { my($tag, $num) = @_; $inside{$tag} += $num; print " "; # not for all tags } sub text { return if $inside{script} || $inside{style}; print $_[0]; } HTML::Parser->new(api_version => 3, handlers => [start => [\&tag, "tagname, '+1'"], end => [\&tag, "tagname, '-1'"], text => [\&text, "dtext"], ], marked_sections => 1, )->parse_file(shift) || die "Can't open file: $!\n";;
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
hanchors | File | 1.11 KB | 0644 |
|
hdump | File | 541 B | 0644 |
|
hform | File | 1.8 KB | 0644 |
|
hlc | File | 547 B | 0644 |
|
hrefsub | File | 2.72 KB | 0644 |
|
hstrip | File | 1.67 KB | 0644 |
|
htext | File | 548 B | 0644 |
|
htextsub | File | 788 B | 0644 |
|
htitle | File | 434 B | 0644 |
|