shrub/ren/collections/item.hoon

57 lines
1.2 KiB
Plaintext
Raw Normal View History

::
:::: /ren/collections/item/hoon
::
/? 309
2018-07-31 07:00:49 +03:00
/+ collections
::
2019-01-18 08:37:34 +03:00
:: item:
::
2019-01-18 08:37:34 +03:00
:: render a collection-item at this path
:: outputs a +item defined in /lib/collections/hoon
::
:: recursive renderer, see its counterpart in /ren/collections/hoon
::
2018-07-31 07:00:49 +03:00
/= item
/^ item:collections
::
:: run a gate which checks if the output of the renderers below are null or not,
:: crash in the case that both are null
:: tag them with %collection, %raw, or %both for the 3 remaining permissible cases,
::
2018-07-31 07:00:49 +03:00
/; |= $: raw=?(~ raw-item:collections)
col=?(~ collection:collections)
~
==
?~ raw
?~ col
2018-11-07 09:55:34 +03:00
[%error ~]
2018-07-31 07:00:49 +03:00
[%collection col]
?~ col
[%raw raw]
[%both col raw]
::
:: run a pair of renderers
::
2018-11-07 21:47:29 +03:00
:: 1. get a .udon file together with its frontmatter, or else return ~
::
:: 2. run the collections renderer, if it fails return ~
:: (it fails if .collections-config file does not exist at this path)
::
2018-07-31 07:00:49 +03:00
/.
::
/| /; |= [a=(map knot cord) b=@t ~]
2018-11-07 21:47:29 +03:00
[%udon a b]
/. /front/
2018-11-07 21:47:29 +03:00
/udon/
==
/~ ~
==
2018-07-31 07:00:49 +03:00
::
/| /collections/
/~ ~
==
2018-07-31 07:00:49 +03:00
::
==
::
item