Module:MercuryQuote

--| MercuryQuote (v0.9.0) --- Fixes occassional incorrect rendering of quote templates (or templates --- designated as "quote" through template type) in the mercury mobile skin. --- This should be used in place of the desired quote template invocation. --by author: The JoTS

--

local templ, qtei, srci = "Quote", 1, 2 local zerowidth = "&shy;"

function modifyStr(frame) local args = frame.args local qte, src = args[qtei], args[srci] local nqte, nsrc = #qte, #src local templArgs = {} -- Make quotation fix for mercury if nqte < nsrc then qte = qte .. frame:preprocess(zerowidth:rep(nsrc - nqte)) end -- Copy arguments into template invocation for i,v in pairs(args) do templArgs[i] = v end templArgs[qtei] = qte return frame:expandTemplate{ title = templ, args = templArgs } end

return setmetatable({   main = function(frame)        return modifyStr(frame, true)    end,    -- Aliases --    ["-->"] = function(frame)        -- Particularly useful for any casual editors who may be confused        -- by the seemingly out of place "main". This indicates "ignore this."        return modfiyStr(frame, true)    end }, {    __call = function(t, templ, q, s)        templ, qtei, srci = templName, q, s        return t    end })