aboutsummaryrefslogtreecommitdiff
path: root/template.pl
diff options
context:
space:
mode:
authorlemurianmage <azureazure@disroot.org>2026-06-21 21:32:02 +0200
committerlemurianmage <azureazure@disroot.org>2026-06-21 21:32:02 +0200
commitfb6d875e98a3d1211b4d275b6c012679ac26c446 (patch)
tree7d96e77d99f2b1fabd330235bed930b4078f0da4 /template.pl
parent3782f2e533b0a5e517e2e4074db166c8d65dc8cd (diff)
downloadslimegirl.nexus-fb6d875e98a3d1211b4d275b6c012679ac26c446.tar.gz
switch to lowdown and write something
Diffstat (limited to 'template.pl')
-rwxr-xr-xtemplate.pl8
1 files changed, 4 insertions, 4 deletions
diff --git a/template.pl b/template.pl
index 651d7aa..5c97e61 100755
--- a/template.pl
+++ b/template.pl
@@ -9,6 +9,8 @@ use autodie;
use Mojo::DOM;
use File::Basename;
+use open qw( :std :encoding(UTF-8) );
+
my $template = do {
local $/;
open my $fh, '<', 'template.html';
@@ -17,21 +19,19 @@ my $template = do {
my $dom = Mojo::DOM->new($template);
-my $content = `md2html $ARGV[0]`;
+my $content = `lowdown --html-no-head-ids $ARGV[0]`;
# inject content @ <article>
$dom->at('article')->content($content);
# replace <title> with the contents of the first <h1>
-# also append a <hr> after the first <h1>
my $title_dom = $dom->at('h1');
$dom->at('title')->content($title_dom->text) if ($title_dom);
-$title_dom->append('<hr>');
# makes the up button go up a directory
my $parent = dirname $ARGV[0];
$parent =~ s/^(?:.+?)(\/.*)/$1/;
-$parent = dirname $parent if (basename($ARGV[0]) eq 'index.md' or $parent eq "src");
+$parent = dirname $parent if (basename($ARGV[0]) eq 'index.md' or $parent eq 'src');
$dom->at('#go-up')->attr(href => $parent);
# give title the same contents as alt if it exists