* luci/contrib: implemented "@cstyle" tag in luadoc to tell whether a "module" is a class or an object instance; changed templates to use instance:function() notation for instances and function() notation for class members.
This commit is contained in:
parent
ba7b178943
commit
fa2d17a3f9
3 changed files with 23 additions and 15 deletions
|
@ -8,7 +8,7 @@ else
|
|||
end
|
||||
%>
|
||||
|
||||
<dt><%=func.private and "local " or ""%><a name="<%=func.name%>"></a><strong><%=func.name%></strong> (<%=table.concat(func.param, ", ")%>)</dt>
|
||||
<dt><%=func.private and "local " or ""%><a name="<%=func.name%>"></a><strong><%=(oop and func.name:gsub("%.",":") or func.name:gsub(".+%.",""))%></strong> (<%=table.concat(func.param, ", ")%>)</dt>
|
||||
<dd>
|
||||
<%=func.description or ""%>
|
||||
|
||||
|
@ -56,9 +56,9 @@ end
|
|||
<ul>
|
||||
<%for i = 1, #func.see do%>
|
||||
<li><a href="<%=luadoc.doclet.html.symbol_link(func.see[i], doc, module_doc, file_doc, from)%>">
|
||||
<%=func.see[i]%>
|
||||
<%=(oop and func.see[i]:gsub("%.",":") or func.see[i]:gsub(".+%.",""))%>
|
||||
</a>
|
||||
<%end%>
|
||||
</ul>
|
||||
</ul
|
||||
<%end%>
|
||||
</dd>
|
||||
|
|
|
@ -20,12 +20,13 @@
|
|||
|
||||
<div id="navigation">
|
||||
<%=luadoc.doclet.html.include("menu.lp", { doc=doc, module_doc=module_doc })%>
|
||||
<% oop = ( module_doc.doc[1].cstyle == "instance" ) and true or false %>
|
||||
|
||||
</div><!-- id="navigation" -->
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code><%=module_doc.name%></code></h1>
|
||||
<h1><%=( oop and "Object Instance" or "Class" )%> <code><%=module_doc.name%></code></h1>
|
||||
|
||||
<p><%=module_doc.description%></p>
|
||||
<%if module_doc.author then%>
|
||||
|
@ -44,13 +45,13 @@
|
|||
<p><small><b>Release:</b> <%=module_doc.release%></small></p>
|
||||
<%end%>
|
||||
|
||||
<%if #module_doc.functions > 0 then%>
|
||||
<%if #module_doc.functions > 0 then %>
|
||||
<h2>Functions</h2>
|
||||
<table class="function_list">
|
||||
<%for _, func_name in ipairs(module_doc.functions) do
|
||||
local func_data = module_doc.functions[func_name]%>
|
||||
<tr>
|
||||
<td class="name" nowrap><%=func_data.private and "local " or ""%><a href="#<%=func_name%>"><%=func_name%></a> (<%=table.concat(module_doc.functions[func_name].param, ", ")%>)</td>
|
||||
<td class="name" nowrap><%=func_data.private and "local " or ""%><a href="#<%=func_name%>"><%=(oop and func_name:gsub("%.",":") or func_name:gsub(".+%.",""))%></a> (<%=table.concat(module_doc.functions[func_name].param, ", ")%>)</td>
|
||||
<td class="summary"><%=module_doc.functions[func_name].summary%></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
|
@ -79,7 +80,7 @@
|
|||
<h2><a name="functions"></a>Functions</h2>
|
||||
<dl class="function">
|
||||
<%for _, func_name in ipairs(module_doc.functions) do%>
|
||||
<%=luadoc.doclet.html.include("function.lp", { doc=doc, module_doc=module_doc, func=module_doc.functions[func_name] })%>
|
||||
<%=luadoc.doclet.html.include("function.lp", { doc=doc, module_doc=module_doc, func=module_doc.functions[func_name], oop=oop })%>
|
||||
<%end%>
|
||||
</dl>
|
||||
<%end%>
|
||||
|
|
|
@ -32,6 +32,12 @@ end
|
|||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
local function cstyle (tag, block, text)
|
||||
block[tag] = text
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
local function copyright (tag, block, text)
|
||||
block[tag] = text
|
||||
end
|
||||
|
@ -149,6 +155,7 @@ end
|
|||
local handlers = {}
|
||||
handlers["author"] = author
|
||||
handlers["class"] = class
|
||||
handlers["cstyle"] = cstyle
|
||||
handlers["copyright"] = copyright
|
||||
handlers["description"] = description
|
||||
handlers["field"] = field
|
||||
|
|
Loading…
Reference in a new issue