Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Enumerate
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!
-- Enumerates a given parameter set from the invoking template as a bullet list. local getArgs = require('Module:Arguments').getArgs local yesno = require("Module:Yesno") local p = {} function p.main(frame) local args = getArgs(frame, { frameOnly = true, trim = true }) return p._main(frame, args) end function startswith(target, prefix) return mw.ustring.sub(target, 1, mw.ustring.len(prefix)) == prefix end function endswith(target, suffix) return mw.ustring.sub(target, -mw.ustring.len(suffix), -1) == suffix end function p._main(frame, args) local prefix = args[1] or args["prefix"] or "" local suffix = args[2] or args["suffix"] or "" local parentArgs = frame:getParent() and getArgs(frame:getParent(), { trim = true }) or args local finalOutput = "" local list = mw.html.create(yesno(args["ordered"]) and "ol" or "ul") local current = 1 local searching = true while searching do local arg = (prefix == "" and suffix == "") and current or prefix .. tostring(current) .. suffix if parentArgs[arg] then list:node( mw.html.create("li") :wikitext((args["pre"] or "") .. parentArgs[arg] .. (args["post"] or "")) ) current = current + 1 else searching = false end end return current == 1 and "" or tostring(list) 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)
Templates used on this page:
Template:Module other
(
edit
)
Template:Module rating
(
edit
)
Template:Ombox
(
edit
)
Template:T
(
edit
)
Module:Arguments
(
edit
)
Module:Enumerate
(
edit
)
Module:Enumerate/doc
(
edit
)
Module:Enumerate/doc/demo
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:Yesno
(
edit
)