Move MarkdownPost to its own file
This commit is contained in:
parent
3fd900b2d6
commit
f767eeb589
3 changed files with 20 additions and 13 deletions
3
blog
3
blog
|
@ -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,
|
||||
|
|
|
@ -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 {
|
||||
|
|
17
lib/DB/MarkdownPost.rakumod
Normal file
17
lib/DB/MarkdownPost.rakumod
Normal 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)
|
||||
}
|
Loading…
Add table
Reference in a new issue