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 v6.e.PREVIEW;
|
||||||
|
|
||||||
use DB;
|
use DB;
|
||||||
|
use DB::MarkdownPost;
|
||||||
|
|
||||||
my %*SUB-MAIN-OPTS =
|
my %*SUB-MAIN-OPTS =
|
||||||
:named-anywhere,
|
:named-anywhere,
|
||||||
|
@ -83,7 +84,7 @@ multi MAIN(
|
||||||
my $db = load-db $db-file;
|
my $db = load-db $db-file;
|
||||||
my $id =
|
my $id =
|
||||||
$db.insert-post:
|
$db.insert-post:
|
||||||
DB::MarkdownPost.new(
|
MarkdownPost.new(
|
||||||
source => $source.absolute.IO,
|
source => $source.absolute.IO,
|
||||||
posted-at => $posted-at,
|
posted-at => $posted-at,
|
||||||
hidden => $hidden,
|
hidden => $hidden,
|
||||||
|
|
|
@ -8,18 +8,7 @@ use JSON::Class:auth<zef:vrurg>;
|
||||||
|
|
||||||
use DB::Post;
|
use DB::Post;
|
||||||
use DB::BlogMeta;
|
use DB::BlogMeta;
|
||||||
|
use DB::MarkdownPost;
|
||||||
#| 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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#| A plain markdown post
|
#| A plain markdown post
|
||||||
class IdrisPost does Post is json {
|
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