Module:Sandbox/Matroc/Misc Explained

local p = function p.reverse(frame) astring = frame.args[1] or "" return astring:reverseend

function p.padleft(frame) astring = frame.args[1] or "" char = frame.args[2] or "." len = frame.args[3] or #astring astring = astring .. string.rep(char, len - #astring) return astringendfunction p.padright(frame) astring = frame.args[1] or "" char = frame.args[2] or "." len = frame.args[3] or #astring astring = string.rep(char, len - #astring) .. astring return astring end function p.trimleft (frame) astring = frame.args[1] or "" astring = astring:match'^%s*(.*)' return astring end function p.trimright (frame) astring = frame.args[1] or "" astring = astring:match'^(.*%S)' return astring end function p.trimboth (frame) astring = frame.args[1] or "" astring = astring:match'^%s*(.*%S)' return astringendfunction p.getname(frame) local name=mw.wikibase.getEntityIdForTitle(frame.args[1]) if name

"" or name

nil then return "" end return nameend

function p.getdisplay(frame) local page=frame.args['page']

local title = mw.title.new(page) if title

nil then return end

if title.id

0 then return "Page does not exist!" end

local data = title:getContent

if string.find(data,'.*\