help.html: make docs use same completions algorithm as listener.
parent
b12ca5e412
commit
179c60b0a5
|
@ -1,11 +1,11 @@
|
||||||
! Copyright (C) 2008, 2011 Slava Pestov.
|
! Copyright (C) 2008, 2011 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors arrays assocs debugger fry hashtables help
|
USING: accessors arrays assocs debugger fry help help.home
|
||||||
help.home help.topics help.vocabs html html.streams
|
help.topics help.vocabs html html.streams io.directories
|
||||||
io.directories io.encodings.binary io.encodings.utf8 io.files
|
io.encodings.binary io.encodings.utf8 io.files io.files.temp
|
||||||
io.files.temp io.pathnames kernel make math.parser memoize
|
io.pathnames kernel make math.parser memoize namespaces
|
||||||
namespaces sequences serialize sorting splitting unicode.case
|
sequences serialize splitting tools.completion vocabs
|
||||||
vocabs vocabs.hierarchy words xml.syntax xml.writer ;
|
vocabs.hierarchy words xml.syntax xml.writer ;
|
||||||
FROM: io.encodings.ascii => ascii ;
|
FROM: io.encodings.ascii => ascii ;
|
||||||
FROM: ascii => ascii? ;
|
FROM: ascii => ascii? ;
|
||||||
IN: help.html
|
IN: help.html
|
||||||
|
@ -98,7 +98,7 @@ M: pathname url-of
|
||||||
dup topic>filename utf8 [ help>html write-xml ] with-file-writer ;
|
dup topic>filename utf8 [ help>html write-xml ] with-file-writer ;
|
||||||
|
|
||||||
: all-vocabs-really ( -- seq )
|
: all-vocabs-really ( -- seq )
|
||||||
all-vocabs-recursive >hashtable no-roots remove-redundant-prefixes
|
all-vocabs-recursive no-roots remove-redundant-prefixes
|
||||||
[ vocab-name "scratchpad" = not ] filter ;
|
[ vocab-name "scratchpad" = not ] filter ;
|
||||||
|
|
||||||
: all-topics ( -- topics )
|
: all-topics ( -- topics )
|
||||||
|
@ -143,17 +143,8 @@ M: pathname url-of
|
||||||
MEMO: load-index ( name -- index )
|
MEMO: load-index ( name -- index )
|
||||||
binary file-contents bytes>object ;
|
binary file-contents bytes>object ;
|
||||||
|
|
||||||
TUPLE: result title href ;
|
|
||||||
|
|
||||||
: partition-exact ( string results -- results' )
|
|
||||||
[ title>> = ] with partition append ;
|
|
||||||
|
|
||||||
: offline-apropos ( string index -- results )
|
: offline-apropos ( string index -- results )
|
||||||
load-index over >lower
|
load-index completions ;
|
||||||
'[ [ drop _ ] dip >lower subseq? ] assoc-filter
|
|
||||||
[ swap result boa ] { } assoc>map
|
|
||||||
[ title>> ] sort-with
|
|
||||||
partition-exact ;
|
|
||||||
|
|
||||||
: article-apropos ( string -- results )
|
: article-apropos ( string -- results )
|
||||||
"articles.idx" offline-apropos ;
|
"articles.idx" offline-apropos ;
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
! Copyright (C) 2008 Slava Pestov.
|
! Copyright (C) 2008 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors db.sqlite furnace.actions furnace.alloy
|
USING: accessors assocs furnace.actions furnace.redirection
|
||||||
furnace.redirection help.html help.topics html.components
|
help.html help.topics html.components html.forms http.server
|
||||||
html.forms html.templates.chloe http.server
|
|
||||||
http.server.dispatchers http.server.static io.directories
|
http.server.dispatchers http.server.static io.directories
|
||||||
io.files io.files.temp kernel locals namespaces sequences
|
io.files.temp kernel locals namespaces sequences
|
||||||
unicode.categories urls ;
|
unicode.categories urls ;
|
||||||
IN: webapps.help
|
IN: webapps.help
|
||||||
|
|
||||||
TUPLE: help-webapp < dispatcher ;
|
TUPLE: help-webapp < dispatcher ;
|
||||||
|
|
||||||
M: result link-title title>> ;
|
: links ( seq -- seq' )
|
||||||
|
[ swap <simple-link> ] { } assoc>map ;
|
||||||
M: result link-href href>> ;
|
|
||||||
|
|
||||||
:: <search-action> ( help-dir -- action )
|
:: <search-action> ( help-dir -- action )
|
||||||
<page-action>
|
<page-action>
|
||||||
|
@ -20,9 +18,9 @@ M: result link-href href>> ;
|
||||||
[
|
[
|
||||||
"search" param [ blank? ] trim [
|
"search" param [ blank? ] trim [
|
||||||
help-dir [
|
help-dir [
|
||||||
[ article-apropos "articles" set-value ]
|
[ article-apropos links "articles" set-value ]
|
||||||
[ word-apropos "words" set-value ]
|
[ word-apropos links "words" set-value ]
|
||||||
[ vocab-apropos "vocabs" set-value ] tri
|
[ vocab-apropos links "vocabs" set-value ] tri
|
||||||
] with-directory
|
] with-directory
|
||||||
] unless-empty
|
] unless-empty
|
||||||
help-navbar "navbar" set-value
|
help-navbar "navbar" set-value
|
||||||
|
|
Loading…
Reference in New Issue