diff --git a/basis/help/apropos/apropos.factor b/basis/help/apropos/apropos.factor index e77e7bccad..1fdbef3cb1 100644 --- a/basis/help/apropos/apropos.factor +++ b/basis/help/apropos/apropos.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2008, 2009 Slava Pestov. +! Copyright (C) 2008, 2010 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays assocs fry help.markup help.topics io kernel make math math.parser namespaces sequences sorting @@ -19,6 +19,8 @@ TUPLE: more-completions seq ; CONSTANT: max-completions 5 +M: more-completions valid-article? drop t ; + M: more-completions article-title seq>> length number>string " results" append ; @@ -60,6 +62,8 @@ TUPLE: apropos search ; C: apropos +M: apropos valid-article? drop t ; + M: apropos article-title search>> "Search results for “" "”" surround ; diff --git a/basis/help/help.factor b/basis/help/help.factor index 6fb87d7a33..27ce7a1435 100644 --- a/basis/help/help.factor +++ b/basis/help/help.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2005, 2009 Slava Pestov. +! Copyright (C) 2005, 2010 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays io io.styles kernel namespaces make parser prettyprint sequences words words.symbol assocs @@ -48,6 +48,8 @@ M: predicate word-help* drop \ $predicate ; : all-errors ( -- seq ) all-words [ error? ] filter sort-articles ; +M: word valid-article? drop t ; + M: word article-name name>> ; M: word article-title diff --git a/basis/help/home/home.factor b/basis/help/home/home.factor index 9cb3c6f1bb..6ab8b0933d 100644 --- a/basis/help/home/home.factor +++ b/basis/help/home/home.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2009 Slava Pestov. +! Copyright (C) 2009, 2010 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: arrays compiler.units fry hashtables help.topics io kernel math namespaces sequences sets help.vocabs @@ -21,7 +21,8 @@ M: apropos add-recent-where recent-searches ; M: object add-recent-where f ; : $recent ( element -- ) - first get reverse [ nl ] [ 1array $pretty-link ] interleave ; + first get [ valid-article? ] filter + [ nl ] [ 1array $pretty-link ] interleave ; : $recent-searches ( element -- ) drop recent-searches get [ <$link> ] map $list ; diff --git a/basis/help/topics/topics.factor b/basis/help/topics/topics.factor index a251849e8f..ea39818485 100644 --- a/basis/help/topics/topics.factor +++ b/basis/help/topics/topics.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2005, 2008 Slava Pestov. +! Copyright (C) 2005, 2010 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license.x USING: accessors arrays definitions generic assocs io kernel namespaces make prettyprint prettyprint.sections @@ -38,6 +38,7 @@ SYMBOL: article-xref article-xref [ H{ } clone ] initialize +GENERIC: valid-article? ( topic -- ? ) GENERIC: article-name ( topic -- string ) GENERIC: article-title ( topic -- string ) GENERIC: article-content ( topic -- content ) @@ -49,6 +50,7 @@ TUPLE: article title content loc ; :
( title content -- article ) f \ article boa ; +M: article valid-article? drop t ; M: article article-name title>> ; M: article article-title title>> ; M: article article-content content>> ; @@ -61,12 +63,14 @@ M: no-article summary : article ( name -- article ) articles get ?at [ no-article ] unless ; +M: object valid-article? articles get key? ; M: object article-name article article-name ; M: object article-title article article-title ; M: object article-content article article-content ; M: object article-parent article-xref get at ; M: object set-article-parent article-xref get set-at ; +M: link valid-article? name>> valid-article? ; M: link article-name name>> article-name ; M: link article-title name>> article-title ; M: link article-content name>> article-content ; @@ -74,6 +78,7 @@ M: link article-parent name>> article-parent ; M: link set-article-parent name>> set-article-parent ; ! Special case: f help +M: f valid-article? drop t ; M: f article-name drop \ f article-name ; M: f article-title drop \ f article-title ; M: f article-content drop \ f article-content ; diff --git a/basis/help/vocabs/vocabs.factor b/basis/help/vocabs/vocabs.factor index 0aa17ef676..d92ca5d91e 100644 --- a/basis/help/vocabs/vocabs.factor +++ b/basis/help/vocabs/vocabs.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2007, 2009 Slava Pestov. +! Copyright (C) 2007, 2010 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays assocs classes classes.builtin classes.intersection classes.mixin classes.predicate @@ -278,6 +278,8 @@ INSTANCE: vocab topic INSTANCE: vocab-link topic +M: vocab-spec valid-article? drop t ; + M: vocab-spec article-title vocab-name " vocabulary" append ; M: vocab-spec article-name vocab-name ; @@ -289,6 +291,8 @@ M: vocab-spec article-parent drop "vocab-index" ; M: vocab-tag >link ; +M: vocab-tag valid-article? drop t ; + M: vocab-tag article-title name>> "Vocabularies tagged “" "”" surround ; @@ -303,6 +307,8 @@ M: vocab-tag summary article-title ; M: vocab-author >link ; +M: vocab-author valid-article? drop t ; + M: vocab-author article-title name>> "Vocabularies by " prepend ;