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

72 lines
2.0 KiB
Plaintext
Raw Normal View History

::
2019-07-12 01:07:05 +03:00
:::: /hoon/info/publish/mar
::
2019-12-14 01:27:37 +03:00
/- *publish
!:
2019-12-14 01:27:37 +03:00
|_ info=notebook-info
::
::
++ grow
|%
++ mime
2019-07-12 01:07:05 +03:00
:- /text/x-publish-info
(as-octs:mimes:html (of-wain:format txt))
++ txt
^- wain
2019-12-14 01:27:37 +03:00
:~ (cat 3 'title: ' title.info)
(cat 3 'description: ' description.info)
(cat 3 'comments: ' ?:(comments.info 'on' 'off'))
(cat 3 'writers: ' (spat writers.info))
(cat 3 'subscribers: ' (spat subscribers.info))
==
--
++ 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 'owner: ~') fed:ag)
(key-val (jest 'title: ') (cook crip (star qit)))
(key-val (jest 'filename: ') sym)
%+ key-val (jest 'comments: ')
;~(pose (jest %open) (jest %closed) (jest %none))
%+ key-val (jest 'allow-edit: ')
;~(pose (jest %post) (jest %comment) (jest %all) (jest %none))
(key-val (jest 'date-created: ~') (cook year when:so))
;~ pose
(key-val (jest 'last-modified: ~') (cook year when:so))
;~(pfix (jest 'last-modified: ~') (cook year when:so))
2019-12-14 01:27:37 +03:00
==
2020-01-21 21:48:22 +03:00
==
++ new-parser
;~ plug
(key-val (jest 'title: ') (cook crip (star qit)))
(key-val (jest 'description: ') (cook crip (star qit)))
%+ key-val (jest 'comments: ')
(cook |=(a=@ =(%on a)) ;~(pose (jest %on) (jest %off)))
(key-val (jest 'writers: ') ;~(pfix net (more net urs:ab)))
;~ pose
(key-val (jest 'subscribers: ') ;~(pfix net (more net urs:ab)))
;~(pfix (jest 'subscribers: ') ;~(pfix net (more net urs:ab)))
==
==
++ both-parser
;~ pose
new-parser
%+ cook
|= [@ title=@t @ comments=@ *]
^- notebook-info
[title '' =('open' comments) / /]
old-parser
==
--
2019-12-14 01:27:37 +03:00
++ noun notebook-info
--
++ grad %mime
--