Module:RPG

local getArgs = require('Module:Arguments').getArgs local _rpgchars = mw.title.new( 'RPG/Characters', 'Module' ) local characters = mw.text.jsonDecode( _rpgchars:getContent ) local p = {}

function log2html( log, node ) node:attr( 'class', 'post' ) local time = node:tag('div') time:attr( 'class', 'time' ) if log.streamlinedDate then time:wikitext( os.date("%c", log.unixTimestamp) ) else time:wikitext( log.date ) end node:newline local contentContainer = node:tag('div') contentContainer:attr( 'class', 'content' ) contentContainer:newline local character = contentContainer:tag('div') character:newline local name = character:tag('div') name:attr( 'class', 'name' ) name:wikitext( log.user ) character:newline local avatar = character:tag('div') avatar:attr( 'class', 'avatar' ) avatar:wikitext( log.user ) contentContainer:newline local speech = contentContainer:tag('div') speech:attr( 'class', 'speech' ) speech:wikitext( log.content ) end

function p.hello( frame ) local args = getArgs(frame) local _rpgdata = mw.title.new( args[1], 'Module' ) local sections = mw.text.jsonDecode( _rpgdata:getContent ) local posts = mw.html.create( 'div' ) for k,v in pairs(sections) do posts:wikitext( '== ' .. v.sectionName .. ' ==' ) posts:newline local node = posts:tag('div') for k2,v2 in pairs(v.posts) do			local node = posts:tag('div') log2html(v,node) posts:newline end posts:newline end return tostring(posts) end

return p