blob: 47d9ad0713b0a108cb4a7273d221642e79043fdb (
plain)
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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title><%- options.title %></title>
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.0.0/build/styles/default.min.css">
<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.0.0/build/highlight.min.js"></script>
</head>
<body>
<%- navbar %>
<article>
<% if header.data then %>
<%- header.data %>
<% else %>
<section>
<h3><%- header.name %></h3>
<% if header.short_desc then %>
<p><%- header.short_desc %>
<% header.short_desc = nil %>
<% end %>
<% if header.desc then %>
<p><%- header.desc or "" %>
<% header.desc = nil %>
<% end %>
<% if header.inherits then %>
<p>Inherits from
<% for _,name in pairs(header.inherits) do %>
<a href="<%- name %>.html"><%- name %></a>
<% end %>
<% end %>
</section>
<% local funcorder = {} %>
<% for funcname,_ in pairs(header) do %>
<% table.insert(funcorder,funcname) %>
<% end %>
<% table.sort(funcorder) %>
<section>
<h4>Contents</h4>
<table>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
<% for _, funcname in ipairs(funcorder) do %>
<% local data = header[funcname] %>
<% if data and data.short_desc then %>
<tr>
<% if data.type == "function" or data.type == "method" then %>
<td><%- funcsig({funcname = funcname, func = header[funcname]}) %></td>
<td><%- data.short_desc %></td>
<% else %>
<td><%- data.name %></td>
<td><%- data.short_desc %></td>
<% end %>
</tr>
<% end %>
<% end %>
</table>
</section>
<hr>
<% local func_fd = assert(io.open("func.etlua","r")) %>
<% local func_sec = assert(et.compile(func_fd:read("*a"))) %>
<% func_fd:close() %>
<% for _, funcname in ipairs(funcorder) do %>
<% local data = header[funcname] %>
<% print("Data:", data) %>
<% if data.type == "method" or data.type == "function" then %>
<% print("about to render...") %>
<%- assert(func_sec{
name = funcname,
data = data
}) %>
<% print("done rendering...") %>
<hr>
<% elseif data.type == "field" then %>
<% print("about to do field ") %>
<h4><%- funcname %></h4>
<p><%- data.desc or "" %>
<hr>
<% else %>
<% print("About to do error...") %>
<% if funcname ~= "name" and funcname ~= "type" then %>
<p>Unknown field type: <%- data and data.type or "" %> for <%- funcname %>
<hr>
<% end %>
<% end %>
<% print("Next chunk...") %>
<% end %>
<% print("done with all chunks...") %>
<% end %>
</article>
</body>
</html>
|