summaryrefslogtreecommitdiff
path: root/localmarkdown2sms
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2009-08-08 18:29:00 +0200
committerJonas Smedegaard <dr@jones.dk>2009-08-08 18:29:00 +0200
commitbe7f19b67f56707605334e717d873604382dc98f (patch)
tree22295646395484ea1659dcce01a448912fd5ee16 /localmarkdown2sms
parented9a3a4bf12c887db35e9856dbd124e4a4bf3255 (diff)
Fix avoid un-key'ed content.
Diffstat (limited to 'localmarkdown2sms')
-rwxr-xr-xlocalmarkdown2sms10
1 files changed, 4 insertions, 6 deletions
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)