-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.yaws?file=%2Findex.yaws
175 lines (148 loc) · 5.57 KB
/
code.yaws?file=%2Findex.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<html>
<div>
<h2>/index.yaws</h2>
<div>
<pre><erl>
out(A) ->
[{ssi, "TAB.inc","%%",[{"index", "choosen"}]},
{ehtml,
[{'div', [{id, "entry"}],
[{h1,[],"Yaws"},
{p,[],"Yaws is a HTTP high perfomance 1.1 webserver particularly"
" well suited for dynamic-content web applications. Two
separate modes of operations are supported:"},
{ul,[],
[{li,[],
{p,[],"Standalone mode where Yaws runs as a regular webserver "
"daemon. This is the default mode."}},
{li,[],
{p,[], "Embedded mode where Yaws runs as an embedded webserver in "
"another Erlang application."}}
]},
{p,[], ["Yaws is entirely written in ",
{a, [{href, "http://www.erlang.org"}], "Erlang"},
", and furthermore it is a multithreaded webserver where one "
"Erlang lightweight process is used to handle each client."]},
{p,[], "The main advantages of Yaws compared to other Web technologies"
" are performance and elegance. The performance comes from the "
" underlying Erlang system and its ability to handle concurrent "
" processes in an efficent way. Its elegance comes from Erlang as "
"well. Web applications don't have to be written in ugly ad hoc "
"languages."},
{h2,[], "erlyaws.github.io"},
{p,[], ["The www page for Yaws is ",
{a ,[{href,"http://erlyaws.github.io"}], "erlyaws.github.io"},
". The documentation, examples as well as releases can be "
"found there, and of course, ",
{a ,[{href,"http://erlyaws.github.io"}],"erlyaws.github.io"},
" is itself powered by Yaws."]},
{p,[], ["Code is on : ",
{a,[{href,"http://github.com/erlyaws/yaws"}],
"http://github.com/erlyaws/yaws"}]},
{p, [], ["Travis test results at :",
{a, [{href, "https://github.com/erlyaws/yaws/actions"
"/workflows/main.yml"}],
"https://github.com/erlyaws/yaws/actions"
"/workflows/main.yml"}]},
{p,[], ["A mailing list exists at: ",
{a,[{href,"https://lists.sourceforge.net/lists/listinfo/"
"erlyaws-list"}],
"https://lists.sourceforge.net/lists/listinfo/erlyaws-list"}]},
{p, [], ["A lot of excellent"
" engineers have contributed to Yaws over the years, "
"we keep a list of all "
,{a ,[{href,"contributors.txt"}], "contributors"}
]},
{p, [], ["A high resolution logo created by Tomas Selander exists at ",
{a, [{href, "yaws.eps"}], "yaws.eps"}]},
{h2, [], "News"},
{p, [], ["To see all the most recent changes and activity in Yaws "
"development, please visit the ",
{a, [{href, "https://github.com/erlyaws/yaws"}],
"Yaws github repository"}, "."]},
gen_log(A)]}]},
{ssi, "END2",[],[]}].
is_proper(10) ->
false;
is_proper(Tag) ->
case string:tokens(Tag, "-") of
["yaws", Rel] ->
IntList = string:tokens(Rel, "."),
case lists:filter(
fun(IntStr) ->
case catch list_to_integer(IntStr) of
{'EXIT', _} ->
true;
_ ->
false
end
end, IntList) of
[] ->
true;
_ ->
false
end;
_ ->
false
end.
cd(Git) ->
["cd ", Git, "; "].
git(Cd, Cmd) ->
os:cmd([cd(Cd), Cmd]).
head(Tag, Dir) ->
Date =
git(Dir, ["git --no-pager show ", Tag, " | grep Date | head -1"]),
Ret = ["Version " , Tag, " " , Date],
Ret.
gen_log(A) ->
case os:getenv("YAWS_GIT") of
false ->
[];
Dir ->
Tags = lists:filter(
fun(Tag) ->
is_proper(Tag) end,
lists:reverse(
string:tokens(
git(Dir, "git tag -l"), [10]))),
gen_log(A, Tags, Dir)
end.
dlog(Last, Prev, Dir) ->
Str =
git(Dir,
["git --no-pager log --abbrev-commit --no-merges --pretty=medium ",
Prev, "..", Last, " | cat"]),
Str2 = lists:zf(fun(I) ->
if I == $< ->
%% XSS
false;
0<I, I<255 ->
{true, I};
true ->
false
end
end, Str),
Lines = string:tokens(Str2, "\n"),
lists:map(
fun(Line) ->
case Line of
"commit " ++ _ ->
["<br/><h3>", Line, "</h3> <br/>"];
_ ->
[Line, "<br/>"]
end
end,Lines).
gen_log(_, [], _) ->
[];
gen_log(A, [Last, Prev | Tail], Dir) ->
Head = head(Last, Dir),
Data = dlog(Last, Prev, Dir),
X = [{'div', [{class, "news"}],
[{h3, [], Head},
{p, [], ["<pre>", Data, "</pre>"]}]}
],
[ X | gen_log(A, [Prev | Tail], Dir)];
gen_log(A, [Last],_) ->
[].
</erl>
</pre></div></div></html>