-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.dylan
37 lines (29 loc) · 974 Bytes
/
search.dylan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
module: code-browser
Synopsis: Browse Open Dylan environment objects
Author: Andreas Bogk, Bastian Mueller, Hannes Mehnert
define thread variable *results* = #f;
define class <search-page> (<resource>)
end;
define method respond (page :: <search-page>, #key)
set-header(current-response(), "Content-Type", "text/html");
let search-string = get-query-value("search");
let results = element($all-symbols, search-string, default: #());
dynamic-bind(*results* = results)
process-template(*result-page*);
end;
end;
define class <result-page> (<code-browser-page>)
end;
define variable *result-page*
= make(<result-page>, source: "results.dsp");
define body tag results in code-browser
(page :: <code-browser-page>, do-body :: <function>)
()
for (result in *results*)
dynamic-bind(*project* = result.symbol-entry-project)
dynamic-bind(*environment-object* = result.symbol-entry-name)
do-body()
end;
end;
end;
end;