Move IdrisPost to its own file

This commit is contained in:
Nathan McCarty 2025-01-22 20:53:52 -05:00
parent f767eeb589
commit 22952a01f7
2 changed files with 19 additions and 11 deletions

View file

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

18
lib/DB/IdrisPost.rakumod Normal file
View file

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