}
sub html_write {
+ sub chucked {
+ my $buffer = $_[0];
+ my @paragraph = @{$_[1]};
+ unless (substr($buffer, 0, 1) eq '<' and raw) {
+ push(@paragraph, "<p>\n" . $buffer . "</p>\n");
+ } else {
+ push(@paragraph, $buffer);
+ }
+ return \@paragraph;
+ }
my ($dref, $fh) = @_;
%d = %$dref;
my @paragraph;
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, "<p>\n" . $buffer . "</p>\n");
- } else {
- push(@paragraph, $buffer);
- }
+ @paragraph = @{chucked($buffer, \@paragraph)};
$raw = 0;
$buffer = '';
} elsif (substreq($short, '#+BEGIN_SRC')) {
$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, "<p>\n" . $buffer . "</p>\n");
- } else {
- push(@paragraph, $buffer);
- }
-
+ @paragraph = @{chucked($buffer, \@paragraph)};
$d{'paragraph'} = \@paragraph;
my $content;
$template->process('article.html', \%d, \$content)