Module:Room features: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
mNo edit summary
(Add text and category when there are no features)
Line 35: Line 35:
function p._main(args)
function p._main(args)
local frame = mw.getCurrentFrame()
local frame = mw.getCurrentFrame()
local ret = {}
local ret = mw.html.create()
local location = args[1] or mw.title.getCurrentTitle().fullText
local location = args[1] or mw.title.getCurrentTitle().fullText


Line 53: Line 53:
for cat,results in pairs(results_by_type) do
for cat,results in pairs(results_by_type) do
if #results > 0 then
if #results > 0 then
ret
table.insert(ret, tostring(mw.html.create('h3'):wikitext(header_text_override[cat] or cat)))
:tag('h3'):wikitext(header_text_override[cat] or cat):done()


local gallery_lines = {}
local gallery_lines = {}
Line 72: Line 73:
end
end


table.insert(ret, tostring(frame:extensionTag{ name = 'gallery', content = table.concat(gallery_lines, '\n'), args = {} }))
ret:node(frame:extensionTag{ name = 'gallery', content = table.concat(gallery_lines, '\n'), args = {} })
end
end
end
end
else
ret:tag('dd')
:wikitext("''No room features found''[[Category:Empty room features]] ")
:wikitext(require('Module:Purge')._purge{ anchor = 'roomfeatures_purge', text = '(refresh)' })
:done()
end
end

return table.concat(ret, '')
return ret
end
end