#!/usr/bin/perl -w # Extract all plain text from an HTML file use strict; use HTML::Parser 3.00 (); use Encode; my %inside; sub tag { my($tag, $num) = @_; $inside{$tag} += $num; print " "; # not for all tags } sub text { return if $inside{script} || $inside{style}; print encode('utf8',$_[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 |
---|---|---|---|---|
README | File | 1.06 KB | 0644 |
|
hanchors | File | 1.14 KB | 0755 |
|
hdump | File | 683 B | 0755 |
|
hform | File | 1.87 KB | 0755 |
|
hlc | File | 710 B | 0755 |
|
hrefsub | File | 2.72 KB | 0755 |
|
hstrip | File | 1.74 KB | 0755 |
|
htext | File | 575 B | 0755 |
|
htextsub | File | 955 B | 0755 |
|
htitle | File | 434 B | 0755 |
|