This should be good enough to replace text-extract.pl, but some real
testing is needed.
This commit is contained in:
parent
7d244a0b70
commit
0be46ba475
|
|
@ -7,8 +7,6 @@
|
|||
|
||||
# This script is meant to be a drop-in replacement of text-extract.pl
|
||||
|
||||
# FIXME: Trailing spaces are not yet handled correctly
|
||||
|
||||
use Getopt::Long;
|
||||
use strict;
|
||||
|
||||
|
|
@ -201,6 +199,7 @@ sub text_extract (*) {
|
|||
last unless defined $s;
|
||||
my($kind, $t, $attr) = @$s; # FIXME
|
||||
if ($kind eq KIND_TEXT) {
|
||||
$t =~ s/\s+$//s;
|
||||
$text{$t} = 1 if $t =~ /\S/s; # FIXME... trailing whitespace
|
||||
} elsif ($kind eq KIND_TAG && %$attr) {
|
||||
# value [tag=input], meta
|
||||
|
|
@ -210,13 +209,14 @@ sub text_extract (*) {
|
|||
next if $a eq 'content' && $tag ne 'meta';
|
||||
next if $a eq 'value' && $tag ne 'input';
|
||||
my($key, $val, $val_orig, $order) = @{$attr->{$a}};
|
||||
$val =~ s/\s+$//s;
|
||||
$text{$val} = 1 if $val =~ /\S/s;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for my $t (keys %text) {
|
||||
printf "%s\n", $t unless $t =~ /^(?:\s|\ )*$/;
|
||||
printf "%s\n", $t unless $t =~ /^(?:\s|\ )*$/s;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue