From 3499afccc5b3ee1bd329c1d70670e4740a48a2b0 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Wed, 13 Dec 2017 17:11:13 -0800 Subject: [PATCH] more readable text format --- app/collections.hoon | 2 +- mar/collections/comment.hoon | 24 ++++++++++++++---------- mar/collections/config.hoon | 28 +++++++++++++++------------- mar/collections/topic.hoon | 33 ++++++++++++++++++--------------- 4 files changed, 48 insertions(+), 39 deletions(-) diff --git a/app/collections.hoon b/app/collections.hoon index cadd4d6981..2cb2630172 100644 --- a/app/collections.hoon +++ b/app/collections.hoon @@ -116,7 +116,7 @@ ::[~ ..prep(+<+ u.old)] :: ++ poke-noun - |= a/@ + |= @ ^- (quip move _+>) ~& %poked ta-done:(ta-write-config:ta now.bol ['a description' pub=& vis=& [~palzod ~ ~]]) diff --git a/mar/collections/comment.hoon b/mar/collections/comment.hoon index fe3f8b9a8a..9dce6b7706 100644 --- a/mar/collections/comment.hoon +++ b/mar/collections/comment.hoon @@ -15,10 +15,8 @@ (of-wain:format txt) ++ txt ^- (list @t) - :^ (scot %p who.com) - (scot %da wen.com) - (scot %da wed.com) - wat + :- (crip <[by=who.com on=wen.com ed=wed.com]>) + wat.com -- :: ++ grab @@ -27,12 +25,18 @@ |= {p/mite:eyre q/octs:eyre} (txt (to-wain:format q.q)) ++ txt - |= txs/(list @t) - ?> (gte (lent txs) 3) - :^ (slav %p (snag 0 txs)) - (slav %da (snag 1 txs)) - (slav %da (snag 2 txs)) - (slag 3 txs) + |= txs/(pole @t) ^+ com + ?> ?=([inf=@t wat=*] txs) + =/ inf :: REVIEW this seems not v stable + %- %- hard + $: %cltr + [%ktts %by [%sand %p who=@p]] + [%ktts %on [%sand %da wen=@da]] + [%ktts %ed [%sand %da wed=@da]] + ~ + == + (ream inf.txs) + [who.inf wen.inf wed.inf wat.txs] -- ++ grad %txt -- diff --git a/mar/collections/config.hoon b/mar/collections/config.hoon index 2ac0e81f92..87d0e7b53b 100644 --- a/mar/collections/config.hoon +++ b/mar/collections/config.hoon @@ -15,11 +15,13 @@ (of-wain:format txt) ++ txt ^- (list @t) - :^ desc.con - ?:(publ.con 'public' 'private') - ?:(visi.con 'visible' 'hidden') - %+ turn ~(tap in mems.con) - (cury scot %p) + :^ (cat 3 '> ' desc.con) + (cat 3 'public: ' ?:(publ.con 'y' 'n')) + (cat 3 'visible: ' ?:(visi.con 'y' 'n')) + :- 'except:' + %+ turn (sort ~(tap in mems.con) aor) + |= a=@p + (cat 3 ' ' (scot %p a)) -- :: ++ grab @@ -28,14 +30,14 @@ |= {p/mite:eyre q/octs:eyre} (txt (to-wain:format q.q)) ++ txt - |= txs/(list @t) - ?> (gte (lent txs) 3) - :^ (snag 0 txs) - =((snag 1 txs) 'public') - =((snag 2 txs) 'visible') - %- ~(gas in *(set ship)) - %+ murn (slag 3 txs) - (cury slaw %p) + |= txs/(pole @t) + ?> ?=([des=@t pub=@t vis=@t %'except:' mem=*] txs) + :^ (rash des.txs ;~(pfix (jest '> ') (cook crip (star next)))) + (rash pub.txs ;~(pfix (jest 'public: ') (flag %y %n))) + (rash vis.txs ;~(pfix (jest 'visible: ') (flag %y %n))) + %- sy + %+ turn mem.txs + (curr rash ;~(pfix (jest ' ~') fed:ag)) -- ++ grad %txt -- diff --git a/mar/collections/topic.hoon b/mar/collections/topic.hoon index abffda9d87..ee51155c8d 100644 --- a/mar/collections/topic.hoon +++ b/mar/collections/topic.hoon @@ -1,4 +1,4 @@ -:: /mar/collections/comment/hoon +:: /mar/collections/topic/hoon :: |_ $= top $: tit/cord :: title @@ -16,12 +16,9 @@ (of-wain:format txt) ++ txt ^- (list @t) - :* tit.top - (scot %p who.top) - (scot %da wen.top) - (scot %da wed.top) - wat - == + :+ (cat 3 '> ' tit.top) + (crip <[by=who.top on=wen.top ed=wed.top]>) + wat.top -- :: ++ grab @@ -30,14 +27,20 @@ |= {p/mite:eyre q/octs:eyre} (txt (to-wain:format q.q)) ++ txt - |= txs/(list @t) - ?> (gte (lent txs) 4) - :* (snag 0 txs) - (slav %p (snag 1 txs)) - (slav %da (snag 2 txs)) - (slav %da (snag 3 txs)) - (slag 4 txs) - == + |= txs/(pole @t) ^+ top + ?> ?=([des=@t inf=@t wat=*] txs) + =/ tit (rash des.txs ;~(pfix (jest '> ') (cook crip (star next)))) + :: + =/ inf :: REVIEW this seems not v stable + %- %- hard + $: %cltr + [%ktts %by [%sand %p who=@p]] + [%ktts %on [%sand %da wen=@da]] + [%ktts %ed [%sand %da wed=@da]] + ~ + == + (ream inf.txs) + [tit who.inf wen.inf wed.inf wat.txs] -- ++ grad %txt --