From 0b6030aecd6ed3cfd040798e29e568da89c0a415 Mon Sep 17 00:00:00 2001 From: acli Date: Mon, 16 Feb 2004 23:46:34 +0000 Subject: [PATCH] Some functions should not be in the module; these are now removed. --- misc/translator/TmplTokenizer.pm | 86 -------------------------------- misc/translator/text-extract2.pl | 13 +---- 2 files changed, 2 insertions(+), 97 deletions(-) diff --git a/misc/translator/TmplTokenizer.pm b/misc/translator/TmplTokenizer.pm index f672dc3f4d..6d7fa12c93 100644 --- a/misc/translator/TmplTokenizer.pm +++ b/misc/translator/TmplTokenizer.pm @@ -265,31 +265,6 @@ sub next_token (*) { ############################################################################### -sub debug_dump (*) { # for testing only - my($h) = @_; - print "re_tag_compat is /$re_tag_compat/\n"; - for (;;) { - my $s = next_token $h; - last unless defined $s; - printf "%s\n", ('-' x 79); - my($kind, $t, $attr) = @$s; # FIXME - printf "%s:\n", $kind; - printf "%4dH%s\n", length($t), - join('', map {/[\0-\37]/? $_: "$_\b$_"} split(//, $t)); - if ($kind eq KIND_TAG && %$attr) { - printf "Attributes:\n"; - for my $a (keys %$attr) { - my($key, $val, $val_orig, $order) = @{$attr->{$a}}; - printf "%s = %dH%s -- %s\n", $a, length $val, - join('', map {/[\0-\37]/? $_: "$_\b$_"} split(//, $val)), - $val_orig; - } - } - } -} - -############################################################################### - sub trim ($) { my($s) = @_; $s =~ s/^(?:\s|\ $re_end_entity)+//os; @@ -299,67 +274,6 @@ sub trim ($) { ############################################################################### -sub text_extract (*) { - my($h) = @_; - my %text = (); - for (;;) { - my $s = next_token $h; - last unless defined $s; - my($kind, $t, $attr) = @$s; # FIXME - if ($kind eq KIND_TEXT) { - $t = trim $t; - $text{$t} = 1 if $t =~ /\S/s; - } elsif ($kind eq KIND_TAG && %$attr) { - # value [tag=input], meta - my $tag = lc($1) if $t =~ /^<(\S+)/s; - for my $a ('alt', 'content', 'title', 'value') { - if ($attr->{$a}) { - next if $a eq 'content' && $tag ne 'meta'; - next if $a eq 'value' && ($tag ne 'input' - || (ref $attr->{'type'} && $attr->{'type'}->[1] eq 'hidden')); # FIXME - my($key, $val, $val_orig, $order) = @{$attr->{$a}}; #FIXME - $val = trim $val; - $text{$val} = 1 if $val =~ /\S/s; - } - } - } - } - # Emit all extracted strings. - # Don't emit pure whitespace, pure numbers, or TMPL_VAR's. - for my $t (keys %text) { - printf "%s\n", $t - unless $t =~ /^(?:\s|\ $re_end_entity|$re_tmpl_var)*$/os || $t =~ /^\d+$/; - } -} - -############################################################################### - -sub usage ($) { - my($exitcode) = @_; - my $h = $exitcode? *STDERR: *STDOUT; - print $h <{'type'} && $attr->{'type'}->[1] eq 'hidden')); # FIXME my($key, $val, $val_orig, $order) = @{$attr->{$a}}; #FIXME - $val = trim $val; + $val = TmplTokenizer::trim $val; $text{$val} = 1 if $val =~ /\S/s; } } -- 2.39.5