Project Rebearth
Menu
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Search
What links here
Related changes
Page information
Recent changes
Help
Not logged in
Talk
Contributions
Create account
Log in
Actions
Module
Discussion
Edit
View history
Module
Editing
Chain
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.render(frame) local args = frame.args local parent = frame:getParent() local pargs = parent and parent.args or {} local items = {} for i = 1, 15 do local val = args[i] or pargs[i] if val then val = mw.text.trim(val) if val ~= '' then items[#items + 1] = val end end end if #items < 1 then return '' end local title = mw.text.trim(args.title or pargs.title or '') local direction = mw.text.trim(args.direction or pargs.direction or ''):lower() local isVertical = (direction == 'vertical') local root = mw.html.create('div'):addClass('rb-chain') if isVertical then root:addClass('rb-chain-vertical') end if title ~= '' then root:tag('div') :addClass('rb-chain-title') :wikitext(title) end for i, name in ipairs(items) do if i > 1 then root:tag('div') :addClass('rb-chain-arrow') :wikitext('→') end local isResource = (i % 2 == 1) local parts = isResource and mw.text.split(name, '+') or nil if parts and #parts > 1 then local group = root:tag('div'):addClass('rb-chain-group') for _, part in ipairs(parts) do group:tag('div') :addClass('rb-chain-step') :addClass('rb-chain-resource') :wikitext(frame:expandTemplate{ title = 'Icon', args = { mw.text.trim(part) } }) end else local step = root:tag('div') :addClass('rb-chain-step') :addClass(isResource and 'rb-chain-resource' or 'rb-chain-building') local label = isResource and frame:expandTemplate{ title = 'Icon', args = { name } } or '[[' .. name .. ']]' step:wikitext(label) end end return tostring(root) end return p
Summary:
Please note that all contributions to Project Rebearth 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
Project Rebearth:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Page included on this page:
Module:Chain/doc
(
edit
)