From be7f19b67f56707605334e717d873604382dc98f Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sat, 8 Aug 2009 18:29:00 +0200 Subject: Fix avoid un-key'ed content. --- localmarkdown2sms | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'localmarkdown2sms') diff --git a/localmarkdown2sms b/localmarkdown2sms index 6a4a9cf..ddc1366 100755 --- a/localmarkdown2sms +++ b/localmarkdown2sms @@ -82,7 +82,7 @@ foreach my $file (read_dir( $path )) { warn( "skipping non-parsable headline \"$line\" in file \"$file\""); } # reply - } else { + } elsif ( defined( $key )) { $content = $reply{$key}[$i] if (defined($reply{$key}[$i])); $content .= $line . "\n"; $content =~ s/^\h*$//g; # clean virtually empty lines @@ -90,11 +90,9 @@ foreach my $file (read_dir( $path )) { $content =~ s/\n\n+/\n\n/g; # strip excess newlines $content =~ s/(\S)\n([^\n])/$1 $2/g; # convert newline to space $content =~ s/\h*$//g; # strip all trailing spaces - if ( defined( $key )) { - $reply{$key}[$i] = $content; - } else { - warn( "skipping non-key'ed content \"$1\" in file \"$file\"" ); - } + $reply{$key}[$i] = $content; + } else { + warn( "skipping non-key'ed content \"$line\" in file \"$file\"" ); } } # tidy latest reply (TODO: use sub) -- cgit v1.2.3