urbit/pkg/arvo/mar/publish/comment.hoon

55 lines
1.3 KiB
Plaintext
Raw Normal View History

2020-01-21 21:48:22 +03:00
/- *publish
|_ com=comment
2019-07-11 21:32:30 +03:00
::
::
++ grow
|%
++ mime
2019-07-12 01:07:05 +03:00
:- /text/x-publish-comments
2019-07-11 21:32:30 +03:00
(as-octs:mimes:html (of-wain:format txt))
++ txt
^- wain
:* (cat 3 'author: ' (scot %p author.com))
(cat 3 'date-created: ' (scot %da date-created.com))
2019-07-11 21:32:30 +03:00
'-----'
2019-12-14 01:27:37 +03:00
(to-wain:format content.com)
2019-07-11 21:32:30 +03:00
==
--
++ grab
|%
++ mime
|= [mite:eyre p=octs:eyre]
2020-01-21 21:48:22 +03:00
|^ (rash q.p both-parser)
++ key-val
|* [key=rule val=rule]
;~(sfix ;~(pfix key val) gaq)
++ old-parser
;~ plug
(key-val (jest 'creator: ~') fed:ag)
(key-val (jest 'collection: ') sym)
(key-val (jest 'post: ') sym)
(key-val (jest 'date-created: ~') (cook year when:so))
(key-val (jest 'last-modified: ~') (cook year when:so))
;~(pfix (jest (cat 3 '-----' 10)) (cook crip (star next)))
==
++ new-parser
;~ plug
(key-val (jest 'author: ~') fed:ag)
(key-val (jest 'date-created: ~') (cook year when:so))
;~(pfix (jest (cat 3 '-----' 10)) (cook crip (star next)))
==
++ both-parser
;~ pose
new-parser
%+ cook
|= [author=@ @ @ date-created=@da @ content=@t]
^- comment
2020-04-09 19:38:07 +03:00
[author date-created content %.n]
2020-01-21 21:48:22 +03:00
old-parser
==
--
++ noun comment
2019-07-11 21:32:30 +03:00
--
++ grad %mime
--