diff --git a/collects/scribblings/main/private/make-search.ss b/collects/scribblings/main/private/make-search.ss index 2a8ab25edc..0263f2ea89 100644 --- a/collects/scribblings/main/private/make-search.ss +++ b/collects/scribblings/main/private/make-search.ss @@ -3,7 +3,7 @@ (require scribble/decode scribble/struct - ;; scribble/manual-struct + scribble/manual-struct scheme/list scheme/string scheme/match @@ -38,23 +38,41 @@ (for/list ([i l]) ;; i is (list tag (text ...) (element ...) index-desc) (define-values (tag texts elts desc) (apply values i)) + (define text (string-downcase (string-join texts " "))) (define-values (href html) (let* ([e (add-between elts ", ")] [e (make-link-element "indexlink" e tag)] [e (send renderer render-element e sec ri)]) (match e ; should always render to a single `a' [`((a ([href ,href] [class "indexlink"]) . ,body)) - (values href (string-append* (map xexpr->string body)))] - [else (error 'zzz "something bad happened ~s" e)]))) - ;; (and (exported-index-desc? desc) - ;; (list (exported-index-desc-name desc) - ;; (exported-index-desc-from-libs desc))) + (let (;; throw away tooltips, we don't need them + [body (match body + [`((span ((title ,label)) . ,body)) + (if (regexp-match? #rx"^Provided from: " label) + body + ;; if this happens, this code should be updated + (error "internal error: unexpected tooltip"))] + [else body])]) + (values href (string-append* (map xexpr->string body))))] + [else (error "something bad happened")]))) + (define from-libs + (if (exported-index-desc? desc) + (string-append* + `("[" + ,@(add-between + (map (lambda (x) + (format "~s" (match x + [(? symbol?) (symbol->string x)] + [`',(? symbol? x) + (string-append "'" (symbol->string x))]))) + (exported-index-desc-from-libs desc)) + ", ") + "]")) + "false")) ;; Note: using ~s to have javascript-quoted strings - (format "[~s, ~s, ~s]" - (string-downcase (string-join texts " ")) - href - html))) + (format "[~s, ~s, ~s, ~a]" text href html from-libs))) (set! l (add-between l ",\n")) + @script[#:noscript @list{Sorry, you must have JavaScript to use this page.}]{ // this vector has an entry for each index link: [text, url, html] plt_search_data = [ @@ -79,7 +97,7 @@ +'