Module:MercuryQuote

-- MercuryQuote (v0.9.7) -- local templName, qtei, srci = "Quote", 1, 2 local ZEROWIDTH, ARGSEP = "&shy;", "|" --- Designed to "re-generate" arguments for a template invocation. --- Parse order does not allow this to work as intended. 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 table.concat(templArgs, ARGSEP) end --- Merely bypasses Mercury's conversions outright. function mercuryBypass(frame) local templArgs = {} -- Copy arguments into template invocation for i,v in pairs(frame.args) do templArgs[i] = v end return frame:expandTemplate{title = templName, args = templArgs} end return setmetatable({hack = function(frame) return modifyStr(frame) end,      main = function(frame) return mercuryBypass(frame) end,}, {         __call = function(t, templ, q, s) templName = templ           qtei = q or qtei srci = s or srci return t end });