Module:Template test case: Difference between revisions

    (fix truthiness bug in Template:getFullPage)
    (Tweak Template:getInvocation to not escape things so enthusiastically. Still need to make HTML entities show up properly.)
    Line 105: Line 105:
    function Template:getInvocation(format)
    function Template:getInvocation(format)
    local invocation = self._invocation:getInvocation(self:getName())
    local invocation = self._invocation:getInvocation(self:getName())
    invocation = mw.text.nowiki(invocation)
    if format == 'code' then
    if format == 'code' then
    invocation = '<code>' .. invocation .. '</code>'
    invocation = '<code>' .. mw.text.nowiki(invocation) .. '</code>'
    elseif format ~= 'plain' then
    elseif format == 'plain' then
    invocation = mw.text.nowiki(invocation)
    else
    -- Default is pre tags
    -- Default is pre tags
    -- @TODO: Make HTML entities show up properly.
    invocation = '<pre style="white-space: pre-wrap;">' .. invocation .. '</pre>'
    invocation = '<pre style="white-space: pre-wrap;">' .. invocation .. '</pre>'
    invocation = mw.getCurrentFrame():preprocess(invocation)
    invocation = mw.getCurrentFrame():preprocess(invocation)