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; 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 # TODO: Support GFM admonitions
method generate-post(Int:D $id, Post:D $post, $db) { method generate-post(Int:D $id, Post:D $post, $db) {
my $meta = $db.meta; my $meta = $db.meta;
@ -34,7 +42,7 @@ method generate-post(Int:D $id, Post:D $post, $db) {
$body $body
]; ];
"<!doctype html>$html" show-html $html
} }
method generate-blurb(Int:D $id, $db) { method generate-blurb(Int:D $id, $db) {
@ -81,7 +89,7 @@ method generate-index($db) {
$body $body
]; ];
"<!doctype html>$html" show-html $html
} }
method generate-archive($db) { method generate-archive($db) {
@ -106,7 +114,7 @@ method generate-archive($db) {
$body $body
]; ];
"<!doctype html>$html" show-html $html
} }
method generate-tag-blurb($db, $tag, $limit?) { method generate-tag-blurb($db, $tag, $limit?) {
@ -164,7 +172,7 @@ method generate-tags-page($db, @tags) {
$body $body
]; ];
"<!doctype html>$html" show-html $html
} }
method generate-tag-page($db, $tag) { method generate-tag-page($db, $tag) {
@ -180,5 +188,5 @@ method generate-tag-page($db, $tag) {
$body $body
]; ];
"<!doctype html>$html" show-html $html
} }

View file

@ -63,7 +63,7 @@ sub post-tag(Str:D $tag) is export {
span :class<post-tag>, [ span :class<post-tag>, [
a :href("/tags/$tag.html"), [ a :href("/tags/$tag.html"), [
icon 'hash'; icon 'hash';
$tag; span $tag;
] ]
] ]
} }

View file

@ -65,10 +65,10 @@ body, .post {
flex-wrap: wrap; flex-wrap: wrap;
margin-top: var(--box-margin-vert); margin-top: var(--box-margin-vert);
} }
.header-links > a > span, .post-series-tag > a > span { .header-links > a > span, .post-series-tag > a > span, .post-tag > a > span {
text-decoration: underline; text-decoration: underline;
} }
.header-links > a, .post-series-tag > a { .header-links > a, .post-series-tag > a, .post-tag > a {
text-decoration: none; text-decoration: none;
} }