Factor out post generation components
This commit is contained in:
parent
87e18dbf60
commit
731d7aa19c
3 changed files with 122 additions and 113 deletions
|
@ -35,3 +35,20 @@ sub post-link(Int:D $id, Post:D $post --> Str:D) is export {
|
|||
sub icon($icon) is export {
|
||||
i(:class("bx bx-$icon"))
|
||||
}
|
||||
|
||||
sub mins-to-string($mins) is export {
|
||||
if $mins < 60 {
|
||||
$mins.Str ~ "m"
|
||||
} else {
|
||||
my $h = $mins div 60;
|
||||
my $m = $mins mod 60;
|
||||
$h.Str ~ "h" ~ $m.Str ~ "m"
|
||||
}
|
||||
}
|
||||
|
||||
sub intersperse (\element, +list) is export {
|
||||
gather for list {
|
||||
FIRST .take, next;
|
||||
take slip element, $_;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue