1 <%- title = scheme ..
"." .. type -%
>
4 local table = require
"table"
11 reference =
"Reference"
17 uint =
"Unsigned Integer",
19 float =
"Real Number",
20 ipaddr =
"IP-Address",
21 ip4addr =
"IPv4-Address",
22 ip6addr =
"IPv6-Address",
23 ip4prefix =
"IPv4-Prefix",
24 ip6prefix =
"IPv6-Prefix",
25 hostname =
"Hostname",
26 host =
"Host (Hostname or IP-Address)",
27 directory =
"Filesystem path (to directory)",
28 file =
"Filesystem path (to file)",
29 macaddr =
"MAC-Address",
31 portrange =
"Single Port or Portrange (First-Last)"
34 function _parse_ref( r )
35 local k, v, h = r:match(
"([^.]+)%.([^.]+)%.([^.]+)")
37 k, v = r:match(
"([^.]+)%.([^.]+)")
41 return self:_variable_target(k, v, h), true
43 return self:_section_filename(k, v)
48 function _parse_dep( r, c, s, o )
56 for v in r:gmatch(
"[^.]+") do
57 ref[#ref+
1] = (v:gsub(
"%$(.+)", vars ))
61 table.insert(ref,
1, s or '$section')
64 table.insert(ref,
1, c or '$config')
67 return self:_variable_target(unpack(ref))
72 <h1 class=
"section-title"><%=scheme-%
>
73 <%-if package.title then%
><dfn> - <%=package.title%
></dfn><%end%
></h1>
74 <h2 class=
"section-subtitle"><%=type-%
>
75 <%-if section.title then%
><dfn> - <%=section.title%
></dfn><%end%
></h2>
76 <div class=
"section-description"><%=section.description%
></div>
78 <h3 class=
"section-attributes">Attributes:
</h3>
79 <ul class=
"section-attributes-index">
81 if section.required then %
>
82 <li class=
"section-attributes-required">required:
<dfn>A section of this type is required.
</dfn></li>
84 if section.unique then %
>
85 <li class=
"section-attributes-unique">unique:
<dfn>There can be only one section of this type.
</dfn></li>
87 <li class=
"section-attributes-multiple">multiple:
<dfn>There can be more than one section of this type.
</dfn></li>
89 if section.dynamic then %
>
90 <li class=
"section-attributes-dynamic">dynamic:
<dfn>Sections of this type may contain user-defined options.
</dfn></li>
92 if section.named then %
>
93 <li class=
"section-attributes-named">named:
<dfn>Sections of this type require a name.
</dfn></li>
97 <% if section.depends then %
>
98 <h3 class=
"section-depends">Requirements (one of):
</h3>
99 <ul class=
"section-depends-index">
100 <% for i, d in ipairs(section.depends) do
103 <% for k2, v in luci.util.kspairs(d) do
104 local t = _parse_dep(k2, scheme, type)
106 <% if nf then %
>and<% end %
>
107 <%if t then%
><a href=
"<%=t%>"><%end%
><%=k2%
><%if t then%
></a><%end%
><%if v~=true then%
>=<%=v%
><%end%
>
115 <h3 class=
"section-variables">Variable Overview:
</h3>
116 <table class=
"section-variables-index">
117 <% for k, v in luci.util.kspairs(package.variables[type]) do
119 <tr class=
"section-variable-required">
120 <th><a href=
"#variable.<%=k%>"><%=k%
></a></th>
121 <td><%=v.title%
></td>
124 for k, v in luci.util.kspairs(package.variables[type]) do
125 if not v.required then%
>
126 <tr class=
"section-variable-mixed">
127 <th><a href=
"#variable.<%=k%>"><%=k%
></a></th>
128 <td><%=v.title%
></td>
133 <h3 class=
"section-variables">Options:
</h3>
136 for k, v in luci.util.kspairs(package.variables[type]) do
137 if (i==
0) == v.required then
140 <div class=
"variable-documentation">
141 <a name=
"variable.<%=k%>"></a>
142 <h4 class=
"variable-title"><%=k-%
>
143 <%-if v.title then%
><dfn> - <%=v.title%
></dfn><%end%
></h4>
144 <div class=
"variable-declaration">
145 <div class=
"variable-description"><%=v.description%
></div>
146 <h5 class=
"variable-attributes">Attributes:
</h5>
147 <ul class=
"varaible-attributes-index">
148 <% if v.required then %
>
149 <li class=
"variable-attribute-required"><strong>required
</strong></li>
151 <li class=
"variable-attribute-type"><strong>Type:
</strong> <%=types[v.type] or v.type%
></li>
152 <li class=
"variable-attribute-datatype"><strong>Datatype:
</strong> <%=datatypes[v.datatype] or v.datatype%
></li>
153 <% if v.multival then %
>
154 <li class=
"variable-attribute-multiple"><strong>multiple values:
</strong> space-separated
</li>
157 <% if v.depends then %
>
158 <h5 class=
"variable-depends">Dependencies (one of):
</h5>
159 <ul class=
"variable-depends-index">
160 <% for i, d in ipairs(v.depends) do
163 <% for k2, v in luci.util.kspairs(d) do
164 local t = _parse_dep(k2, scheme, type, k)
166 <% if nf then %
>and<% end %
>
167 <%if t then%
><a href=
"<%=t%>"><%end%
><%=k2%
><%if t then%
></a><%end%
><%if v~=true then%
>=<%=v%
><%end%
>
174 <% if v.type ==
"enum" then %
>
175 <h5 class=
"variable-values">Possible Values:
</h5>
176 <ul class=
"variable-values-index">
177 <% for k, d in pairs(v.values) do %
>
178 <li><strong><%=k%
></strong><%if d then%
> (<%=d%
>)<%end%
></li>
181 <% elseif v.type ==
"reference" then %
>
182 <h5 class=
"variable-reference">Value references:
</h5>
183 <ul class=
"variable-reference-index">
184 <% for k, d in ipairs(v.valueof) do %
>
186 <% local t, x = _parse_ref(d)
187 if t then %
><%=x and
"Value of" or
"Section of type"%
> <a href=
"<%=t%>"><% end %
>
189 <% if t then%
></a><% end %
>
195 <a href=
"#top">⇑</a>