Move MarkdownPost to its own file

This commit is contained in:
Nathan McCarty 2025-01-22 20:49:27 -05:00
parent 3fd900b2d6
commit f767eeb589
3 changed files with 20 additions and 13 deletions

3
blog
View file

@ -2,6 +2,7 @@
use v6.e.PREVIEW;
use DB;
use DB::MarkdownPost;
my %*SUB-MAIN-OPTS =
:named-anywhere,
@ -83,7 +84,7 @@ multi MAIN(
my $db = load-db $db-file;
my $id =
$db.insert-post:
DB::MarkdownPost.new(
MarkdownPost.new(
source => $source.absolute.IO,
posted-at => $posted-at,
hidden => $hidden,

View file

@ -8,18 +8,7 @@ use JSON::Class:auth<zef:vrurg>;
use DB::Post;
use DB::BlogMeta;
#| A plain markdown post
class MarkdownPost does Post is json {
#| Marker for disambiguation between post types in json representation, the
#| cheaty way
has Bool:D $.markdown = True;
method title(--> Str:D) {
markdown-title($!source)
}
}
use DB::MarkdownPost;
#| A plain markdown post
class IdrisPost does Post is json {

View file

@ -0,0 +1,17 @@
use v6.e.PREVIEW;
use Pandoc;
use JSON::Class:auth<zef:vrurg>;
use DB::Post;
#| A plain markdown post
unit class MarkdownPost does Post is json;
#| Marker for disambiguation between post types in json representation, the
#| cheaty way
has Bool:D $.markdown = True;
method title(--> Str:D) {
markdown-title($!source)
}