diff options
Diffstat (limited to 'template.pl')
| -rwxr-xr-x | template.pl | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/template.pl b/template.pl index 5c97e61..793f9b3 100755 --- a/template.pl +++ b/template.pl @@ -11,22 +11,9 @@ use File::Basename; use open qw( :std :encoding(UTF-8) ); -my $template = do { - local $/; - open my $fh, '<', 'template.html'; - <$fh>; -}; +my $content = `lowdown --html-titleblock --html-no-head-ids -s --template template.html $ARGV[0]`; -my $dom = Mojo::DOM->new($template); - -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> -my $title_dom = $dom->at('h1'); -$dom->at('title')->content($title_dom->text) if ($title_dom); +my $dom = Mojo::DOM->new($content); # makes the up button go up a directory my $parent = dirname $ARGV[0]; |
