Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/isaacl/ExpandPageAbbreviation
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!
-- For unit tests, see [[Module:Sandbox/isaacl/ExpandPageAbbreviation/tests]] local me = { outputForAbbr = { } } local config -- if mw.loadData() not supported, use require() instead if mw.loadData then config = mw.loadData('Module:Sandbox/isaacl/ExpandPageAbbreviation/data') else config = require('Module:Sandbox/isaacl/ExpandPageAbbreviation/data') end me.phraseForAbbr = config.phraseForAbbr function me._expand(abbr) if me.outputForAbbr[abbr] ~= nil then return me.outputForAbbr[abbr] else local outputString if me.phraseForAbbr[abbr] == nil then outputString = string.format("[[%s]]", abbr) me.outputForAbbr[abbr] = outputString else me.outputForAbbr[abbr] = string.format("[[%s|%s]]", abbr, me.phraseForAbbr[abbr]) outputString = string.format("%s (%s)", me.outputForAbbr[abbr], abbr) end return outputString end end -- function _expand() function me.expand(frame) local abbr = frame.args[1] return me._expand(abbr) end return me
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/isaacl/ExpandPageAbbreviation/doc
(
edit
)