Module:TestStorylet

From Fallen London Wiki

Documentation for this module may be created at Module:TestStorylet/doc

local p = {}
function p.main(frame)
    for name, value in pairs(frame.args or frame:getParent().args) do
        _G[name] = value
    end
    local table = [[
{|class=article-table style="display:inline-block"
| <span class="mw-customtoggle-results wikia-menu-button"> <span style="background-color:red"> Spoiler </span> Show results </span>
| Challenge difficulty || Unlocked with || Locked with
|-]]
    if _G["Option1"] then
        local o = string.format('{{:%s|transcludesection=', _G.Option1)
        table = table .. string.format('\n!%sImage}} [[%s]]', o, _G.Option1)
        table = table .. string.format('\n|%sChallenge}}', o)
        table = table .. string.format('\n|%sUnlocked}}', o)
        table = table .. string.format('\n|%sLocked}}\n', o)
        table = table .. string.format([[
|-
|colspan=4|
{|class="article-table mw-collapsible mw-collapsed" id=mw-customcollapsible-results style="margin: 0px;"
!Success !! Failure
|-style="vertical-align: top"
|{{User:Achris/Template:ReplaceMe|%s|Success}}
|{{User:Achris/Template:ReplaceMe|%s|Failure}}
|}
|-]], _G.Option1, _G.Option1)
    end
    if _G["Option2"] then
        local o = string.format('{{:%s|transcludesection=', _G.Option2)
        table = table .. string.format('\n!%sImage}} [[%s]]', o, _G.Option2)
        table = table .. string.format('\n|%sChallenge}}', o)
        table = table .. string.format('\n|{{User:Achris/Template:WrapMe|%sUnlocked}}}}', o)
        table = table .. string.format('\n|%sLocked}}\n', o)
        table = table .. string.format([[
|-
|colspan=4|
{|class="article-table mw-collapsible mw-collapsed" id=mw-customcollapsible-results style="margin: 0px;"
!Success !! Failure
|-style="vertical-align: top"
|{{User:Achris/Template:ReplaceMe|%s|Success}}
|{{User:Achris/Template:ReplaceMe|%s|Failure}}
|}
|-]], _G.Option2, _G.Option2)
    end
    table = table .. '\n|}'
    table = frame:preprocess(table)
    return table
end
return p