-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathldoc.ltp
135 lines (112 loc) · 2.82 KB
/
ldoc.ltp
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>$(ldoc.title)</title>
<link rel="stylesheet" href="$(ldoc.css)" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
# local iter = ldoc.modules.iter
# local M = ldoc.markup
<!-- Menu -->
# local function no_spaces(s) return s:gsub('%s','_') end
# local function use_li(ls)
# if #ls > 1 then return '<li>','</li>' else return '','' end
# end
# local function display_name(item)
# if item.type == 'function' then return item.name..' '..item.args
# else return item.name end
# end
<div id="navigation">
<h1>$(ldoc.project)</h1>
# if not ldoc.single then
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
# else
<p>$(M(ldoc.description))</p>
# end
# if module then
<hr/>
<ul>
# for kind, items in module.kinds() do
# for item in items() do
<li><a href="#$(item.name)">$(display_name(item))</a></li>
# end
# end
</ul>
# end
</div>
<div id="content">
# if module then
<h1>Module <code>$(module.name)</code></h1>
<p>$(M(module.summary))</p>
<p>$(M(module.description))</p>
<br/>
<br/>
# --- currently works for both Functions and Tables. The params field either contains
# --- function parameters or table fields.
# for kind, items in module.kinds() do
<dl class="function">
# for item in items() do
<dt>
<a name = "$(item.name)"></a>
<strong>$(display_name(item))</strong>
</dt>
<dd>
$(M(item.summary))
$(M(item.description))
# if item.usage then
# local li,il = use_li(item.usage)
<h3>Usage:</h3>
<ul>
# for usage in iter(item.usage) do
$(li)<pre class="example">$(usage)</pre>$(il)
# end -- for
</ul>
# end -- if usage
# if item.see then
# local li,il = use_li(item.see)
<h3>see also:</h3>
<ul>
# for see in iter(item.see) do
$(li)<a href="$(see.mod).html#$(see.name)">$(see.label)</a>$(il)
# end -- for
</ul>
# end -- if see
</dd>
# end -- for items
</dl>
# end -- for kinds
# else -- if module
# if ldoc.description then
<p>$(M(ldoc.description))</p>
# end
# for kind, mods in ldoc.kinds() do
<h2>$(kind)</h2>
# kind = kind:lower()
# for m in mods() do
<table class="module_list">
<tr>
<td class="name"><a href="$(no_spaces(kind))/$(m.name).html">$(m.name)</a></td>
<td class="summary">$(M(m.summary))</td>
</tr>
# end -- for modules
</table>
# end -- for kinds
# end -- if module
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>