Working markdown post title
This commit is contained in:
parent
ec491f6c98
commit
0b199cf9b9
4 changed files with 46 additions and 7 deletions
26
lib/DB.rakumod
Normal file
26
lib/DB.rakumod
Normal file
|
@ -0,0 +1,26 @@
|
|||
#| 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)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue