diff options
Diffstat (limited to 'libs/uvldoc/luasrc')
-rw-r--r-- | libs/uvldoc/luasrc/uvldoc/proto/xhtml/footer.xml | 11 | ||||
-rw-r--r-- | libs/uvldoc/luasrc/uvldoc/proto/xhtml/header.xml | 15 | ||||
-rw-r--r-- | libs/uvldoc/luasrc/uvldoc/proto/xhtml/index.xml | 12 | ||||
-rw-r--r-- | libs/uvldoc/luasrc/uvldoc/proto/xhtml/menu.xml | 22 | ||||
-rw-r--r-- | libs/uvldoc/luasrc/uvldoc/proto/xhtml/scheme.xml | 16 | ||||
-rw-r--r-- | libs/uvldoc/luasrc/uvldoc/proto/xhtml/section.xml | 198 | ||||
-rw-r--r-- | libs/uvldoc/luasrc/uvldoc/proto/xhtml/uvldoc.css | 135 | ||||
-rw-r--r-- | libs/uvldoc/luasrc/uvldoc/renderer.lua | 124 |
8 files changed, 0 insertions, 533 deletions
diff --git a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/footer.xml b/libs/uvldoc/luasrc/uvldoc/proto/xhtml/footer.xml deleted file mode 100644 index 4b974693b9..0000000000 --- a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/footer.xml +++ /dev/null @@ -1,11 +0,0 @@ - -<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"> </div> - -</body> -</html>
\ 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 deleted file mode 100644 index f4a89b56d6..0000000000 --- a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/header.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> - <link rel="stylesheet" type="text/css" href="uvldoc.css" /> - <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" /> - <title><% if title then %><%=title%> - <% end %>LuCI UVLDoc</title> -</head> -<body> - -<div id="menu"> -<%+menu.xml%> -</div> - -<div id="content"> diff --git a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/index.xml b/libs/uvldoc/luasrc/uvldoc/proto/xhtml/index.xml deleted file mode 100644 index a90500481b..0000000000 --- a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/index.xml +++ /dev/null @@ -1,12 +0,0 @@ -<%+header.xml%> -<h1 class="index-title">UCI Documentation</h1> -<h3 class="index-subtitle">Schemes</h3> -<table class="index"> -<% for k, v in luci.util.kspairs(self.schemes) do %> -<tr> - <th><a href="<%=self:_scheme_filename(k)%>"><%=k%></a></th> - <td><%=self.schemes[k].title%></td> -</tr> -<% end %> -</table> -<%+footer.xml%>
\ No newline at end of file diff --git a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/menu.xml b/libs/uvldoc/luasrc/uvldoc/proto/xhtml/menu.xml deleted file mode 100644 index c0ad3da1b5..0000000000 --- a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/menu.xml +++ /dev/null @@ -1,22 +0,0 @@ -<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<%-if k2 == section then%> class="menu-active"<%-end-%>><a href="<%=self:_section_filename(k, k2)%>"><%=k2%></a></li> - <%end-%> - </ul> - <%-end%> -</li> -<%-end%> -</ul>
\ No newline at end of file diff --git a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/scheme.xml b/libs/uvldoc/luasrc/uvldoc/proto/xhtml/scheme.xml deleted file mode 100644 index f4fe22e75e..0000000000 --- a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/scheme.xml +++ /dev/null @@ -1,16 +0,0 @@ -<%- title = scheme -%> -<%+header.xml%> -<h1 class="section-title"><%=scheme-%> -<%-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> - <th><a href="<%=self:_section_filename(scheme, k)%>"><%=k%></a></th> - <td><%=v.title%></td> -</tr> -<% end %> -</table> -<%+footer.xml%>
\ No newline at end of file diff --git a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/section.xml b/libs/uvldoc/luasrc/uvldoc/proto/xhtml/section.xml deleted file mode 100644 index 691fde4a18..0000000000 --- a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/section.xml +++ /dev/null @@ -1,198 +0,0 @@ -<%- 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 - k, v = r:match("([^.]+)%.([^.]+)") - end - if k then - if h then - return self:_variable_target(k, v, h), true - else - return self:_section_filename(k, v) - end - end -end - -function _parse_dep( r, c, s, o ) - local ref = { } - local vars = { - config = c, - section = s, - option = o - } - - for v in r:gmatch("[^.]+") do - ref[#ref+1] = (v:gsub( "%$(.+)", vars )) - end - - if #ref < 2 then - table.insert(ref, 1, s or '$section') - end - if #ref < 3 then - table.insert(ref, 1, c or '$config') - end - - return self:_variable_target(unpack(ref)) -end - -%> -<a name="top"></a> -<h1 class="section-title"><%=scheme-%> -<%-if package.title then%><dfn> - <%=package.title%></dfn><%end%></h1> -<h2 class="section-subtitle"><%=type-%> -<%-if section.title then%><dfn> - <%=section.title%></dfn><%end%></h2> -<div class="section-description"><%=section.description%></div> - -<h3 class="section-attributes">Attributes:</h3> -<ul class="section-attributes-index"> -<%- -if section.required then %> - <li class="section-attributes-required">required: <dfn>A section of this type is required.</dfn></li> -<% end -if section.unique then %> - <li class="section-attributes-unique">unique: <dfn>There can be only one section of this type.</dfn></li> -<%- else -%> - <li class="section-attributes-multiple">multiple: <dfn>There can be more than one section of this type.</dfn></li> -<% end -if section.dynamic then %> - <li class="section-attributes-dynamic">dynamic: <dfn>Sections of this type may contain user-defined options.</dfn></li> -<% end -if section.named then %> - <li class="section-attributes-named">named: <dfn>Sections of this type require a name.</dfn></li> -<% end -%> -</ul> - -<% if section.depends then %> - <h3 class="section-depends">Requirements (one of):</h3> - <ul class="section-depends-index"> - <% for i, d in ipairs(section.depends) do - local nf = false%> - <li> - <% for k2, v in luci.util.kspairs(d) do - 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~=true then%>=<%=v%><%end%> - <% nf = true - end %> - </li> - <% end %> - </ul> -<% end %> - -<h3 class="section-variables">Variable 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"> - <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"> - <th><a href="#variable.<%=k%>"><%=k%></a></th> - <td><%=v.title%></td> -</tr> -<% end end %> -</table> - -<h3 class="section-variables">Options:</h3> -<%- -for i=0, 1 do -for k, v in luci.util.kspairs(package.variables[type]) do -if (i==0) == v.required then -%> -<hr /> -<div class="variable-documentation"> - <a name="variable.<%=k%>"></a> - <h4 class="variable-title"><%=k-%> - <%-if v.title then%><dfn> - <%=v.title%></dfn><%end%></h4> - <div class="variable-declaration"> - <div class="variable-description"><%=v.description%></div> - <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> <%=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> - <ul class="variable-depends-index"> - <% for i, d in ipairs(v.depends) do - local nf = false %> - <li> - <% for k2, v in luci.util.kspairs(d) do - 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~=true then%>=<%=v%><%end%> - <% nf = true - end %> - </li> - <% end %> - </ul> - <% end %> - <% if v.type == "enum" then %> - <h5 class="variable-values">Possible Values:</h5> - <ul class="variable-values-index"> - <% for k, d in pairs(v.values) do %> - <li><strong><%=k%></strong><%if d then%> (<%=d%>)<%end%></li> - <% end %> - </ul> - <% elseif v.type == "reference" then %> - <h5 class="variable-reference">Value references:</h5> - <ul class="variable-reference-index"> - <% for k, d in ipairs(v.valueof) do %> - <li> - <% local t, x = _parse_ref(d) - if t then %><%=x and "Value of" or "Section of type"%> <a href="<%=t%>"><% end %> - <%=d%> - <% if t then%></a><% end %> - </li> - <% end %> - </ul> - <% end %> - </div> - <a href="#top">⇑</a> -</div> -<% 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 deleted file mode 100644 index 32a5e96b55..0000000000 --- a/libs/uvldoc/luasrc/uvldoc/proto/xhtml/uvldoc.css +++ /dev/null @@ -1,135 +0,0 @@ -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; -} - -div.variable-description { - margin-bottom: 1em; -} - -h3.section-variables { - margin-top: 2em; -} - -h4.variable-title { - margin-bottom: 0; -} - -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 deleted file mode 100644 index 79b6cdb280..0000000000 --- a/libs/uvldoc/luasrc/uvldoc/renderer.lua +++ /dev/null @@ -1,124 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth <steven@midlink.org> -Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- - -local io = require "io" -local fs = require "nixio.fs" -local uvl = require "luci.uvl" -local util = require "luci.util" -local ltn12 = require "luci.ltn12" -local template = require "luci.template" - -local ipairs, getfenv, pairs, require, unpack = ipairs, getfenv, pairs, require, unpack -local luci = luci - -module "luci.uvldoc.renderer" - - -Generator = util.class() - -function Generator.__init__(self, schemes, output, uvlpath) - self.names = schemes - self.output = output or "doc" - self.schemes = {} - self.uvl = uvl.UVL(uvlpath) - - self.extension = ".xml" - self.additionals = {"uvldoc.css"} - self.sourcedir = util.libpath() .. "/uvldoc/proto/xhtml/" -end - - -function Generator.make(self) - for i, scheme in ipairs(self.names) do - self.schemes[scheme] = self.uvl:get_scheme(scheme) - end - - fs.mkdir(self.output) - - for i, file in ipairs(self.additionals) do - fs.datacopy(self.sourcedir .. file, self.output .. "/" .. file) - end - - template.compiler_mode = "memory" - template.viewdir = self.sourcedir - template.context.viewns = { - include = function(name) template.Template(name):render(getfenv(2)) end, - pairs = pairs, - ipairs = ipairs, - unpack = unpack, - luci = luci, - require = require - } - - self:_make_index() - - for scheme, package in pairs(self.schemes) do - self:_make_package(scheme) - for type, section in pairs(package.sections) do - self:_make_section(scheme, type) - end - end -end - -function Generator._make_index(self) - local t = template.Template("index.xml") - local sink = ltn12.sink.file( - io.open(self.output .. "/" .. self:_index_filename(), "w") - ) - t:render({self = self, write = sink}) - sink() -end - -function Generator._make_package(self, scheme) - local t = template.Template("scheme.xml") - local sink = ltn12.sink.file( - io.open(self.output .. "/" .. self:_scheme_filename(scheme), "w") - ) - t:render({self = self, package = self.schemes[scheme], scheme = scheme, write = sink}) - sink() -end - -function Generator._make_section(self, scheme, section) - local t = template.Template("section.xml") - local sink = ltn12.sink.file( - io.open(self.output .. "/" .. self:_section_filename(scheme, section), "w") - ) - local pkg = self.schemes[scheme] - t:render({self = self, package = pkg, - scheme = scheme, type=section, section=pkg.sections[section], - write = sink}) - sink() -end - -function Generator._index_filename(self) - return "index%s" % self.extension -end - -function Generator._scheme_filename(self, scheme) - return "scheme.%s%s" % {scheme, self.extension} -end - -function Generator._section_filename(self, scheme, section) - if self.schemes[scheme] and self.schemes[scheme].sections[section] then - return "section.%s.%s%s" % {scheme, section, self.extension} - end -end - -function Generator._variable_target(self, scheme, section, variable) - if self.schemes[scheme] and self.schemes[scheme].variables[section] and - self.schemes[scheme].variables[section][variable] then - return "section.%s.%s%s#variable.%s" % {scheme, section, self.extension, variable} - end -end |