@@ -110,7 +110,7 @@ export.generator_metatable = setmetatable({}, {
110110 --[[
111111 tag "string"
112112 ]]
113- --
113+ --
114114 -- then the content is the `string`
115115 local tname = typename (attributes )
116116 if tname ~= " table" and tname ~= " HTML.Node" then
@@ -198,42 +198,41 @@ function export.generate_node(ctx) return ctx(export.generator_metatable) end
198198function export .generate (ctx ) return tostring (export .generate_node (ctx )) end
199199
200200--- Turns a lua table into an html table, recursively, with multiple levels of nesting
201- --- @param xml XML.GeneratorTable
202201--- @param tbl table
203202--- @return XML.Node
204- function export .html_table (xml , tbl )
205- --- @diagnostic disable : undefined-global
206- return xml .table {
207- function ()
208- local function getval (v )
209- if type (v ) ~= " table" or (getmetatable (v ) or {}).__tostring then
210- return tostring (v )
203+ function export .html_table (tbl )
204+ return export .generate_node (function (xml )
205+ return xml .table {
206+ function ()
207+ local function getval (v )
208+ if type (v ) ~= " table" or (getmetatable (v ) or {}).__tostring then
209+ return tostring (v )
210+ end
211+ return export .html_table (v )
211212 end
212- return export .html_table (xml , v )
213- end
214213
215- for i , v in ipairs (tbl ) do
216- coroutine.yield (
217- xml .tr {
218- xml .td (tostring (i )),
219- xml .td (getval (v )),
220- }
221- )
214+ for i , v in ipairs (tbl ) do
215+ coroutine.yield (
216+ xml .tr {
217+ xml .td (tostring (i )),
218+ xml .td (getval (v )),
219+ }
220+ )
222221
223- tbl [i ] = nil
224- end
222+ tbl [i ] = nil
223+ end
225224
226- for k , v in pairs (tbl ) do
227- coroutine.yield (
228- xml .tr {
229- xml .td (tostring (k )),
230- xml .td (getval (v )),
231- }
232- )
225+ for k , v in pairs (tbl ) do
226+ coroutine.yield (
227+ xml .tr {
228+ xml .td (tostring (k )),
229+ xml .td (getval (v )),
230+ }
231+ )
232+ end
233233 end
234- end
235- }
236- --- @diagnostic enable : undefined-global
234+ }
235+ end )
237236end
238237
239238--- @alias OptionalStringCollection string | string[]
0 commit comments