From 0be46ba475d0ed3fde298020acbeefd187d0cbde Mon Sep 17 00:00:00 2001 From: acli Date: Thu, 12 Feb 2004 09:02:39 +0000 Subject: [PATCH] This should be good enough to replace text-extract.pl, but some real testing is needed. --- misc/translator/text-extract2.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/translator/text-extract2.pl b/misc/translator/text-extract2.pl index fe2cdd25ef..d19ef112c5 100755 --- a/misc/translator/text-extract2.pl +++ b/misc/translator/text-extract2.pl @@ -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; } } -- 2.20.1