]> gitweb.factorcode.org Git - factor.git/commitdiff
webapps.help: show vocabulary in word title.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sun, 19 Jun 2022 00:17:52 +0000 (17:17 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 19 Jun 2022 00:17:52 +0000 (17:17 -0700)
extra/webapps/help/help.factor

index d6f46f31669b255502878df5c446d273466aeb99..faac2d4fd46da7304b6d48b66006c09b535179a2 100644 (file)
@@ -9,8 +9,14 @@ IN: webapps.help
 
 TUPLE: help-webapp < dispatcher ;
 
+: fixup-words ( title href -- title' href' )
+    dup "word-" head? [
+        dup ".html" ?tail drop "," split1-last nip
+        '[ " (" _ 3append ")" append ] dip
+    ] when ;
+
 : links ( apropos -- seq )
-    [ swap <simple-link> ] { } assoc>map ;
+    [ swap fixup-words <simple-link> ] { } assoc>map ;
 
 : ?links ( has-links? apropos -- has-links? seq/f )
     links [ f ] [ nip t swap ] if-empty ;