aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmh14
1 files changed, 4 insertions, 10 deletions
diff --git a/mh b/mh
index cae73bf..070c121 100755
--- a/mh
+++ b/mh
@@ -12,7 +12,7 @@ use Text::ParseWords qw/quotewords/;
# 1.1 Global program state
my $empty = ''; # currently buffered empty lines
-my $opel = ''; # currently opened element
+my $close = ''; # buffered closing tag for currently opened element
# 1.2 Elements
@@ -58,11 +58,8 @@ sub request {
$empty = '';
# Close currently open block element, open new
- if (exists $blels{$opel}) {
- print end($blels{$opel}) . "\n";
- $opel = '';
- }
- $opel = $elkey;
+ print $close;
+ $close = interpol(end($blels{$elkey}), @argv) . "\n";
print interpol(start($blels{$elkey}), @argv) . "\n";
} elsif (exists $inels{$elkey}) {
@@ -113,7 +110,4 @@ while (<>) {
}
# 2.2 Close currently open block element
-if (exists $blels{$opel}) {
- print end($blels{$opel}) . "\n";
- $opel = '';
-}
+print $close;