summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2007-09-19 04:09:34 +0000
committerRuss Allbery <eagle@eyrie.org>2007-09-19 04:09:34 +0000
commit810776191dbb1c0d6f8443ef4cd030b2adfd70e5 (patch)
tree1bb8ab31257ae7392f62a5baf47d1dcb62183cc3
parent81fc0683c6dc4103c427772363c6396981a1b891 (diff)
Drop blank lines at the start of a parsed section and don't treat blank
lines at the start of text as another paragraph. Thanks to Benjamin A'Lee for the report.
-rwxr-xr-xbin/spin2
1 files changed, 2 insertions, 0 deletions
diff --git a/bin/spin b/bin/spin
index a82ab27..2d0b9aa 100755
--- a/bin/spin
+++ b/bin/spin
@@ -613,6 +613,7 @@ sub format_string {
# can contain multiple paragraphs.
sub split_paragraphs {
my $text = shift;
+ $text =~ s/^\n(\s*\n)+/\n/;
my @paragraphs;
while ($text && $text =~ s/^(.*?(?:\n\n+|\s*\z))//s) {
my $paragraph = $1;
@@ -1031,6 +1032,7 @@ sub spin {
$_ .= $extra;
}
my $result = parse (escape ($_), 1);
+ $result =~ s/^(?:\s*\n)+//;
output $result unless ($result =~ /^\s*$/);
($fh, $FILE) = @{ $FILES[0] };
}