From ecf5ed021f5009e89830ccb14450075eebe089e2 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Thu, 11 Sep 2008 15:21:56 +0000 Subject: [PATCH] UVLDoc: Rendering optimizations and CSS style --- .../luasrc/uvldoc/proto/xhtml/footer.xml | 6 +- .../luasrc/uvldoc/proto/xhtml/header.xml | 4 +- .../luasrc/uvldoc/proto/xhtml/index.xml | 4 +- .../uvldoc/luasrc/uvldoc/proto/xhtml/menu.xml | 8 +- .../luasrc/uvldoc/proto/xhtml/scheme.xml | 5 +- .../luasrc/uvldoc/proto/xhtml/section.xml | 56 ++++++-- .../luasrc/uvldoc/proto/xhtml/uvldoc.css | 127 ++++++++++++++++++ libs/uvldoc/luasrc/uvldoc/renderer.lua | 2 +- 8 files changed, 191 insertions(+), 21 deletions(-) create mode 100644 libs/uvldoc/luasrc/uvldoc/proto/xhtml/uvldoc.css diff --git a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/footer.xml b/libs/uvldoc/luasrc/uvldoc/proto/xhtml/footer.xml index d353ced18..4b974693b 100644 --- a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/footer.xml +++ b/libs/uvldoc/luasrc/uvldoc/proto/xhtml/footer.xml @@ -1,9 +1,11 @@ - -
+
generated on <%=require "os".date("%c")%> with LuCI UVLDoc - written by Steven Barth and Jo-Philipp Wich
+ +
 
+ \ No newline at end of file diff --git a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/header.xml b/libs/uvldoc/luasrc/uvldoc/proto/xhtml/header.xml index 9f18ad379..f4a89b56d 100644 --- a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/header.xml +++ b/libs/uvldoc/luasrc/uvldoc/proto/xhtml/header.xml @@ -4,10 +4,10 @@ - LuCI UVLDoc + <% if title then %><%=title%> - <% end %>LuCI UVLDoc - + diff --git a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/index.xml b/libs/uvldoc/luasrc/uvldoc/proto/xhtml/index.xml index 269c7989a..a90500481 100644 --- a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/index.xml +++ b/libs/uvldoc/luasrc/uvldoc/proto/xhtml/index.xml @@ -1,10 +1,10 @@ <%+header.xml%>

UCI Documentation

-

Configurations

+

Schemes

<% for k, v in luci.util.kspairs(self.schemes) do %> - + <% end %> diff --git a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/menu.xml b/libs/uvldoc/luasrc/uvldoc/proto/xhtml/menu.xml index bfe8c45ca..c0ad3da1b 100644 --- a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/menu.xml +++ b/libs/uvldoc/luasrc/uvldoc/proto/xhtml/menu.xml @@ -1,15 +1,19 @@ - + + + +
<%=k%><%=k%> <%=self.schemes[k].title%>
<% for k, v in luci.util.kspairs(package.sections) do %> - + <% end %> diff --git a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/section.xml b/libs/uvldoc/luasrc/uvldoc/proto/xhtml/section.xml index ed85c25cc..92625bc8a 100644 --- a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/section.xml +++ b/libs/uvldoc/luasrc/uvldoc/proto/xhtml/section.xml @@ -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 %> +

<%=scheme-%> -<%-if package.title then%>: <%=package.title%><%end%>

+<%-if package.title then%> - <%=package.title%><%end%>

<%=type-%> -<%-if section.title then%>: <%=section.title%><%end%>

+<%-if section.title then%> - <%=section.title%><%end%>
<%=section.description%>

Attributes:

@@ -74,7 +104,7 @@ if section.named then %> local t = _parse_dep(k2, scheme, type) %> <% if nf then %>and<% end %> - <%if t then%>
<%end%><%=k2%><%if t then%><%end%><%if v~="" then%>=<%=v%><%end%> + <%if t then%><%end%><%=k2%><%if t then%><%end%><%if v~=true then%>=<%=v%><%end%> <% nf = true end %> @@ -82,19 +112,19 @@ if section.named then %> <% end %> -

Options:

+

Overview:

<%=k%><%=k%> <%=v.title%>
<% for k, v in luci.util.kspairs(package.variables[type]) do if v.required then%> - + <% end end for k, v in luci.util.kspairs(package.variables[type]) do if not v.required then%> - + <% end end %> @@ -110,15 +140,19 @@ if (i==0) == v.required then

<%=k-%> - <%-if v.title then%>: <%=v.title%><%end%>

+ <%-if v.title then%> - <%=v.title%><%end%>
<%=v.description%>
+
+
<% end end end -%> <%+footer.xml%> \ No newline at end of file diff --git a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/uvldoc.css b/libs/uvldoc/luasrc/uvldoc/proto/xhtml/uvldoc.css new file mode 100644 index 000000000..2d9d3954d --- /dev/null +++ b/libs/uvldoc/luasrc/uvldoc/proto/xhtml/uvldoc.css @@ -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; +} diff --git a/libs/uvldoc/luasrc/uvldoc/renderer.lua b/libs/uvldoc/luasrc/uvldoc/renderer.lua index 27061d22d..d005ba315 100644 --- a/libs/uvldoc/luasrc/uvldoc/renderer.lua +++ b/libs/uvldoc/luasrc/uvldoc/renderer.lua @@ -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" -- 2.25.1
<%=k%><%=k%> <%=v.title%>
<%=k%><%=k%> <%=v.title%>