Modul:HOWTO
Die Dokumentation für dieses Modul kann unter Modul:HOWTO/Doku erstellt werden
local p = {}; function split(s, delimiter) result = {}; for match in (s..delimiter):gmatch("(.-)"..delimiter) do table.insert(result, match); end return result; end function tablelength(T) local count = 0 for _ in pairs(T) do count = count + 1 end return count end p.howto = function( frame ) local argv = split( frame.args[1], '@' ) local howtoHtml = "" local max = tablelength(argv) - 1 local c = 1 for i = 1, max, 2 do howtoHtml = howtoHtml .. "<h4 class='howto-n'>" .. argv[i] .. "</h4>" howtoHtml = howtoHtml .. "<p class='howto-t'>" .. argv[i + 1] .. "</p>" c = c + 1 end return howtoHtml end p.howtoSchema = function( frame ) local howtoData = '[' local argv = split( frame.args[1], '@' ) local max = tablelength(argv) - 1 for i = 1, max, 2 do howtoData = howtoData .. "{" howtoData = howtoData .. '"name": "' .. argv[i] .. '",' howtoData = howtoData .. '"text": "' .. argv[i + 1] .. '"' -- local url1 = argv[i + 2] -- howtoData = howtoData .. '"bild": "' .. url1 .. '",' -- local url2 = argv[i + 3] -- howtoData = howtoData .. '"url": "' .. url2 .. '"' howtoData = howtoData .. "}" if i < max then howtoData = howtoData .. ',' end end howtoData = howtoData .. "]" return howtoData end return p