added provided-from information and display
svn: r10015
This commit is contained in:
parent
612f26972e
commit
001d27e557
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
(require scribble/decode
|
(require scribble/decode
|
||||||
scribble/struct
|
scribble/struct
|
||||||
;; scribble/manual-struct
|
scribble/manual-struct
|
||||||
scheme/list
|
scheme/list
|
||||||
scheme/string
|
scheme/string
|
||||||
scheme/match
|
scheme/match
|
||||||
|
@ -38,23 +38,41 @@
|
||||||
(for/list ([i l])
|
(for/list ([i l])
|
||||||
;; i is (list tag (text ...) (element ...) index-desc)
|
;; i is (list tag (text ...) (element ...) index-desc)
|
||||||
(define-values (tag texts elts desc) (apply values i))
|
(define-values (tag texts elts desc) (apply values i))
|
||||||
|
(define text (string-downcase (string-join texts " ")))
|
||||||
(define-values (href html)
|
(define-values (href html)
|
||||||
(let* ([e (add-between elts ", ")]
|
(let* ([e (add-between elts ", ")]
|
||||||
[e (make-link-element "indexlink" e tag)]
|
[e (make-link-element "indexlink" e tag)]
|
||||||
[e (send renderer render-element e sec ri)])
|
[e (send renderer render-element e sec ri)])
|
||||||
(match e ; should always render to a single `a'
|
(match e ; should always render to a single `a'
|
||||||
[`((a ([href ,href] [class "indexlink"]) . ,body))
|
[`((a ([href ,href] [class "indexlink"]) . ,body))
|
||||||
(values href (string-append* (map xexpr->string body)))]
|
(let (;; throw away tooltips, we don't need them
|
||||||
[else (error 'zzz "something bad happened ~s" e)])))
|
[body (match body
|
||||||
;; (and (exported-index-desc? desc)
|
[`((span ((title ,label)) . ,body))
|
||||||
;; (list (exported-index-desc-name desc)
|
(if (regexp-match? #rx"^Provided from: " label)
|
||||||
;; (exported-index-desc-from-libs desc)))
|
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
|
;; Note: using ~s to have javascript-quoted strings
|
||||||
(format "[~s, ~s, ~s]"
|
(format "[~s, ~s, ~s, ~a]" text href html from-libs)))
|
||||||
(string-downcase (string-join texts " "))
|
|
||||||
href
|
|
||||||
html)))
|
|
||||||
(set! l (add-between l ",\n"))
|
(set! l (add-between l ",\n"))
|
||||||
|
|
||||||
@script[#:noscript @list{Sorry, you must have JavaScript to use this page.}]{
|
@script[#:noscript @list{Sorry, you must have JavaScript to use this page.}]{
|
||||||
// this vector has an entry for each index link: [text, url, html]
|
// this vector has an entry for each index link: [text, url, html]
|
||||||
plt_search_data = [
|
plt_search_data = [
|
||||||
|
@ -79,7 +97,7 @@
|
||||||
+'<tr><td align="center" colspan="3">'
|
+'<tr><td align="center" colspan="3">'
|
||||||
+'<input type="text" id="search_box" style="width: 100%;"'
|
+'<input type="text" id="search_box" style="width: 100%;"'
|
||||||
+'onchange="search_handler(event);"'
|
+'onchange="search_handler(event);"'
|
||||||
+'onkeyup="search_handler(event);" />'
|
+'onkeypress="search_handler(event);" />'
|
||||||
+'</td></tr>'
|
+'</td></tr>'
|
||||||
+'<tr><td align="left">'
|
+'<tr><td align="left">'
|
||||||
+'<a href="#" title="Previous Page"'
|
+'<a href="#" title="Previous Page"'
|
||||||
|
@ -142,9 +160,10 @@
|
||||||
var last_search_terms;
|
var last_search_terms;
|
||||||
var search_results, first_search_result;
|
var search_results, first_search_result;
|
||||||
function DoSearch() {
|
function DoSearch() {
|
||||||
var terms = query.value.toLowerCase()
|
var terms =
|
||||||
.replace(/\s\s*/g," ") // single spaces
|
query.value.toLowerCase()
|
||||||
.replace(/^\s/g,"").replace(/\s$/g,""); // trim edge spaces
|
.replace(/\s\s*/g," ") // single spaces
|
||||||
|
.replace(/^\s/g,"").replace(/\s$/g,""); // trim edge spaces
|
||||||
if (terms == last_search_terms) return;
|
if (terms == last_search_terms) return;
|
||||||
last_search_terms = terms;
|
last_search_terms = terms;
|
||||||
status.nodeValue = "Searching " + plt_search_data.length + " entries";
|
status.nodeValue = "Searching " + plt_search_data.length + " entries";
|
||||||
|
@ -185,9 +204,21 @@
|
||||||
for (var i=0@";" i<result_links.length@";" i++) {
|
for (var i=0@";" i<result_links.length@";" i++) {
|
||||||
var n = i + first_search_result;
|
var n = i + first_search_result;
|
||||||
if (n < search_results.length) {
|
if (n < search_results.length) {
|
||||||
|
var desc = "";
|
||||||
|
if (search_results[n][3]) {
|
||||||
|
for (var j=0@";" j<search_results[n][3].length@";" j++)
|
||||||
|
desc += (j==0 ? "" : ", " )
|
||||||
|
+ '<span class="schememod">'
|
||||||
|
+ search_results[n][3][j]
|
||||||
|
+ '</span>';
|
||||||
|
desc = ' '
|
||||||
|
+ '<span style="font-size: 80%;">'
|
||||||
|
+ '<span style="font-size: 80%;">from</span> '
|
||||||
|
+ desc + '</span>';
|
||||||
|
}
|
||||||
result_links[i].innerHTML =
|
result_links[i].innerHTML =
|
||||||
'<a href="'+search_results[n][1]+'" class="indexlink">'
|
'<a href="'+search_results[n][1]+'" class="indexlink">'
|
||||||
+ search_results[n][2] + '</a>';
|
+ search_results[n][2] + '</a>' + desc;
|
||||||
result_links[i].style.display = "block";
|
result_links[i].style.display = "block";
|
||||||
} else {
|
} else {
|
||||||
result_links[i].style.display = "none";
|
result_links[i].style.display = "none";
|
||||||
|
@ -200,9 +231,10 @@
|
||||||
else
|
else
|
||||||
status.nodeValue =
|
status.nodeValue =
|
||||||
"Showing "
|
"Showing "
|
||||||
+ (first_search_result+1) + "--"
|
+ (first_search_result+1) + "-"
|
||||||
+ Math.min(first_search_result+results_num,search_results.length)
|
+ Math.min(first_search_result+results_num,search_results.length)
|
||||||
+ " of " + search_results.length + " matches";
|
+ " of " + search_results.length
|
||||||
|
+ ((search_results.length==plt_search_data.length) ? "" : " matches");
|
||||||
}
|
}
|
||||||
|
|
||||||
var search_timer = null;
|
var search_timer = null;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user