Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Dovid/Ezref
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!
--Simplify reference markup | Temp test at User:Dovid/sandbox/test | Used by template User:Dovid/sandbox/Ezref local ez = {}, paramlist local notes , opsLeft , opsRight, dbgLeft , dbgRight = "" , "<" , ">" , "?" , "!" local tagLeft , tagRight = opsLeft , opsRight -- dbgLeft , dbgRight function errNoName(suffix) suffix = (suffix or '') -- .. (notes == '' ? '' : '' .. notes) if paramlist ~= nil then for i,j in pairs(paramlist) do suffix = suffix .. " | " .. i .. '=' .. j end else suffix = suffix .. ' [args not accessible for this run]' end return 'Error: no ref name/1 parameter (' .. suffix .. ').' end function ez.ref(frame) -- local args=frame.getParent(frame).args if not frame then return errNoName('f') end local parent = frame.getParent(frame) if not parent then return errNoName('p') end local args = frame.args paramlist = args --global, for debugging if not args then return errNoName('a') end local refname = args['name'] or args[1] if not refname then return errNoName('n') end -- notes = '1=' .. (frame.args[1] ? frame.args[1] ? 'nil') .. '; name=' .. (frame.args['name'] ? frame.args['name'] : 'nil') local content = (args['text'] or args[2]) or "" if content == '' then return tagLeft .. 'ref name="' .. refname .. '"/' ..tagRight else return tagLeft .. 'ref name="' .. refname .. '"' .. tagRight .. content .. tagLeft .. '/ref' .. tagRight end end return ez
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/Dovid/Ezref/doc
(
edit
)