26 lines
640 B
Raku
26 lines
640 B
Raku
#| Post database
|
|
unit module DB;
|
|
|
|
use Pandoc;
|
|
|
|
#| Shared post meta-data
|
|
role Post {
|
|
#| The location of the source file for the post
|
|
has IO::Path:D $.source is required;
|
|
#| The time to display for the creation of the post
|
|
has DateTime:D $.posted-at is required;
|
|
#| An optional list of edit times for the post
|
|
has DateTime:D @.edited-at is rw = [];
|
|
|
|
#| Get the title for this post, intended to be extracted from whatever
|
|
#| document produced it
|
|
method title(--> Str:D) {...}
|
|
}
|
|
|
|
#| A plain markdown post
|
|
class MarkdownPost does Post {
|
|
|
|
method title(--> Str:D) {
|
|
markdown-title($!source)
|
|
}
|
|
}
|