Fix tag formatting issues

This commit is contained in:
Nathan McCarty 2025-02-09 03:10:21 -05:00
parent 4793d660e2
commit 5c569780dc
3 changed files with 16 additions and 8 deletions

View file

@ -10,6 +10,14 @@ use DB::Post;
unit class Config;
sub show-html($html) {
my $out = "<!doctype html>$html";
# Work around HTML::Functional automatically putting newlines between tags
$out ~~ s:g/'</i>' \v+ '<span>'/<\/i><span>/;
$out ~~ s:g/\v+ '</a>'/<\/a>/;
$out
}
# TODO: Support GFM admonitions
method generate-post(Int:D $id, Post:D $post, $db) {
my $meta = $db.meta;
@ -34,7 +42,7 @@ method generate-post(Int:D $id, Post:D $post, $db) {
$body
];
"<!doctype html>$html"
show-html $html
}
method generate-blurb(Int:D $id, $db) {
@ -81,7 +89,7 @@ method generate-index($db) {
$body
];
"<!doctype html>$html"
show-html $html
}
method generate-archive($db) {
@ -106,7 +114,7 @@ method generate-archive($db) {
$body
];
"<!doctype html>$html"
show-html $html
}
method generate-tag-blurb($db, $tag, $limit?) {
@ -164,7 +172,7 @@ method generate-tags-page($db, @tags) {
$body
];
"<!doctype html>$html"
show-html $html
}
method generate-tag-page($db, $tag) {
@ -180,5 +188,5 @@ method generate-tag-page($db, $tag) {
$body
];
"<!doctype html>$html"
show-html $html
}