Make vocab-usage and vocab-uses more useful
parent
9a4ac996a1
commit
b4fc1e0d5f
|
@ -188,6 +188,9 @@ M: f print-element drop ;
|
||||||
: $links ( topics -- )
|
: $links ( topics -- )
|
||||||
[ [ ($link) ] textual-list ] ($span) ;
|
[ [ ($link) ] textual-list ] ($span) ;
|
||||||
|
|
||||||
|
: $vocab-links ( vocabs -- )
|
||||||
|
[ vocab ] map $links ;
|
||||||
|
|
||||||
: $see-also ( topics -- )
|
: $see-also ( topics -- )
|
||||||
"See also" $heading $links ;
|
"See also" $heading $links ;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
USING: accessors kernel combinators vocabs vocabs.loader
|
USING: accessors kernel combinators vocabs vocabs.loader
|
||||||
tools.vocabs io io.files io.styles help.markup help.stylesheet
|
tools.vocabs io io.files io.styles help.markup help.stylesheet
|
||||||
sequences assocs help.topics namespaces prettyprint words
|
sequences assocs help.topics namespaces prettyprint words
|
||||||
sorting definitions arrays summary sets ;
|
sorting definitions arrays summary sets generic ;
|
||||||
IN: tools.vocabs.browser
|
IN: tools.vocabs.browser
|
||||||
|
|
||||||
: vocab-status-string ( vocab -- string )
|
: vocab-status-string ( vocab -- string )
|
||||||
|
@ -104,9 +104,9 @@ C: <vocab-author> vocab-author
|
||||||
] unless drop ;
|
] unless drop ;
|
||||||
|
|
||||||
: vocab-xref ( vocab quot -- vocabs )
|
: vocab-xref ( vocab quot -- vocabs )
|
||||||
>r dup vocab-name swap words r> map
|
>r dup vocab-name swap words [ generic? not ] filter r> map
|
||||||
[ [ word? ] filter [ vocabulary>> ] map ] gather natural-sort
|
[ [ word? ] filter [ vocabulary>> ] map ] gather natural-sort
|
||||||
remove sift [ vocab ] map ; inline
|
remove sift ; inline
|
||||||
|
|
||||||
: vocab-uses ( vocab -- vocabs ) [ uses ] vocab-xref ;
|
: vocab-uses ( vocab -- vocabs ) [ uses ] vocab-xref ;
|
||||||
|
|
||||||
|
@ -115,13 +115,13 @@ C: <vocab-author> vocab-author
|
||||||
: describe-uses ( vocab -- )
|
: describe-uses ( vocab -- )
|
||||||
vocab-uses dup empty? [
|
vocab-uses dup empty? [
|
||||||
"Uses" $heading
|
"Uses" $heading
|
||||||
dup $links
|
dup $vocab-links
|
||||||
] unless drop ;
|
] unless drop ;
|
||||||
|
|
||||||
: describe-usage ( vocab -- )
|
: describe-usage ( vocab -- )
|
||||||
vocab-usage dup empty? [
|
vocab-usage dup empty? [
|
||||||
"Used by" $heading
|
"Used by" $heading
|
||||||
dup $links
|
dup $vocab-links
|
||||||
] unless drop ;
|
] unless drop ;
|
||||||
|
|
||||||
: $describe-vocab ( element -- )
|
: $describe-vocab ( element -- )
|
||||||
|
|
Loading…
Reference in New Issue