doccords: dprint all docs in %arm items from type

before this, it was grabbing the initial arm-doc from the AST rather
than the type. now %arm items have all 3 types of docs available. the
interface has been degraded somewhat though, as %arm items no longer
have a single docs field. more refactoring will be needed to figure out
the best way to do this.
This commit is contained in:
drbeefsupreme 2022-04-05 15:52:35 -04:00
parent 37a787970c
commit 3afc9b6899
No known key found for this signature in database
GPG Key ID: B70D5683DE7F9EFC

View File

@ -31,7 +31,9 @@
:: inspecting a single arm on a core :: inspecting a single arm on a core
$: %arm $: %arm
name=tape name=tape
docs=what adoc=what
pdoc=what
cdoc=what
gen=hoon gen=hoon
sut=type sut=type
== ==
@ -97,8 +99,8 @@
?~ arm ?~ arm
:: the current topic is not an arm in the core, recurse into sut :: the current topic is not an arm in the core, recurse into sut
$(sut p.sut) $(sut p.sut)
=+ wat=(unwrap-note u.arm) =+ [adoc pdoc cdoc]=(all-arm-docs u.arm p.sut (trip topic))
`[%arm (trip topic) wat u.arm p.sut] `[%arm (trip topic) adoc pdoc cdoc u.arm p.sut]
:: ::
[%face *] [%face *]
?. ?=(term p.sut) ?. ?=(term p.sut)
@ -129,12 +131,15 @@
:: TODO: should i be trying to match both types in the hint? :: TODO: should i be trying to match both types in the hint?
:: TODO: actually hints can be nested, if e.g. an arm has a product with a hint, whose :: TODO: actually hints can be nested, if e.g. an arm has a product with a hint, whose
:: product also has a hint. so this won't actually work for nested hints as written :: product also has a hint. so this won't actually work for nested hints as written
::
:: this should only be doing something for cores right now. you run into an
:: arm's name before you run into its docs
?: (shallow-match topic q.sut) ?: (shallow-match topic q.sut)
=/ wat=what (unwrap-hint sut) =/ wat=what (unwrap-hint sut)
=/ itm=(unit item) (signify q.sut) =/ uitm=(unit item) (signify q.sut)
?~ itm ?~ uitm
~ ~
`(emblazon u.itm wat) `(emblazon u.uitm wat)
$(sut q.sut) $(sut q.sut)
:: ::
[%hold *] $(sut (~(play ut p.sut) q.sut)) [%hold *] $(sut (~(play ut p.sut) q.sut))
@ -224,22 +229,15 @@
:: ::
:> inserts docs into an item :> inserts docs into an item
:> :>
:> most docs are going to be found in hint types wrapping another type. when :> when matching for a core or a face type, the docs for that type will be in
:> we come across a hint, we grab the docs from the hint and then build the :> a hint that wraps it. thus we end up producing an item for that type, then
:> item for the type it wrapped. since building an item is handled separately, :> need to add the docs to it.
:> this item will initially have no docs in it, so we add it in after with this
:>
:> the exceptions to this are %chapter and %view items. chapters have an axis
:> for docs in their $tome structure, and %views are summaries of several types
++ emblazon ++ emblazon
|= [=item =what] |= [=item =what]
~? >> debug %emblazon ~? >> debug %emblazon
^+ item ^+ item
?+ item item :: no-op on %chapter and %view ?+ item item :: no-op on %chapter, %arm, $view
?([%core *] [%arm *] [%face *]) ?~ docs.item ?([%core *] [%face *]) item(docs what)
item(docs what)
~? > debug %docs-in-item
item(docs what)
== ==
:: ::
:> looks for an arm in a coil and returns its hoon :> looks for an arm in a coil and returns its hoon
@ -282,7 +280,7 @@
~? >> debug %help-from-hint ~? >> debug %help-from-hint
?. ?=(%help -.q.p.sut) ?. ?=(%help -.q.p.sut)
~ ~
(some p.q.p.sut) `p.q.p.sut
== ==
:: ::
:> returns 0, 1, or 2 whats for an arm :> returns 0, 1, or 2 whats for an arm
@ -313,19 +311,19 @@
~? > debug %doc-two-empty ~? > debug %doc-two-empty
?~ links.u.doc-one ?~ links.u.doc-one
:: if links are empty, doc-one is a product-doc :: if links are empty, doc-one is a product-doc
[~ [~ (some crib.u.doc-one)]] [~ [~ `crib.u.doc-one]]
?: =([%funk name] i.links.u.doc-one) ?: =([%funk name] i.links.u.doc-one)
:: if links are non-empty, check that the link is for the arm :: if links are non-empty, check that the link is for the arm
~? > debug %link-match ~? > debug %link-match
[~ [(some crib.u.doc-one) ~]] [~ [`crib.u.doc-one ~]]
~? > debug %link-doesnt-match-arm ~? > debug %link-doesnt-match-arm
:: this shouldn't happen at this point in time :: this shouldn't happen at this point in time
[~ [(some crib.u.doc-one) ~]] [~ [`crib.u.doc-one ~]]
:: doc-two is non-empty. make sure that doc-one is an arm-doc :: doc-two is non-empty. make sure that doc-one is an arm-doc
?~ links.u.doc-one ?~ links.u.doc-one
~? > debug %doc-one-empty-link ~? > debug %doc-one-empty-link
[~ [(some crib.u.doc-one) (some crib.u.doc-two)]] [~ [`crib.u.doc-one `crib.u.doc-two]]
[~ [(some crib.u.doc-one) (some crib.u.doc-two)]] [~ [`crib.u.doc-one `crib.u.doc-two]]
:: ::
:> grabs the docs for an arm. :> grabs the docs for an arm.
:> :>
@ -446,7 +444,7 @@
(item-as-overview children.itm) (item-as-overview children.itm)
:: ::
[%arm *] [%arm *]
[%item name.itm docs.itm]~ [%item name.itm adoc.itm]~
:: ::
[%chapter *] [%chapter *]
[%item name.itm docs.itm]~ [%item name.itm docs.itm]~
@ -484,8 +482,7 @@
^- tang ^- tang
=+ [arms chapters]=(arm-and-chapter-overviews sut con name) =+ [arms chapters]=(arm-and-chapter-overviews sut con name)
;: weld ;: weld
:: cores don't have names (print-header name docs)
(print-header *tape *what)
:: ::
?~ arms ?~ arms
~ ~
@ -519,10 +516,9 @@
:: ::
:> renders documentation for a single arm in a core :> renders documentation for a single arm in a core
++ print-arm ++ print-arm
|= [name=tape docs=what gen=hoon sut=type] |= [name=tape adoc=what pdoc=what cdoc=what gen=hoon sut=type]
^- tang ^- tang
~? >> debug %print-arm ~? >> debug %print-arm
=+ [adoc pdoc cdoc]=(all-arm-docs gen sut name)
;: weld ;: weld
(print-header name adoc) (print-header name adoc)
`tang`[[%leaf ""] [%leaf "product:"] ~] `tang`[[%leaf ""] [%leaf "product:"] ~]