Rendering template
This commit is contained in:
parent
abe676f512
commit
815ff4bf4e
3 changed files with 71 additions and 0 deletions
15
blog
15
blog
|
@ -22,6 +22,9 @@ my IO::Path:D $default-db-dir =
|
|||
$default-blog-dir.add('db/')
|
||||
};
|
||||
|
||||
#| The default output directory
|
||||
my IO::Path:D $default-site-dir = $default-blog-dir.add('site/');
|
||||
|
||||
#| Initalize the database
|
||||
multi MAIN(
|
||||
"db",
|
||||
|
@ -108,3 +111,15 @@ multi MAIN(
|
|||
say 'Post inserted with id ', $id;
|
||||
say 'Post has slugs: ', $db.posts{$id}.all-slugs;
|
||||
}
|
||||
|
||||
#| Render the blog to html
|
||||
multi MAIN(
|
||||
"render",
|
||||
#| The path of the database directory
|
||||
IO::Path(Str) :$db-dir = $default-db-dir,
|
||||
#| The path of the output directory
|
||||
IO::Path(Str) :$site-dir = $default-site-dir,
|
||||
) {
|
||||
my $db = read-db $db-dir;
|
||||
$db.render: $site-dir;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue