made publish marks backward compatible

This commit is contained in:
Isaac Visintainer 2020-01-21 10:48:22 -08:00
parent 366772c559
commit 9a8f1bec90
2 changed files with 72 additions and 64 deletions

View File

@ -1,5 +1,5 @@
/- publish
|_ com=comment:publish
/- *publish
|_ com=comment
::
::
++ grow
@ -19,32 +19,36 @@
|%
++ mime
|= [mite:eyre p=octs:eyre]
(txt (to-wain:format q.p))
++ txt
|= txs=(pole @t)
^- comment:publish
:: TODO: putting ~ instead of * breaks this but shouldn't
::
?> ?= $: author=@t
date-created=@t
line=@t
body=*
==
txs
?> =(line.txs '-----')
::
:* %+ rash author.txs
;~(pfix (jest 'author: ~') fed:ag)
::
%+ rash date-created.txs
;~ pfix
(jest 'date-created: ~')
(cook year when:so)
==
::
(of-wain:format (wain body.txs))
==
++ noun comment:publish
|^ (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
[author date-created content]
old-parser
==
--
++ noun comment
--
++ grad %mime
--

View File

@ -24,43 +24,47 @@
|%
++ mime
|= [mite:eyre p=octs:eyre]
(txt (to-wain:format q.p))
++ txt
|= txs=(pole @t)
^- notebook-info
:: TODO: putting ~ instead of * breaks this but shouldn't
::
?> ?= $: title=@t
description=@t
comments=@t
writers=@t
subscribers=@t
*
==
txs
::
:* %+ rash title.txs
;~(pfix (jest 'title: ') (cook crip (star next)))
::
%+ rash description.txs
;~(pfix (jest 'description: ') (cook crip (star next)))
::
%+ rash comments.txs
;~ pfix
(jest 'comments: ')
%+ cook
|= val=@t
^- ?
=(val %on)
;~(pose (jest %on) (jest %off))
|^ (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))
==
::
%+ rash writers.txs
;~(pfix (jest 'writers: ') ;~(pfix net (more net urs:ab)))
::
%+ rash subscribers.txs
;~(pfix (jest 'subscribers: ') ;~(pfix net (more net urs:ab)))
==
==
++ 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
==
--
++ noun notebook-info
--
++ grad %mime