searching in help desk now says 'no results' if there are no results, and the help desk menu item in drscheme opens the front page of the manuals
svn: r8227
This commit is contained in:
parent
4b24262f96
commit
379f2a162b
|
@ -78,11 +78,5 @@
|
||||||
|
|
||||||
(define help-desk
|
(define help-desk
|
||||||
(case-lambda
|
(case-lambda
|
||||||
[() (void)]
|
[() (send-main-page)]
|
||||||
[(key) (help-desk key #f)]
|
[(key) (generate-search-results (list key))]))
|
||||||
[(key lucky?) (help-desk key lucky? 'keyword+index)]
|
|
||||||
[(key lucky? type) (help-desk key lucky? type 'contains)]
|
|
||||||
[(key lucky? type mode) (help-desk key lucky? type mode #f)]
|
|
||||||
[(key lucky? type mode language)
|
|
||||||
(generate-search-results (list key))
|
|
||||||
(void)]))
|
|
||||||
|
|
|
@ -302,7 +302,7 @@ TODO
|
||||||
(and (is-a? tlw drscheme:unit:frame<%>)
|
(and (is-a? tlw drscheme:unit:frame<%>)
|
||||||
(send (send tlw get-definitions-text)
|
(send (send tlw get-definitions-text)
|
||||||
get-next-settings)))))])
|
get-next-settings)))))])
|
||||||
(drscheme:help-desk:help-desk str #f 'keyword+index 'contains language))))]
|
(drscheme:help-desk:help-desk str))))]
|
||||||
[else
|
[else
|
||||||
(drscheme:help-desk:help-desk)])))
|
(drscheme:help-desk:help-desk)])))
|
||||||
(let ([with-drs-frame
|
(let ([with-drs-frame
|
||||||
|
|
|
@ -1306,53 +1306,6 @@
|
||||||
"Constructs a vector whose elements are the fields of \\var{simple-settings}.")
|
"Constructs a vector whose elements are the fields of \\var{simple-settings}.")
|
||||||
|
|
||||||
|
|
||||||
;
|
|
||||||
;
|
|
||||||
;
|
|
||||||
; ; ; ; ;
|
|
||||||
; ; ; ; ;
|
|
||||||
; ; ; ; ;
|
|
||||||
; ; ;; ;;; ; ; ;; ;; ; ;;; ;;; ; ;
|
|
||||||
; ;; ; ; ; ; ;; ; ; ;; ; ; ; ; ;
|
|
||||||
; ; ; ; ; ; ; ; ; ; ; ; ;; ; ;
|
|
||||||
; ; ; ;;;;;; ; ; ; ;;;;;; ; ; ;;;;;; ;; ;;;
|
|
||||||
; ; ; ; ; ; ; ; ; ; ; ; ;
|
|
||||||
; ; ; ; ; ;; ; ; ;; ; ; ; ;
|
|
||||||
; ; ; ;;;; ; ; ;; ;; ; ;;;; ;;; ; ;
|
|
||||||
; ;
|
|
||||||
; ;
|
|
||||||
; ;
|
|
||||||
|
|
||||||
(drscheme:help-desk:help-desk
|
|
||||||
(case->
|
|
||||||
(-> void?)
|
|
||||||
(string? boolean? (symbols 'keyword 'keyword+index 'all) (symbols 'exact 'contains 'regexp)
|
|
||||||
. -> .
|
|
||||||
void?)
|
|
||||||
(string? boolean? (symbols 'keyword 'keyword+index 'all) . -> . void?)
|
|
||||||
(string? boolean? . -> . void?))
|
|
||||||
(()
|
|
||||||
(key lucky? type mode)
|
|
||||||
(key lucky? type)
|
|
||||||
(key lucky?))
|
|
||||||
|
|
||||||
"This function opens a help desk window, or brings an already open help"
|
|
||||||
"desk window to the front. If an argument is specified, that key is"
|
|
||||||
"searched for."
|
|
||||||
""
|
|
||||||
"If no arguments are supplied, this function"
|
|
||||||
"opens a help-desk window to the starting page, or just brings a"
|
|
||||||
"help-desk window to the front (without changing what page it is"
|
|
||||||
"viewing)."
|
|
||||||
""
|
|
||||||
"If any arguments are supplied, this function"
|
|
||||||
"opens a help-desk window and searches for \\var{key}, according to "
|
|
||||||
"\\var{lucky?}, \\var{type}, and \\var{mode}."
|
|
||||||
"If the second, third, fourth, and/or fifth arguments are omitted, "
|
|
||||||
"they default to \\scmc{\\#t} \\Symbol{keyword+index} and \\Symbol{exact},"
|
|
||||||
"and \\Symbol{all} respectively.")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
|
@ -140,14 +140,7 @@ module browser threading seems wrong.
|
||||||
str
|
str
|
||||||
(- 200 (string-length (string-constant search-help-desk-for)))))
|
(- 200 (string-length (string-constant search-help-desk-for)))))
|
||||||
menu
|
menu
|
||||||
(λ x (help-desk:help-desk str #f 'keyword+index 'contains language)))
|
(λ x (help-desk:help-desk str)))
|
||||||
(make-object menu-item%
|
|
||||||
(gui-utils:format-literal-label (string-constant exact-lucky-search-help-desk-for)
|
|
||||||
(shorten-str
|
|
||||||
str
|
|
||||||
(- 200 (string-length (string-constant exact-lucky-search-help-desk-for)))))
|
|
||||||
menu
|
|
||||||
(λ x (help-desk:help-desk str #t 'keyword+index 'exact language)))
|
|
||||||
(void)))))))))
|
(void)))))))))
|
||||||
|
|
||||||
;; find-symbol : number -> string
|
;; find-symbol : number -> string
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#lang scheme/base
|
#lang scheme/base
|
||||||
|
|
||||||
(require "search.ss"
|
(require "search.ss"
|
||||||
net/sendurl
|
|
||||||
setup/dirs
|
|
||||||
scheme/cmdline)
|
scheme/cmdline)
|
||||||
|
|
||||||
(define exact-search? #f)
|
(define exact-search? #f)
|
||||||
|
@ -18,7 +16,6 @@
|
||||||
(error 'plt-help "expected a single search term, got ~s" search-term))
|
(error 'plt-help "expected a single search term, got ~s" search-term))
|
||||||
(send-exact-results (car search-term))]
|
(send-exact-results (car search-term))]
|
||||||
[(null? search-term)
|
[(null? search-term)
|
||||||
(let ([dest-path (build-path (find-doc-dir) "start" "index.html")])
|
(send-main-page)]
|
||||||
(send-url (format "file://~a" (path->string dest-path))))]
|
|
||||||
[else
|
[else
|
||||||
(generate-search-results search-term)]))
|
(generate-search-results search-term)]))
|
||||||
|
|
|
@ -10,11 +10,17 @@
|
||||||
(prefix-in scheme: scribble/scheme)
|
(prefix-in scheme: scribble/scheme)
|
||||||
net/sendurl
|
net/sendurl
|
||||||
net/uri-codec
|
net/uri-codec
|
||||||
mzlib/contract)
|
mzlib/contract
|
||||||
|
setup/dirs)
|
||||||
|
|
||||||
(provide/contract
|
(provide/contract
|
||||||
[generate-search-results (-> (listof string?) void?)]
|
[generate-search-results (-> (listof string?) void?)]
|
||||||
[send-exact-results (-> string? void?)])
|
[send-exact-results (-> string? void?)]
|
||||||
|
[send-main-page (-> void?)])
|
||||||
|
|
||||||
|
(define (send-main-page)
|
||||||
|
(let ([dest-path (build-path (find-doc-dir) "start" "index.html")])
|
||||||
|
(send-url (format "file://~a" (path->string dest-path)))))
|
||||||
|
|
||||||
;; if there is exactly one exact match for this search key, go directly
|
;; if there is exactly one exact match for this search key, go directly
|
||||||
;; to that place. Otherwise, go to a page that lists all of the matches.
|
;; to that place. Otherwise, go to a page that lists all of the matches.
|
||||||
|
@ -58,9 +64,14 @@
|
||||||
[matching-entries (filter (has-match search-regexps) index)]
|
[matching-entries (filter (has-match search-regexps) index)]
|
||||||
[exact-matches (filter (has-match exact-search-regexps) matching-entries)]
|
[exact-matches (filter (has-match exact-search-regexps) matching-entries)]
|
||||||
[inexact-matches (filter (compose not (has-match exact-search-regexps)) matching-entries)])
|
[inexact-matches (filter (compose not (has-match exact-search-regexps)) matching-entries)])
|
||||||
|
(cond
|
||||||
|
[(and (null? exact-matches)
|
||||||
|
(null? inexact-matches))
|
||||||
|
(list (make-element "schemeerror" (list "No results found.")))]
|
||||||
|
[else
|
||||||
(append
|
(append
|
||||||
(build-itemization "Exact matches" exact-matches)
|
(build-itemization "Exact matches" exact-matches)
|
||||||
(build-itemization "Containing matches" inexact-matches)))))
|
(build-itemization "Containing matches" inexact-matches))]))))
|
||||||
file)
|
file)
|
||||||
(send-url (format "file://~a" (path->string file)))
|
(send-url (format "file://~a" (path->string file)))
|
||||||
(void))))
|
(void))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user