Add H: and R: search box options, to search for #lang and #reader providers
This commit is contained in:
parent
9887669ab0
commit
1dd934c8cb
|
@ -168,7 +168,14 @@
|
||||||
[(exported-index-desc? desc)
|
[(exported-index-desc? desc)
|
||||||
(let ([libs (map lib->name (exported-index-desc-from-libs desc))])
|
(let ([libs (map lib->name (exported-index-desc-from-libs desc))])
|
||||||
(string-append* `("[" ,@(add-between libs ",") "]")))]
|
(string-append* `("[" ,@(add-between libs ",") "]")))]
|
||||||
[(module-path-index-desc? desc) "\"module\""]
|
[(module-path-index-desc? desc)
|
||||||
|
(cond
|
||||||
|
[(language-index-desc? desc)
|
||||||
|
"\"language\""]
|
||||||
|
[(reader-index-desc? desc)
|
||||||
|
"\"reader\""]
|
||||||
|
[else
|
||||||
|
"\"module\""])]
|
||||||
[else "false"]))
|
[else "false"]))
|
||||||
(and href
|
(and href
|
||||||
(string-append "[" (quote-string text) ","
|
(string-append "[" (quote-string text) ","
|
||||||
|
|
|
@ -119,10 +119,17 @@ function InitializeSearch() {
|
||||||
+' identifiers from modules that (partially) match'
|
+' identifiers from modules that (partially) match'
|
||||||
+' “<tt><i>str</i></tt>”; “<tt>M:</tt>” by'
|
+' “<tt><i>str</i></tt>”; “<tt>M:</tt>” by'
|
||||||
+' itself will restrict results to bound names only.</li>'
|
+' itself will restrict results to bound names only.</li>'
|
||||||
|
+'<li>Use “<tt>H:<i>str</i></tt>” to match only'
|
||||||
|
+' modules that implement a language'
|
||||||
|
+' “<tt>#lang <i>str</i></tt>”.</li>'
|
||||||
|
+'<li>Use “<tt>R:<i>str</i></tt>” to match only'
|
||||||
|
+' modules that implement a reader module'
|
||||||
|
+' “<tt>#reader <i>str</i></tt>”.</li>'
|
||||||
+'<li>“<tt>L:<i>str</i></tt>” is similar to'
|
+'<li>“<tt>L:<i>str</i></tt>” is similar to'
|
||||||
+' “<tt>M:<i>str</i></tt>”, but'
|
+' “<tt>M:<i>str</i></tt>”, but'
|
||||||
+' “<tt><i>str</i></tt>” should match the module name'
|
+' “<tt><i>str</i></tt>” should match the module name'
|
||||||
+' exactly.</li>'
|
+' exactly; “<tt>M:</tt>” by'
|
||||||
|
+' itself will restrict results to module names only.</li>'
|
||||||
+'<li>“<tt>T:<i>str</i></tt>” restricts results to ones in'
|
+'<li>“<tt>T:<i>str</i></tt>” restricts results to ones in'
|
||||||
+' the “<tt><i>str</i></tt>” manual (naming the'
|
+' the “<tt><i>str</i></tt>” manual (naming the'
|
||||||
+' directory where the manual is found).</li>'
|
+' directory where the manual is found).</li>'
|
||||||
|
@ -193,6 +200,8 @@ function InitializeSearch() {
|
||||||
+' few common choices:'
|
+' few common choices:'
|
||||||
+'<ul style="padding: 0em; margin: 0.5em 1.5em;">'
|
+'<ul style="padding: 0em; margin: 0.5em 1.5em;">'
|
||||||
+MakeContextQueryItem("M:", "Bindings")
|
+MakeContextQueryItem("M:", "Bindings")
|
||||||
|
+MakeContextQueryItem("H:", "Languages")
|
||||||
|
+MakeContextQueryItem("R:", "Reader modules")
|
||||||
+MakeContextQueryItem("T:reference", "Reference manual")
|
+MakeContextQueryItem("T:reference", "Reference manual")
|
||||||
+MakeContextQueryItem("M:racket", "{{racket}} bindings")
|
+MakeContextQueryItem("M:racket", "{{racket}} bindings")
|
||||||
+MakeContextQueryItem("M:racket/base", "{{racket/base}} bindings")
|
+MakeContextQueryItem("M:racket/base", "{{racket/base}} bindings")
|
||||||
|
@ -402,7 +411,7 @@ function UrlToManual(url) {
|
||||||
// mostly for context queries.
|
// mostly for context queries.
|
||||||
|
|
||||||
function CompileTerm(term) {
|
function CompileTerm(term) {
|
||||||
var op = ((term.search(/^[NLMTQ]:/) == 0) && term.substring(0,1));
|
var op = ((term.search(/^[NLMHRTQ]:/) == 0) && term.substring(0,1));
|
||||||
if (op) term = term.substring(2);
|
if (op) term = term.substring(2);
|
||||||
term = term.toLowerCase();
|
term = term.toLowerCase();
|
||||||
switch (op) {
|
switch (op) {
|
||||||
|
@ -413,16 +422,28 @@ function CompileTerm(term) {
|
||||||
case "L":
|
case "L":
|
||||||
return function(x) {
|
return function(x) {
|
||||||
if (!x[3]) return C_fail;
|
if (!x[3]) return C_fail;
|
||||||
if (x[3] == "module") // rexact allowed, show partial module matches
|
if (x[3] == "module" || x[3] == "language" || x[3] == "reader") // rexact allowed, show partial module matches
|
||||||
return Compare(term,x[0]);
|
return Compare(term,x[0]);
|
||||||
return (MaxCompares(term,x[3]) >= C_exact) ? C_exact : C_fail;
|
return (MaxCompares(term,x[3]) >= C_exact) ? C_exact : C_fail;
|
||||||
};
|
};
|
||||||
case "M":
|
case "M":
|
||||||
return function(x) {
|
return function(x) {
|
||||||
if (!x[3]) return C_fail;
|
if (!x[3]) return C_fail;
|
||||||
if (x[3] == "module") return Compare(term,x[0]); // rexact allowed
|
if (x[3] == "module" || x[3] == "language" || x[3] == "reader") return Compare(term,x[0]); // rexact allowed
|
||||||
return (MaxCompares(term,x[3]) >= C_match) ? C_exact : C_fail;
|
return (MaxCompares(term,x[3]) >= C_match) ? C_exact : C_fail;
|
||||||
};
|
};
|
||||||
|
case "H":
|
||||||
|
return function(x) {
|
||||||
|
if (!x[3]) return C_fail;
|
||||||
|
if (x[3] == "language") return Compare(term,x[0]);
|
||||||
|
return (MaxCompares(term,x[3]) >= C_exact) ? C_exact : C_fail;
|
||||||
|
};
|
||||||
|
case "R":
|
||||||
|
return function(x) {
|
||||||
|
if (!x[3]) return C_fail;
|
||||||
|
if (x[3] == "reader") return Compare(term,x[0]);
|
||||||
|
return (MaxCompares(term,x[3]) >= C_exact) ? C_exact : C_fail;
|
||||||
|
};
|
||||||
case "T":
|
case "T":
|
||||||
return function(x) {
|
return function(x) {
|
||||||
if (Compare(term,UrlToManual(x[1])) < C_exact) return C_fail;
|
if (Compare(term,UrlToManual(x[1])) < C_exact) return C_fail;
|
||||||
|
@ -680,6 +701,8 @@ function UpdateResults() {
|
||||||
+ desc[j] + '</a>';
|
+ desc[j] + '</a>';
|
||||||
} else if (desc == "module") {
|
} else if (desc == "module") {
|
||||||
note = '<span class="smaller">module</span>';
|
note = '<span class="smaller">module</span>';
|
||||||
|
} else if (desc == "language") {
|
||||||
|
note = '<span class="smaller">language</span>';
|
||||||
}
|
}
|
||||||
if (show_manuals == 2 || (show_manuals == 1 && !desc)) {
|
if (show_manuals == 2 || (show_manuals == 1 && !desc)) {
|
||||||
var manual = UrlToManual(res[1]),
|
var manual = UrlToManual(res[1]),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user