Clean up whitespace runs in rem2pdf.
All checks were successful
Remind unit tests / tests (push) Successful in 45s

This commit is contained in:
Dianne Skoll
2024-08-28 10:44:41 -04:00
parent 7b9b6ebc96
commit 1458ba8856

View File

@@ -85,6 +85,19 @@ sub render
} else {
$body = $self->{body};
}
# Clean up the body:
# Collapse multiple spaces/tabs to a single space
$body =~ s/[ \t]+/ /g;
# Collapse multiple newlines to a single newline
$body =~ s/\n+/\n/g;
# Remove whitespace before/after newlines
$body =~ s/\s+\n/\n/g;
$body =~ s/\n\s+/\n/g;
$layout->set_text(Encode::decode('UTF-8', $body));
my $desc = Pango::FontDescription->from_string($settings->{entry_font} . ' ' . $settings->{entry_size} . 'px');
$layout->set_font_description($desc);