mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-25 07:52:59 +03:00
b3901ab42f
git-subtree-dir: pkg/arvo git-subtree-mainline:9c8f40bf6c
git-subtree-split:c20e2a185f
36 lines
867 B
Plaintext
36 lines
867 B
Plaintext
::
|
|
:::: /hoon/frontmatter/lib
|
|
::
|
|
/? 310
|
|
::
|
|
=, format
|
|
|%
|
|
++ atr-lines
|
|
|= atr/(map cord cord)
|
|
%+ turn (sort ~(tap by atr) |=({{a/@ @} {b/@ @}} (aor a b)))
|
|
|= {k/cord v/cord}
|
|
(rap 3 k ': ' v ~)
|
|
::
|
|
++ atr-key ;~(sfix (star ;~(less col prn)) col ace)
|
|
++ print
|
|
|= {atr/(map cord cord) src/wain}
|
|
?~ atr src
|
|
['---' (welp (atr-lines atr) '---' src)]
|
|
++ parse
|
|
=| atr/(map cord cord)
|
|
|= wan/wain ^+ [atr mud='']
|
|
?~ wan [~ '']
|
|
?^ (rush i.wan (star ace))
|
|
$(wan t.wan)
|
|
?. =('---' i.wan) [~ (of-wain wan)]
|
|
|- ^+ [atr mud='']
|
|
?~ t.wan ~|(%unclosed-metadata !!)
|
|
?: =('---' i.t.wan) [atr (of-wain t.t.wan)]
|
|
?^ (rush i.t.wan (star ace))
|
|
$(wan t.wan)
|
|
=- $(wan t.wan, atr (~(put by atr) (crip key) (crip val)))
|
|
~| malformed-attribute+i.t.wan
|
|
^- {key/tape ^ val/tape}
|
|
+>:(atr-key 1^1 (trip i.t.wan))
|
|
--
|