UVLDoc: Rendering optimizations and CSS style

This commit is contained in:
Steven Barth 2008-09-11 15:21:56 +00:00
parent e5cb252043
commit ecf5ed021f
8 changed files with 191 additions and 21 deletions

View file

@ -1,9 +1,11 @@
</div>
<div id="copy">
<hr />
generated on <%=require "os".date("%c")%> with <a href="http://luci.freifunk-halle.net"><abbr title="Lua Configuration Interface">LuCI</abbr> UVLDoc</a> - written by Steven Barth and Jo-Philipp Wich
</div>
</div>
<div class="clear">&nbsp;</div>
</body>
</html>

View file

@ -4,10 +4,10 @@
<head>
<link rel="stylesheet" type="text/css" href="uvldoc.css" />
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
<title>LuCI UVLDoc</title>
<title><% if title then %><%=title%> - <% end %>LuCI UVLDoc</title>
</head>
<body>
<div id="menu">
<%+menu.xml%>
</div>

View file

@ -1,10 +1,10 @@
<%+header.xml%>
<h1 class="index-title">UCI Documentation</h1>
<h3 class="index-subtitle">Configurations</h3>
<h3 class="index-subtitle">Schemes</h3>
<table class="index">
<% for k, v in luci.util.kspairs(self.schemes) do %>
<tr>
<td><a href="<%=self:_scheme_filename(k)%>"><%=k%></a></td>
<th><a href="<%=self:_scheme_filename(k)%>"><%=k%></a></th>
<td><%=self.schemes[k].title%></td>
</tr>
<% end %>

View file

@ -1,15 +1,19 @@
<h2 class="menu-title">LuCI UVLDoc</h2>
<div class="menu-title">LuCI UVLDoc</div>
<ul class="menu-index">
<li<%-if not scheme then%> class="menu-active"<%-end-%>>
<a href="<%=self:_index_filename()%>">Index</a>
</li>
</ul>
<div class="menu-title">Schemes</div>
<ul class="menu-index">
<% for k, v in luci.util.kspairs(self.schemes) do %>
<li<%-if scheme == k then%> class="menu-active"<%-end-%>>
<a href="<%=self:_scheme_filename(k)%>"><%=k%></a>
<%-if scheme == k then-%>
<ul>
<%-for k2, v2 in luci.util.kspairs(v.sections) do%>
<li><a href="<%=self:_section_filename(k, k2)%>"><%=k2%></a></li>
<li<%-if k2 == section then%> class="menu-active"<%-end-%>><a href="<%=self:_section_filename(k, k2)%>"><%=k2%></a></li>
<%end-%>
</ul>
<%-end%>

View file

@ -1,13 +1,14 @@
<%- title = scheme -%>
<%+header.xml%>
<h1 class="section-title"><%=scheme-%>
<%-if package.title then%>: <%=package.title%><%end%></h1>
<%-if package.title then%><dfn> - <%=package.title%></dfn><%end%></h1>
<div class="scheme-description"><%=package.description%></div>
<h3 class="scheme-title">Sections:</h3>
<table class="scheme-index">
<% for k, v in luci.util.kspairs(package.sections) do %>
<tr>
<td><a href="<%=self:_section_filename(scheme, k)%>"><%=k%></a></td>
<th><a href="<%=self:_section_filename(scheme, k)%>"><%=k%></a></th>
<td><%=v.title%></td>
</tr>
<% end %>

View file

@ -1,7 +1,36 @@
<%- title = scheme .. "." .. type -%>
<%+header.xml%>
<%
local table = require "table"
types = {
list = "List",
variable = "Variable",
lazylist = "Mixed",
enum = "Enumerator",
reference = "Reference"
}
datatypes = {
boolean = "Boolean",
string = "String",
uint = "Unsigned Integer",
integer = "Integer",
float = "Real Number",
ipaddr = "IP-Address",
ip4addr = "IPv4-Address",
ip6addr = "IPv6-Address",
ip4prefix = "IPv4-Prefix",
ip6prefix = "IPv6-Prefix",
hostname = "Hostname",
host = "Host (Hostname or IP-Address)",
directory = "Filesystem path (to directory)",
file = "Filesystem path (to file)",
macaddr = "MAC-Address",
port = "Port",
portrange = "Single Port or Portrange (First-Last)"
}
function _parse_ref( r )
local k, v, h = r:match("([^.]+)%.([^.]+)%.([^.]+)")
if not k then
@ -39,10 +68,11 @@ function _parse_dep( r, c, s, o )
end
%>
<a name="top" />
<h1 class="section-title"><%=scheme-%>
<%-if package.title then%>: <%=package.title%><%end%></h1>
<%-if package.title then%><dfn> - <%=package.title%></dfn><%end%></h1>
<h2 class="section-subtitle"><%=type-%>
<%-if section.title then%>: <%=section.title%><%end%></h2>
<%-if section.title then%><dfn> - <%=section.title%></dfn><%end%></h2>
<div class="section-description"><%=section.description%></div>
<h3 class="section-attributes">Attributes:</h3>
@ -74,7 +104,7 @@ if section.named then %>
local t = _parse_dep(k2, scheme, type)
%>
<% if nf then %>and<% end %>
<%if t then%><a href="<%=t%>"><%end%><%=k2%><%if t then%></a><%end%><%if v~="" then%>=<%=v%><%end%>
<%if t then%><a href="<%=t%>"><%end%><%=k2%><%if t then%></a><%end%><%if v~=true then%>=<%=v%><%end%>
<% nf = true
end %>
</li>
@ -82,19 +112,19 @@ if section.named then %>
</ul>
<% end %>
<h3 class="section-variables">Options:</h3>
<h3 class="section-variables">Overview:</h3>
<table class="section-variables-index">
<% for k, v in luci.util.kspairs(package.variables[type]) do
if v.required then%>
<tr class="section-variable-required">
<td><a href="#variable.<%=k%>"><%=k%></a></td>
<th><a href="#variable.<%=k%>"><%=k%></a></th>
<td><%=v.title%></td>
</tr>
<% end end
for k, v in luci.util.kspairs(package.variables[type]) do
if not v.required then%>
<tr class="section-variable-mixed">
<td><a href="#variable.<%=k%>"><%=k%></a></td>
<th><a href="#variable.<%=k%>"><%=k%></a></th>
<td><%=v.title%></td>
</tr>
<% end end %>
@ -110,15 +140,19 @@ if (i==0) == v.required then
<div class="variable-documentation">
<a name="variable.<%=k%>" />
<h4 class="variable-title"><%=k-%>
<%-if v.title then%>: <%=v.title%><%end%></h4>
<%-if v.title then%><dfn> - <%=v.title%></dfn><%end%></h4>
<div class="variable-description"><%=v.description%></div>
<div class="variable-declaration">
<h5 class="variable-attributes">Attributes:</h5>
<ul class="varaible-attributes-index">
<% if v.required then %>
<li class="variable-attribute-required"><strong>required</strong></li>
<% end %>
<li class="variable-attribute-type"><strong>Type:</strong> <%=v.type%></li>
<li class="variable-attribute-datatype"><strong>Datatype:</strong> <%=v.datatype%></li>
<li class="variable-attribute-type"><strong>Type:</strong> <%=types[v.type] or v.type%></li>
<li class="variable-attribute-datatype"><strong>Datatype:</strong> <%=datatypes[v.datatype] or v.datatype%></li>
<% if v.multival then %>
<li class="variable-attribute-multiple"><strong>multiple values:</strong> space-separated</li>
<% end %>
</ul>
<% if v.depends then %>
<h5 class="variable-depends">Dependencies (one of):</h5>
@ -130,7 +164,7 @@ if (i==0) == v.required then
local t = _parse_dep(k2, scheme, type, k)
%>
<% if nf then %>and<% end %>
<%if t then%><a href="<%=t%>"><%end%><%=k2%><%if t then%></a><%end%><%if v~="" then%>=<%=v%><%end%>
<%if t then%><a href="<%=t%>"><%end%><%=k2%><%if t then%></a><%end%><%if v~=true then%>=<%=v%><%end%>
<% nf = true
end %>
</li>
@ -157,6 +191,8 @@ if (i==0) == v.required then
<% end %>
</ul>
<% end %>
</div>
<a href="#top">&#8657;</a>
</div>
<% end end end -%>
<%+footer.xml%>

View file

@ -0,0 +1,127 @@
body {
font-family: sans-serif;
font-size: 0.85em;
color: #101010;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 0;
font-weight: bold;
}
h1 {
font-size: 1.5em;
}
h2 {
font-size: 1.4em;
}
h3 {
font-size: 1.2em;
}
h4 {
font-size: 1.1em;
}
h5 {
font-size: 1.0em;
}
dfn {
font-weight: normal;
font-size: 0.9em;
}
table {
border-collapse: collapse;
}
tr, td, th {
border: 1px solid #e0e0ff;
padding: 3px;
}
th {
background-color: #f0f0ff;
text-align: left;
}
hr {
border: none;
background-color: #cccccc;
height: 1px;
}
ul, li {
margin-top: 0;
}
div.clear {
clear: both;
}
div.variable-declaration {
padding-left: 2em;
}
h3.section-variables {
margin-top: 2em;
}
div#menu {
float: left;
background-color: #f0f0ff;
margin: 0;
padding: 0;
border: 1px solid #e0e0ff;
width: 11.5em;
}
#menu ul {
list-style-type: none;
margin-bottom: 0.5em;
padding-left: 1em;
}
#menu ul li {
margin-left: 0;
}
div.menu-title {
background-color: #e0e0ff;
color: #000000;
font-weight: bold;
padding: 2px;
}
div#content {
margin-top: 0;
padding-top: 0;
margin-left: 12.5em;
}
div#copy {
margin-top: 2.5em;
font-size: 0.7em;
text-align: center;
font-size: bold;
}
a:link {
font-weight: bold;
color: #004080;
text-decoration: none;
}
a:visited {
font-weight:bold;
color: #006699;
text-decoration: none;
}
a:hover {
text-decoration:underline;
}

View file

@ -48,7 +48,7 @@ function Generator.make(self)
fs.mkdir(self.output)
for i, file in ipairs(self.additionals) do
fs.copy(self.sourcedir .. file, self.output)
fs.copy(self.sourcedir .. file, self.output .. "/" .. file)
end
template.compiler_mode = "memory"