summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2017-08-31 13:17:38 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2017-08-31 16:57:08 +0200
commitbc47cfd40e408b50c010e9d56a7a010a95cde0c8 (patch)
tree8fa0133fe66072ae4d034558f1275b146ee0f88b /doc
parent9ada1defb572cacdf561e9d436a6961f8ea426e0 (diff)
Add ldoc template for lua module documentation
The template can be used instead of the default template by calling ldoc with the `-l doc` option, where *doc* is the directory of the template.
Diffstat (limited to 'doc')
-rw-r--r--doc/ldoc.ltp38
1 files changed, 38 insertions, 0 deletions
diff --git a/doc/ldoc.ltp b/doc/ldoc.ltp
new file mode 100644
index 000000000..3fa96bb0f
--- /dev/null
+++ b/doc/ldoc.ltp
@@ -0,0 +1,38 @@
+# local iter = ldoc.modules.iter
+# local M = ldoc.markup
+
+<h1>Module $(module.name)</h1>
+
+<p>$(M(module.summary))</p>
+
+# for kind, items in module.kinds() do
+
+<h2>$(kind)</h2>
+ <dl>
+# for item in items() do ldoc.item = item -- provides context for M()
+ <dt><span id="$(item.name)"><code>$(ldoc.display_name(item))</code></span></dt>
+ <dd>
+ <p>$(item.summary)</p>
+# if item.params and #item.params > 0 then
+ $(module.kinds:type_of(item).subnames):
+ <dl>
+# for p in iter(item.params) do
+ <dt><code>$(p)</code>:</dt>
+ <dd>$(M(item.params.map[p]))</dd>
+# end -- for
+ </dl>
+# end -- if params
+# if item.ret then
+ <p>Returns: $(item.ret[1])</p>
+# end -- if returns
+# if item.usage then
+ <p>Usage:</p>
+ <pre><code>$(item.usage[1])</code></pre>
+# end -- if usage
+# if item.see then
+ See also: <a href="#$(item.see[1].label)">$(item.see[1].label)</a>
+
+# end -- if see
+# end -- for items
+ </dl>
+# end -- for kinds