Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Matroc/Misc
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} function p.reverse( frame ) astring = frame.args[1] or "" return astring:reverse() end 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 astring end function 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 astring end function p.getname(frame) local name=mw.wikibase.getEntityIdForTitle(frame.args[1]) if name == "" or name == nil then return "" end return name end 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,'.*\{\{DISPLAYTITLE:') == 1 then data = string.gsub(data,'.*\{\{DISPLAYTITLE:',"",1) data = string.gsub(data,'\}\}.*','',1) data = string.gsub(data,'\|.*','') -- incase | noerror or |noreplace else data = "No Display Title" end return data end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/Matroc/Misc/doc
(
edit
)