Modul:ChapterTabs
Aus Zweidat
Die Dokumentation für dieses Modul kann unter Modul:ChapterTabs/Doku erstellt werden
-- Module for creating TabberNeue structure from SMW query local p = {} -- Main function to generate tabs function p.generateTabs(frame) local content = mw.html.create('div') :addClass('tabber-module') :wikitext('<tabber>\n') -- Get the SMW query results for books local query = mw.smw.ask('[[Category:Buch]]|?BuchSortierung') if not query then return "No results found" end -- Generate tabs for each book for _, result in ipairs(query) do -- Get the page name from the first element local pageName = result[1] -- Escape any equal signs in the page name local safePageName = string.gsub(pageName, "=", "=") -- Add tab content content:wikitext(safePageName .. '=' .. pageName .. '\n|-|\n') end -- Add closing tag content:wikitext('</tabber>') -- Return the complete HTML structure return tostring(content) end return p