* some fixes to make-search.ss
* rename search-context.html to .htm to avoid being deleted by setup/scribble * added context to help/search interface svn: r10717
This commit is contained in:
parent
dc5211f363
commit
bb562f9ee4
|
@ -3,7 +3,7 @@
|
|||
(require setup/dirs net/sendurl net/uri-codec)
|
||||
(provide perform-search send-main-page)
|
||||
|
||||
(define search-page "search/index.html")
|
||||
(define search-dir "search/")
|
||||
|
||||
;; Almost nothing to do here -- the real work is done in the browser,
|
||||
;; using javascript.
|
||||
|
@ -14,5 +14,10 @@
|
|||
[path (if (file-exists? path) path (build-path (find-doc-dir) sub))])
|
||||
(send-url/file path #:fragment fragment #:query query)))
|
||||
|
||||
(define (perform-search str)
|
||||
(send-main-page #:sub search-page #:query (format "q=~a" (uri-encode str))))
|
||||
(define (perform-search str [context #f])
|
||||
(let* ([page (if context "search-context.htm" "index.html")]
|
||||
[query (format "q=~a" (uri-encode str))]
|
||||
[query (if context
|
||||
(format "~a&hq=~a" query (uri-encode context))
|
||||
query)])
|
||||
(send-main-page #:sub (string-append search-dir page) #:query query)))
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
scheme/list
|
||||
scheme/string
|
||||
scheme/match
|
||||
scheme/path
|
||||
net/url
|
||||
(only-in scheme/class send)
|
||||
(only-in xml xexpr->string)
|
||||
|
@ -23,7 +24,7 @@
|
|||
;; this file is used as a trampoline to set a context (a pre-filter cookie) and
|
||||
;; then hop over to the search page (the search page can do it itself, but it's
|
||||
;; to heavy to load twice).
|
||||
(define-runtime-path search-context-page "search-context.html")
|
||||
(define-runtime-path search-context-page "search-context.htm")
|
||||
|
||||
(define (quote-string str)
|
||||
(define (hex4 ch)
|
||||
|
@ -172,7 +173,7 @@
|
|||
@||})))
|
||||
|
||||
(for ([src (list search-script search-context-page)])
|
||||
(define dest (build-path dest-dir (file-name-from-path file)))
|
||||
(define dest (build-path dest-dir (file-name-from-path src)))
|
||||
(when (file-exists? dest) (delete-file dest))
|
||||
(copy-file src dest))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user