From 0eeee9d499e1b42dd2549f2945dce481aa6f9c15 Mon Sep 17 00:00:00 2001 From: Emil Williams Date: Mon, 4 Aug 2025 22:55:05 +0000 Subject: [PATCH] -- --- bloog/bloog.pl | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/bloog/bloog.pl b/bloog/bloog.pl index 6f18172..794f79d 100755 --- a/bloog/bloog.pl +++ b/bloog/bloog.pl @@ -49,6 +49,16 @@ sub substreq { } sub html_write { + sub chucked { + my $buffer = $_[0]; + my @paragraph = @{$_[1]}; + unless (substr($buffer, 0, 1) eq '<' and raw) { + push(@paragraph, "

\n" . $buffer . "

\n"); + } else { + push(@paragraph, $buffer); + } + return \@paragraph; + } my ($dref, $fh) = @_; %d = %$dref; my @paragraph; @@ -58,11 +68,7 @@ sub html_write { while (my $line = <$fh>) { chomp(my $short = $line); if ($short eq '' && not $pre && not $raw) { - unless (substr($buffer, 0, 1) eq '<' and raw) { - push(@paragraph, "

\n" . $buffer . "

\n"); - } else { - push(@paragraph, $buffer); - } + @paragraph = @{chucked($buffer, \@paragraph)}; $raw = 0; $buffer = ''; } elsif (substreq($short, '#+BEGIN_SRC')) { @@ -78,15 +84,7 @@ sub html_write { $buffer .= $line; } } - # I dare not use a function - # I dare not use a goto (deprecated in 5.42, fuck you too) - # I am cucked forever and ever to to duplicate code - unless (substr($buffer, 0, 1) eq '<' and raw) { - push(@paragraph, "

\n" . $buffer . "

\n"); - } else { - push(@paragraph, $buffer); - } - + @paragraph = @{chucked($buffer, \@paragraph)}; $d{'paragraph'} = \@paragraph; my $content; $template->process('article.html', \%d, \$content) -- 2.39.5