2022-03-30 21:51:40 +03:00
|
|
|
:: A library for printing doccords
|
2022-06-07 19:37:32 +03:00
|
|
|
=/ debug |
|
2022-03-30 21:51:40 +03:00
|
|
|
=>
|
2022-06-09 18:35:10 +03:00
|
|
|
|% %dprint-types
|
2022-03-30 21:51:40 +03:00
|
|
|
:> an overview of all named things in the type.
|
|
|
|
:>
|
|
|
|
:> each element in the overview list is either a documentation for a sublist
|
|
|
|
:> or an association betwen a term and documentation for it
|
|
|
|
+$ overview (list overview-item)
|
|
|
|
::
|
|
|
|
:> an element of an overview
|
|
|
|
+$ overview-item
|
|
|
|
$% [%header doc=what children=overview]
|
|
|
|
[%item name=tape doc=what]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:> the part of a type being inspected
|
|
|
|
+$ item
|
|
|
|
$%
|
|
|
|
:: overview of a type
|
|
|
|
::
|
|
|
|
[%view items=overview]
|
|
|
|
:: inspecting a full core
|
|
|
|
$: %core
|
|
|
|
name=tape
|
|
|
|
docs=what
|
|
|
|
sut=type
|
|
|
|
con=coil
|
|
|
|
children=(unit item)
|
|
|
|
==
|
|
|
|
:: inspecting a single arm on a core
|
|
|
|
$: %arm
|
|
|
|
name=tape
|
2022-04-05 22:52:35 +03:00
|
|
|
adoc=what
|
|
|
|
pdoc=what
|
|
|
|
cdoc=what
|
2022-03-30 21:51:40 +03:00
|
|
|
gen=hoon
|
|
|
|
sut=type
|
|
|
|
==
|
|
|
|
:: inspecting a face and what's behind it
|
|
|
|
$: %face
|
|
|
|
name=tape
|
|
|
|
docs=what
|
|
|
|
children=(unit item)
|
|
|
|
==
|
|
|
|
:: inspecting a single chapter on a core
|
|
|
|
$: %chapter
|
|
|
|
name=tape
|
|
|
|
docs=what
|
|
|
|
sut=type
|
|
|
|
con=coil
|
2022-03-30 22:36:30 +03:00
|
|
|
chapter-id=term
|
2022-03-30 21:51:40 +03:00
|
|
|
==
|
|
|
|
==
|
|
|
|
::
|
|
|
|
--
|
2022-06-07 19:37:32 +03:00
|
|
|
|% %dprint
|
2022-04-07 19:55:30 +03:00
|
|
|
:> contains arms used for looking for docs inside of a type
|
|
|
|
:>
|
|
|
|
:> the entrypoint for finding docs within a type is +find-item-in-type.
|
2022-04-04 23:23:27 +03:00
|
|
|
+| %searching
|
2022-03-30 21:51:40 +03:00
|
|
|
:> returns the item to print while searching through topic
|
|
|
|
:>
|
2022-04-07 00:37:55 +03:00
|
|
|
:> this gate is optionally called recursively to find the path (topic) in the
|
|
|
|
:> type (sut). once it finds the correct part of the type, it switches to
|
|
|
|
:> +signify to describe that part of the type. recursion is turned off (for some
|
|
|
|
:> cases) when a hint type is found, in case it is wrapping a match.
|
2022-03-30 21:51:40 +03:00
|
|
|
++ find-item-in-type
|
2022-03-31 21:39:09 +03:00
|
|
|
:: TODO make this work with a list of topics
|
2022-04-07 00:37:55 +03:00
|
|
|
|= [topics=(list term) sut=type rec=?]
|
2022-06-09 18:18:10 +03:00
|
|
|
|^
|
2022-03-30 21:51:40 +03:00
|
|
|
^- (unit item)
|
2022-04-07 20:05:58 +03:00
|
|
|
~? > debug topics
|
2022-04-07 00:37:55 +03:00
|
|
|
?~ topics
|
|
|
|
:: we have no more search paths, return an overview of what remains
|
|
|
|
(signify sut)
|
2022-03-30 21:51:40 +03:00
|
|
|
?- sut
|
2022-03-31 21:39:09 +03:00
|
|
|
%noun ~
|
|
|
|
%void ~
|
2022-03-30 21:51:40 +03:00
|
|
|
[%atom *] ~
|
|
|
|
::
|
|
|
|
[%cell *]
|
|
|
|
=+ lhs=$(sut p.sut)
|
|
|
|
?~ lhs
|
2022-04-07 00:37:55 +03:00
|
|
|
:: not sure if this should recurse when rec=%.n
|
2022-03-30 21:51:40 +03:00
|
|
|
$(sut q.sut)
|
|
|
|
lhs
|
|
|
|
::
|
|
|
|
[%core *]
|
2022-06-09 18:04:09 +03:00
|
|
|
:: checks for a core name match, then tries to find a chapter, arm, or
|
|
|
|
:: arm in a chapter depending on how many topics remain. will still work
|
|
|
|
:: if core is unnamed
|
2022-04-04 23:23:27 +03:00
|
|
|
=+ core-name=p.p.q.sut
|
2022-04-07 00:37:55 +03:00
|
|
|
?: !=(`i.topics core-name)
|
2022-06-09 18:04:09 +03:00
|
|
|
=+ arm=(make-arm i.topics sut ~)
|
2022-04-07 00:37:55 +03:00
|
|
|
?~ arm
|
|
|
|
?:(rec $(sut p.sut) ~)
|
2022-06-09 18:04:09 +03:00
|
|
|
arm
|
2022-04-07 00:37:55 +03:00
|
|
|
?~ t.topics
|
2022-06-09 18:33:29 +03:00
|
|
|
(signify sut)
|
2022-06-09 18:04:09 +03:00
|
|
|
=/ tom=(unit tome) (~(get by q.r.q.sut) i.t.topics)
|
|
|
|
?~ tom
|
|
|
|
(make-arm i.t.topics sut ~)
|
|
|
|
?~ t.t.topics
|
|
|
|
`[%chapter (trip i.t.topics) p.u.tom sut q.sut i.t.topics]
|
|
|
|
(make-arm i.t.t.topics sut tom)
|
2022-03-30 21:51:40 +03:00
|
|
|
::
|
|
|
|
[%face *]
|
|
|
|
?. ?=(term p.sut)
|
2022-06-09 18:33:29 +03:00
|
|
|
~ :: TODO: handle tune case
|
2022-04-07 00:37:55 +03:00
|
|
|
?. =(i.topics p.sut)
|
2022-03-30 21:51:40 +03:00
|
|
|
~
|
2022-04-07 00:37:55 +03:00
|
|
|
?~ t.topics
|
2022-06-09 18:33:29 +03:00
|
|
|
(signify sut)
|
2022-04-07 00:37:55 +03:00
|
|
|
?:(rec $(topics t.topics, sut q.sut) ~)
|
2022-03-30 21:51:40 +03:00
|
|
|
::
|
|
|
|
[%fork *]
|
|
|
|
=/ types=(list type) ~(tap in p.sut)
|
|
|
|
|-
|
|
|
|
?~ types
|
|
|
|
~
|
|
|
|
=+ res=^$(sut i.types)
|
|
|
|
?~ res
|
|
|
|
$(types t.types)
|
|
|
|
res
|
|
|
|
::
|
|
|
|
[%hint *]
|
2022-03-31 21:39:09 +03:00
|
|
|
:: If we found a help hint, it is wrapping a type for which we might want to
|
|
|
|
:: produce an item, so we should peek inside of it to see what type it is
|
2022-06-09 21:40:45 +03:00
|
|
|
:: and grab the docs from the hint if so
|
2022-04-07 00:37:55 +03:00
|
|
|
::
|
|
|
|
=/ shallow-match=(unit item) $(sut q.sut, rec %.n)
|
|
|
|
?~ shallow-match
|
|
|
|
:: hint isn't wrapping a match, so step through it
|
|
|
|
$(sut q.sut, rec %.y)
|
|
|
|
`(emblazon u.shallow-match (unwrap-hint sut))
|
2022-03-30 21:51:40 +03:00
|
|
|
::
|
|
|
|
[%hold *] $(sut (~(play ut p.sut) q.sut))
|
|
|
|
::
|
|
|
|
==
|
2022-06-09 18:33:29 +03:00
|
|
|
::
|
2022-06-09 18:04:09 +03:00
|
|
|
++ make-arm
|
|
|
|
|= [name=term sut=type tom=(unit tome)]
|
|
|
|
^- (unit item)
|
|
|
|
?> ?=([%core *] sut)
|
|
|
|
=+ arm=(find-arm-in-coil name q.sut)
|
|
|
|
?~ arm
|
|
|
|
~
|
|
|
|
=+ [adoc pdoc cdoc]=(all-arm-docs u.arm sut (trip name))
|
|
|
|
?~ tom
|
|
|
|
`[%arm (trip name) adoc pdoc cdoc u.arm p.sut]
|
|
|
|
?. (~(has by q.u.tom) name)
|
|
|
|
~
|
|
|
|
`[%arm (trip name) adoc pdoc cdoc u.arm p.sut]
|
|
|
|
--
|
2022-03-30 21:51:40 +03:00
|
|
|
::
|
2022-06-09 18:33:29 +03:00
|
|
|
:> changes a type into a item without docs
|
2022-03-31 21:39:09 +03:00
|
|
|
:>
|
|
|
|
:> this does not actually assign the docs, since they usually come from a hint
|
|
|
|
:> wrapping the type.
|
|
|
|
++ signify
|
|
|
|
|= sut=type
|
|
|
|
^- (unit item)
|
2022-04-01 00:33:59 +03:00
|
|
|
?- sut
|
2022-06-09 18:33:29 +03:00
|
|
|
::
|
2022-03-31 21:39:09 +03:00
|
|
|
[%atom *] ~
|
2022-04-01 00:33:59 +03:00
|
|
|
::
|
2022-03-31 21:39:09 +03:00
|
|
|
[%cell *]
|
|
|
|
%+ join-items
|
|
|
|
$(sut p.sut)
|
|
|
|
$(sut q.sut)
|
|
|
|
::
|
|
|
|
[%core *]
|
2022-04-04 23:23:27 +03:00
|
|
|
=/ name=(unit term) p.p.q.sut :: should check if core is built with an arm and use that name?
|
2022-03-31 21:39:09 +03:00
|
|
|
=* compiled-against $(sut p.sut)
|
2022-04-04 23:23:27 +03:00
|
|
|
?~ name
|
2022-06-08 19:43:01 +03:00
|
|
|
`[%core ~ *what sut q.sut compiled-against]
|
|
|
|
`[%core (trip u.name) *what sut q.sut compiled-against]
|
2022-03-31 21:39:09 +03:00
|
|
|
::
|
2022-04-01 00:33:59 +03:00
|
|
|
[%face *]
|
2022-03-31 21:39:09 +03:00
|
|
|
?. ?=(term p.sut)
|
2022-04-01 00:33:59 +03:00
|
|
|
~ :: TODO: handle tune case
|
2022-03-31 21:39:09 +03:00
|
|
|
=* compiled-against $(sut q.sut)
|
|
|
|
`[%face (trip p.sut) *what compiled-against]
|
|
|
|
::
|
2022-04-01 00:33:59 +03:00
|
|
|
[%fork *]
|
|
|
|
=* types ~(tap in p.sut)
|
|
|
|
=* items (turn types signify)
|
|
|
|
(roll items join-items)
|
|
|
|
::
|
|
|
|
[%hint *]
|
|
|
|
=* rest-type $(sut q.sut)
|
|
|
|
:: check to see if it is a help hint
|
2022-06-09 21:40:45 +03:00
|
|
|
?. ?=(%help -.q.p.sut)
|
|
|
|
~
|
2022-04-01 00:33:59 +03:00
|
|
|
`[%view [%header `crib.p.q.p.sut (item-as-overview rest-type)]~]
|
|
|
|
::
|
|
|
|
[%hold *] $(sut (~(play ut p.sut) q.sut))
|
|
|
|
%noun ~
|
|
|
|
%void ~
|
2022-03-31 21:39:09 +03:00
|
|
|
==
|
2022-03-30 21:51:40 +03:00
|
|
|
::
|
2022-03-31 21:39:09 +03:00
|
|
|
:> checks if a hint type is a help hint and returns the docs if so
|
|
|
|
++ unwrap-hint
|
|
|
|
|= sut=type
|
|
|
|
^- what
|
|
|
|
?. ?=([%hint *] sut)
|
|
|
|
~? > debug %not-hint-type
|
|
|
|
~
|
|
|
|
?>(?=(%help -.q.p.sut) `crib.p.q.p.sut)
|
|
|
|
::
|
|
|
|
:> inserts docs into an item
|
|
|
|
:>
|
2022-04-05 22:52:35 +03:00
|
|
|
:> when matching for a core or a face type, the docs for that type will be in
|
|
|
|
:> a hint that wraps it. thus we end up producing an item for that type, then
|
|
|
|
:> need to add the docs to it.
|
2022-04-01 00:33:59 +03:00
|
|
|
++ emblazon
|
2022-03-31 21:39:09 +03:00
|
|
|
|= [=item =what]
|
2022-04-01 00:33:59 +03:00
|
|
|
~? >> debug %emblazon
|
2022-03-31 21:39:09 +03:00
|
|
|
^+ item
|
2022-04-05 22:52:35 +03:00
|
|
|
?+ item item :: no-op on %chapter, %arm, $view
|
|
|
|
?([%core *] [%face *]) item(docs what)
|
2022-03-31 21:39:09 +03:00
|
|
|
==
|
|
|
|
::
|
2022-04-01 00:33:59 +03:00
|
|
|
:> looks for an arm in a coil and returns its hoon
|
2022-03-30 21:51:40 +03:00
|
|
|
++ find-arm-in-coil
|
|
|
|
|= [arm-name=term con=coil]
|
2022-03-31 21:39:09 +03:00
|
|
|
~? >> debug %find-arm-in-coil
|
2022-03-30 21:51:40 +03:00
|
|
|
^- (unit hoon)
|
|
|
|
=/ tomes=(list [p=term q=tome]) ~(tap by q.r.con)
|
|
|
|
|-
|
|
|
|
?~ tomes
|
|
|
|
~
|
2022-04-01 00:33:59 +03:00
|
|
|
=+ gen=(~(get by q.q.i.tomes) arm-name)
|
|
|
|
?~ gen
|
2022-03-30 21:51:40 +03:00
|
|
|
$(tomes t.tomes)
|
2022-04-01 00:33:59 +03:00
|
|
|
`u.gen
|
2022-03-30 21:51:40 +03:00
|
|
|
::
|
2022-04-05 22:17:57 +03:00
|
|
|
:> gets the $help from a %help %hint type and returns it as a unit
|
|
|
|
++ help-from-hint
|
|
|
|
|= sut=type
|
|
|
|
^- (unit help)
|
|
|
|
?+ sut ~
|
|
|
|
[%hold *]
|
2022-06-09 21:40:45 +03:00
|
|
|
~? >> debug %help-from-hold
|
|
|
|
$(sut (~(play ut p.sut) q.sut))
|
2022-04-05 22:17:57 +03:00
|
|
|
::
|
|
|
|
[%hint *]
|
|
|
|
~? >> debug %help-from-hint
|
|
|
|
?. ?=(%help -.q.p.sut)
|
|
|
|
~
|
2022-04-05 22:52:35 +03:00
|
|
|
`p.q.p.sut
|
2022-04-05 22:17:57 +03:00
|
|
|
==
|
2022-03-31 21:39:09 +03:00
|
|
|
::
|
2022-04-05 19:38:02 +03:00
|
|
|
:> returns 0, 1, or 2 whats for an arm
|
2022-04-05 22:17:57 +03:00
|
|
|
:>
|
|
|
|
:> this arm should be handed the compiled type of the hoon of an arm, as well
|
|
|
|
:> as the name of that arm. it checks for up to 2 nested hints on the outermost
|
|
|
|
:> layer of the type. if you have 2, it is presumed to be arm-doc followed by
|
|
|
|
:> product-doc. if you only have one, we check links in the $help of the hint
|
|
|
|
:> to determine whether it is an arm doc or product doc.
|
|
|
|
:>
|
|
|
|
:> this returns ~ if there are no docs. if there are docs, the first one is the
|
|
|
|
:> arm-doc, and the second one is the product-doc.
|
2022-04-05 19:38:02 +03:00
|
|
|
++ arm-product-docs
|
2022-04-05 22:17:57 +03:00
|
|
|
|= [sut=type name=term]
|
2022-04-05 19:38:02 +03:00
|
|
|
^- (unit [what what])
|
|
|
|
=/ doc-one=(unit help)
|
2022-04-05 22:17:57 +03:00
|
|
|
(help-from-hint sut)
|
2022-04-05 19:38:02 +03:00
|
|
|
?~ doc-one
|
2022-04-05 22:17:57 +03:00
|
|
|
~? > debug %doc-one-empty
|
|
|
|
~ :: no need to look for a second doc if there is no first one
|
2022-06-08 22:39:40 +03:00
|
|
|
?: =(~ links.u.doc-one)
|
|
|
|
:: doc-one is a product-doc
|
|
|
|
[~ [~ `crib.u.doc-one]]
|
|
|
|
?: !=([%funk name] -.links.u.doc-one)
|
|
|
|
:: link on doc-one doesnt match arm name, so that means its calling a
|
|
|
|
:: different arm and trying to use its docs. don't let it
|
|
|
|
~
|
|
|
|
~? > debug :- %doc-one doc-one
|
2022-04-05 19:38:02 +03:00
|
|
|
=/ doc-two=(unit help)
|
2022-06-09 21:40:45 +03:00
|
|
|
?. ?=([%hint *] sut)
|
2022-06-08 22:39:40 +03:00
|
|
|
~
|
2022-06-09 21:40:45 +03:00
|
|
|
(help-from-hint q.sut)
|
2022-04-05 19:38:02 +03:00
|
|
|
?~ doc-two
|
2022-04-05 22:17:57 +03:00
|
|
|
~? > debug %doc-two-empty
|
2022-06-09 21:40:45 +03:00
|
|
|
:: if links are non-empty, check that the link is for the arm
|
|
|
|
?: =([%funk name] -.links.u.doc-one)
|
2022-04-05 22:17:57 +03:00
|
|
|
~? > debug %link-match
|
2022-04-05 22:52:35 +03:00
|
|
|
[~ [`crib.u.doc-one ~]]
|
2022-04-05 19:38:02 +03:00
|
|
|
~? > debug %link-doesnt-match-arm
|
2022-06-08 22:39:40 +03:00
|
|
|
:: this can happen if +bar calls +foo which has doccords
|
2022-04-05 22:52:35 +03:00
|
|
|
[~ [`crib.u.doc-one ~]]
|
2022-06-09 21:40:45 +03:00
|
|
|
:: doc-two is non-empty. make sure that doc-one is an arm-doc for this arm
|
|
|
|
?> =([%funk name] -.links.u.doc-one)
|
2022-04-05 22:52:35 +03:00
|
|
|
[~ [`crib.u.doc-one `crib.u.doc-two]]
|
2022-04-05 19:38:02 +03:00
|
|
|
::
|
2022-03-30 21:51:40 +03:00
|
|
|
:> grabs the docs for an arm.
|
2022-03-31 21:39:09 +03:00
|
|
|
:>
|
|
|
|
:> there are three possible places with relevant docs for an arm:
|
|
|
|
:> docs for the arm itself, docs for the product of the arm, and
|
|
|
|
:> if the arm builds a core, docs for the default arm of that core.
|
2022-04-01 00:33:59 +03:00
|
|
|
:>
|
2022-04-05 22:17:57 +03:00
|
|
|
:> arm-doc: docs written above the the arm
|
2022-04-01 00:33:59 +03:00
|
|
|
:> product-doc: docs for the product of the arm
|
2022-03-31 21:39:09 +03:00
|
|
|
:> core-doc: docs for the default arm of the core produced by the arm
|
2022-04-06 23:34:02 +03:00
|
|
|
:> this will be the first of the arm-doc or product-doc on the default
|
|
|
|
:> arm. maybe this should be recursive and/or give both but its a decision
|
|
|
|
:> ill leave for later
|
2022-04-05 22:17:57 +03:00
|
|
|
++ all-arm-docs
|
2022-04-05 19:38:02 +03:00
|
|
|
|= [gen=hoon sut=type name=tape]
|
2022-04-05 22:17:57 +03:00
|
|
|
~? > debug %all-arm-docs
|
2022-03-30 21:51:40 +03:00
|
|
|
^- [what what what]
|
2022-03-31 21:39:09 +03:00
|
|
|
=+ hoon-type=(~(play ut sut) gen)
|
2022-04-05 22:17:57 +03:00
|
|
|
=+ arm-prod=(arm-product-docs hoon-type `@tas`(crip name))
|
2022-04-07 20:05:58 +03:00
|
|
|
::~? >> debug :- %arm-prod arm-prod
|
2022-04-05 19:38:02 +03:00
|
|
|
|^
|
2022-04-05 21:44:47 +03:00
|
|
|
:: check arm-prod to determine how many layers to look into the type
|
2022-04-05 19:38:02 +03:00
|
|
|
:: for core docs
|
2022-04-05 21:44:47 +03:00
|
|
|
=/ depth=@ ?~ arm-prod 0
|
|
|
|
(add =(~ +<.arm-prod) =(~ +>.arm-prod))
|
2022-04-05 22:17:57 +03:00
|
|
|
?+ depth ``~
|
|
|
|
%0 ``(extract hoon-type)
|
2022-04-05 19:38:02 +03:00
|
|
|
%1 :+ +<.arm-prod
|
|
|
|
+>.arm-prod
|
|
|
|
?> ?=([%hint *] hoon-type)
|
2022-04-05 22:17:57 +03:00
|
|
|
(extract q.hoon-type)
|
2022-04-05 19:38:02 +03:00
|
|
|
%2 :+ +<.arm-prod
|
|
|
|
+>.arm-prod
|
|
|
|
?> ?=([%hint *] hoon-type)
|
|
|
|
?> ?=([%hint *] q.hoon-type)
|
2022-04-05 22:17:57 +03:00
|
|
|
(extract q.q.hoon-type)
|
2022-04-05 19:38:02 +03:00
|
|
|
==
|
2022-04-05 22:17:57 +03:00
|
|
|
:> grabs the first doc for the default arm of a core
|
|
|
|
:>
|
2022-04-06 23:34:02 +03:00
|
|
|
:> this could end up being an arm doc or a product doc.
|
2022-04-05 22:17:57 +03:00
|
|
|
++ extract
|
2022-04-05 19:38:02 +03:00
|
|
|
|= sut=type
|
|
|
|
^- what
|
2022-04-06 23:34:02 +03:00
|
|
|
?. ?=([%core *] sut)
|
|
|
|
~? > debug %no-nested-core ~
|
|
|
|
~? > debug %found-nested-core
|
|
|
|
=+ carm=(find-arm-in-coil %$ q.sut)
|
|
|
|
?~ carm ~? > debug %empty-carm ~
|
|
|
|
~? > debug %found-default-arm
|
2022-06-08 22:41:04 +03:00
|
|
|
=+ carm-type=(~(play ut sut) u.carm)
|
2022-06-09 21:40:45 +03:00
|
|
|
=/ hel=(unit help) (help-from-hint carm-type)
|
|
|
|
?~ hel
|
|
|
|
~
|
|
|
|
`what``crib.u.hel
|
2022-04-05 19:38:02 +03:00
|
|
|
--
|
2022-03-30 21:51:40 +03:00
|
|
|
::
|
2022-03-31 21:39:09 +03:00
|
|
|
:> returns an overview for a cores arms and chapters
|
|
|
|
:>
|
|
|
|
:> returns an overview for arms which are part of unnamed chapters, and
|
|
|
|
:> an overview of the named chapters
|
|
|
|
++ arm-and-chapter-overviews
|
|
|
|
|= [sut=type con=coil core-name=tape]
|
|
|
|
^- [overview overview]
|
|
|
|
=| arm-docs=overview
|
|
|
|
=| chapter-docs=overview
|
|
|
|
=/ tomes ~(tap by q.r.con)
|
|
|
|
|-
|
|
|
|
?~ tomes
|
|
|
|
[(sort-overview arm-docs) (sort-overview chapter-docs)]
|
|
|
|
=* current i.tomes ::[term tome]
|
|
|
|
?~ p.current
|
|
|
|
:: chapter has no name. add documentation for its arms to arm-docs
|
|
|
|
=. arm-docs (weld arm-docs (arms-as-overview q.q.current sut))
|
|
|
|
$(tomes t.tomes)
|
|
|
|
:: chapter has a name. add to list of chapters
|
|
|
|
=. chapter-docs
|
|
|
|
%+ weld chapter-docs
|
|
|
|
^- overview
|
|
|
|
[%item :(weld (trip -.current) ":" core-name) p.q.current]~
|
|
|
|
$(tomes t.tomes)
|
|
|
|
::
|
2022-03-30 22:36:30 +03:00
|
|
|
:> returns an overview of the arms in a specific chapter
|
|
|
|
++ arms-in-chapter
|
|
|
|
|= [sut=type con=coil chapter-id=term]
|
|
|
|
^- overview
|
|
|
|
=/ chapter-tome (~(got by q.r.con) chapter-id)
|
|
|
|
(sort-overview (arms-as-overview q.chapter-tome sut))
|
|
|
|
::
|
|
|
|
:> sort items in an overview in alphabetical order
|
|
|
|
++ sort-overview
|
|
|
|
|= ovr=overview
|
|
|
|
^- overview
|
|
|
|
%+ sort ovr
|
2022-03-31 21:39:09 +03:00
|
|
|
|= [lhs=overview-item rhs=overview-item]
|
|
|
|
(aor (get-overview-name lhs) (get-overview-name rhs))
|
2022-03-30 22:36:30 +03:00
|
|
|
::
|
|
|
|
:> returns the name of an overview
|
|
|
|
++ get-overview-name
|
|
|
|
|= ovr=overview-item
|
|
|
|
?- ovr
|
|
|
|
[%header *] ""
|
|
|
|
[%item *] name.ovr
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:> translate a tome into an overview
|
|
|
|
++ arms-as-overview
|
|
|
|
|= [a=(map term hoon) sut=type]
|
|
|
|
^- overview
|
2022-03-31 21:39:09 +03:00
|
|
|
%+ turn ~(tap by a)
|
|
|
|
|= ar=(pair term hoon)
|
2022-04-05 22:17:57 +03:00
|
|
|
=+ [adoc pdoc cdoc]=(all-arm-docs q.ar sut (trip p.ar))
|
2022-04-05 19:38:02 +03:00
|
|
|
[%item (weld "++" (trip p.ar)) adoc]
|
2022-03-30 22:36:30 +03:00
|
|
|
::
|
2022-03-31 21:39:09 +03:00
|
|
|
:> changes an item into an overview
|
|
|
|
++ item-as-overview
|
|
|
|
|= uit=(unit item)
|
|
|
|
^- overview
|
|
|
|
?~ uit ~
|
|
|
|
=+ itm=(need uit)
|
|
|
|
?- itm
|
|
|
|
::
|
|
|
|
[%view *] items.itm
|
|
|
|
::
|
|
|
|
[%core *]
|
|
|
|
?~ name.itm
|
|
|
|
(item-as-overview children.itm)
|
|
|
|
:- [%item name.itm docs.itm]
|
|
|
|
(item-as-overview children.itm)
|
|
|
|
::
|
|
|
|
[%arm *]
|
2022-04-05 22:52:35 +03:00
|
|
|
[%item name.itm adoc.itm]~
|
2022-03-31 21:39:09 +03:00
|
|
|
::
|
|
|
|
[%chapter *]
|
|
|
|
[%item name.itm docs.itm]~
|
|
|
|
::
|
|
|
|
[%face *]
|
|
|
|
?~ name.itm
|
|
|
|
~
|
|
|
|
[%item name.itm docs.itm]~
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:> combines two (unit items) together
|
|
|
|
++ join-items
|
|
|
|
|= [lhs=(unit item) rhs=(unit item)]
|
|
|
|
^- (unit item)
|
|
|
|
?~ lhs rhs
|
|
|
|
?~ rhs lhs
|
|
|
|
`[%view (weld (item-as-overview lhs) (item-as-overview rhs))]
|
2022-04-05 22:17:57 +03:00
|
|
|
::
|
2022-04-04 23:23:27 +03:00
|
|
|
+| %printing
|
2022-03-30 22:36:30 +03:00
|
|
|
:> prints a doccords item
|
|
|
|
++ print-item
|
|
|
|
|= =item
|
2022-04-07 20:05:58 +03:00
|
|
|
~? >> debug %print-item
|
2022-03-30 22:36:30 +03:00
|
|
|
^- tang
|
|
|
|
?- item
|
|
|
|
[%view *] (print-overview items.item)
|
|
|
|
[%core *] (print-core +.item)
|
|
|
|
[%arm *] (print-arm +.item)
|
|
|
|
[%chapter *] (print-chapter +.item)
|
|
|
|
[%face *] (print-face +.item)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:> renders documentation for a full core
|
|
|
|
++ print-core
|
|
|
|
|= [name=tape docs=what sut=type con=coil uit=(unit item)]
|
|
|
|
^- tang
|
2022-04-01 00:35:50 +03:00
|
|
|
=+ [arms chapters]=(arm-and-chapter-overviews sut con name)
|
|
|
|
;: weld
|
2022-04-05 22:52:35 +03:00
|
|
|
(print-header name docs)
|
2022-04-01 00:35:50 +03:00
|
|
|
::
|
|
|
|
?~ arms
|
|
|
|
~
|
|
|
|
(print-overview [%header `['arms:' ~] arms]~)
|
|
|
|
::
|
|
|
|
?~ chapters
|
|
|
|
~
|
|
|
|
(print-overview [%header `['chapters:' ~] chapters]~)
|
|
|
|
::
|
|
|
|
=+ compiled=(item-as-overview uit)
|
|
|
|
?~ compiled
|
|
|
|
~
|
|
|
|
(print-overview [%header `['compiled against: ' ~] compiled]~)
|
|
|
|
==
|
2022-03-30 22:36:30 +03:00
|
|
|
::
|
|
|
|
++ print-chapter
|
|
|
|
|= [name=tape doc=what sut=type con=coil chapter-id=term]
|
|
|
|
^- tang
|
2022-04-07 19:55:30 +03:00
|
|
|
~? > debug %print-chapter
|
2022-03-30 22:36:30 +03:00
|
|
|
;: weld
|
|
|
|
(print-header name doc)
|
|
|
|
::
|
2022-04-07 19:55:30 +03:00
|
|
|
::?~ doc
|
|
|
|
:: ~
|
|
|
|
::(print-sections q.u.doc)
|
2022-03-30 22:36:30 +03:00
|
|
|
::
|
|
|
|
=+ arms=(arms-in-chapter sut con chapter-id)
|
|
|
|
?~ arms
|
|
|
|
~
|
|
|
|
(print-overview [%header `['arms:' ~] arms]~)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:> renders documentation for a single arm in a core
|
|
|
|
++ print-arm
|
2022-04-05 22:52:35 +03:00
|
|
|
|= [name=tape adoc=what pdoc=what cdoc=what gen=hoon sut=type]
|
2022-03-30 22:36:30 +03:00
|
|
|
^- tang
|
2022-03-31 21:39:09 +03:00
|
|
|
~? >> debug %print-arm
|
2022-04-01 00:59:45 +03:00
|
|
|
;: weld
|
2022-04-05 22:17:57 +03:00
|
|
|
(print-header name adoc)
|
2022-04-01 00:59:45 +03:00
|
|
|
`tang`[[%leaf ""] [%leaf "product:"] ~]
|
2022-04-05 22:17:57 +03:00
|
|
|
(print-header "" pdoc)
|
2022-04-01 00:59:45 +03:00
|
|
|
`tang`[[%leaf ""] [%leaf "default arm in core:"] ~]
|
2022-04-05 22:17:57 +03:00
|
|
|
(print-header "" cdoc)
|
2022-04-01 00:59:45 +03:00
|
|
|
==
|
2022-03-30 22:36:30 +03:00
|
|
|
::
|
2022-03-31 21:39:09 +03:00
|
|
|
:> renders documentation for a face
|
2022-03-30 22:36:30 +03:00
|
|
|
++ print-face
|
|
|
|
|= [name=tape doc=what children=(unit item)]
|
|
|
|
^- tang
|
2022-04-07 20:05:58 +03:00
|
|
|
~? >> debug %print-face
|
2022-03-30 22:36:30 +03:00
|
|
|
%+ weld
|
|
|
|
(print-header name doc)
|
|
|
|
?~ children
|
|
|
|
~
|
|
|
|
(print-item u.children)
|
|
|
|
::
|
2022-04-01 01:45:28 +03:00
|
|
|
:> prints name and docs only
|
2022-03-30 22:36:30 +03:00
|
|
|
++ print-header
|
|
|
|
|= [name=tape doc=what]
|
|
|
|
^- tang
|
2022-04-07 20:05:58 +03:00
|
|
|
~? >> debug %print-header
|
2022-03-30 22:36:30 +03:00
|
|
|
?~ name
|
|
|
|
?~ doc
|
|
|
|
[%leaf "(undocumented)"]~
|
|
|
|
%+ weld
|
|
|
|
`tang`[%leaf "{(trip p.u.doc)}"]~
|
|
|
|
(print-sections q.u.doc)
|
|
|
|
?~ doc
|
|
|
|
[%leaf name]~
|
|
|
|
%+ weld
|
|
|
|
`tang`[%leaf "{name}: {(trip p.u.doc)}"]~
|
|
|
|
(print-sections q.u.doc)
|
|
|
|
::
|
|
|
|
++ print-overview
|
2022-04-01 01:45:28 +03:00
|
|
|
|= =overview
|
2022-03-30 22:36:30 +03:00
|
|
|
^- tang
|
2022-04-07 20:05:58 +03:00
|
|
|
~? >> debug %print-overview
|
2022-04-01 01:45:28 +03:00
|
|
|
=| out=tang
|
|
|
|
|-
|
|
|
|
?~ overview out
|
|
|
|
=/ oitem i.overview
|
|
|
|
?- oitem
|
|
|
|
[%header *]
|
|
|
|
%= $
|
|
|
|
overview t.overview
|
|
|
|
out ;: weld
|
|
|
|
out
|
|
|
|
?~ doc.oitem ~
|
|
|
|
`tang`[[%leaf ""] [%leaf "{(trip p.u.doc.oitem)}"] ~]
|
2022-04-07 19:55:30 +03:00
|
|
|
::?~ doc.oitem ~
|
|
|
|
::(print-sections q.u.doc.oitem)
|
2022-04-01 01:45:28 +03:00
|
|
|
^$(overview children.oitem)
|
|
|
|
==
|
|
|
|
==
|
|
|
|
::
|
|
|
|
[%item *]
|
|
|
|
%= $
|
|
|
|
overview t.overview
|
|
|
|
out ;: weld
|
|
|
|
out
|
|
|
|
`tang`[[%leaf ""] [%leaf name.oitem] ~]
|
|
|
|
?~ doc.oitem ~
|
|
|
|
`tang`[[%leaf ""] [%leaf "{(trip p.u.doc.oitem)}"] ~]
|
2022-04-07 19:55:30 +03:00
|
|
|
::?~ doc.oitem ~
|
|
|
|
::(print-sections q.u.doc.oitem)
|
2022-04-01 01:45:28 +03:00
|
|
|
==
|
|
|
|
==
|
|
|
|
==
|
2022-03-30 21:51:40 +03:00
|
|
|
::
|
|
|
|
:> renders a list of sections as tang
|
|
|
|
:>
|
|
|
|
:> prints the longform documentation
|
|
|
|
++ print-sections
|
|
|
|
|= sections=(list sect)
|
|
|
|
^- tang
|
|
|
|
=| out=tang
|
|
|
|
|-
|
|
|
|
?~ sections out
|
|
|
|
=. out
|
|
|
|
;: weld
|
|
|
|
out
|
|
|
|
`tang`[%leaf ""]~
|
|
|
|
(print-section i.sections)
|
|
|
|
==
|
|
|
|
$(sections t.sections)
|
|
|
|
::
|
|
|
|
:> renders a sect as a tang
|
|
|
|
++ print-section
|
|
|
|
|= section=sect
|
|
|
|
^- tang
|
|
|
|
%+ turn section
|
|
|
|
|= =pica
|
|
|
|
^- tank
|
|
|
|
?: p.pica
|
|
|
|
[%leaf (trip q.pica)]
|
|
|
|
[%leaf " {(trip q.pica)}"]
|
|
|
|
--
|