forked from erlyaws/yaws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
man.yaws
37 lines (32 loc) · 1.24 KB
/
man.yaws
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
37
<erl>
out(A) ->
L = case queryvar(A,"page") of
{ok, Page} ->
%% only allow regular chars in Page
case lists:all(fun(C) ->
if
$a =< C, C =< $z ->
true;
$A =< C, C =< $Z ->
true;
C == $_ ->
true;
C == $. ->
true;
true ->
false
end
end, Page) of
true ->
os:cmd("env LC_ALL=en_US.ISO-8859-1 man " ++ Page ++ " | col -b -p -x");
false ->
"illegal character detected in query arg"
end;
undefined ->
"no man page found in query arg "
end,
{ehtml,
{html,[],
{'div',[{class,"man"}],
{pre,[], L}}}}.
</erl>