Home
Random
Log in
Settings
About RuneScape: Dragonwilds Wiki
Disclaimers
Search
Editing
Module:Infobox Deity
Warning:
You are not logged in. Once you make an edit, a temporary account will be created for you.
Learn more
.
Log in
or
create an account
to continue receiving notifications after this account expires, and to access other features.
Anti-spam check. Do
not
fill this in!
-------------------------- -- Module for [[Template:Infobox Deity]] ------------------------ local p = {} local InfoboxBuilder = require('Module:InfoboxBuilder') local onmain = require('Module:Mainonly').on_main function p.main(frame) local args = frame:getParent().args -- 1. Determine versions local versions = {} local i = 1 while args['name' .. i] or args['version' .. i] or args['symbol' .. i] do table.insert(versions, i) i = i + 1 end if #versions == 0 then versions = { '' } end local buildParams = #versions > 1 and 2 or 0 local cssStyle = 'float: left; clear: left; margin-right: 1em; margin-left: 0;' local builder = InfoboxBuilder(buildParams, cssStyle) builder:addClass('infobox-deity left-info') local wrapper = builder if #versions > 1 then wrapper = builder:tabber() end -- 4. Build Content for _, v in ipairs(versions) do local suffix = (v ~= '' and v) or '' local function getArg(param) return args[param .. suffix] or args[param] end local section = wrapper if #versions > 1 then local tabName = args['version' .. suffix] or ('Version ' .. suffix) section = wrapper:tab(tabName) end -- PARAMETER: name (Header) local name = getArg('name') if name then section:header(name) end -- PARAMETER: symbol section:row({ label = 'Symbol', value = getArg('symbol') }) -- PARAMETER: alignment section:row({ label = 'Alignment', value = getArg('alignment') }) -- PARAMETER: ascension section:row({ label = 'Ascended by', value = getArg('ascension') }) -- PARAMETER: godhood section:row({ label = 'Godhood', value = getArg('godhood') }) -- PARAMETER: avatars section:row({ label = 'Avatars and<br />aspects', value = getArg('avatars') }) -- PARAMETER: animal section:row({ label = 'Animal aspect', value = getArg('animal') }) -- PARAMETER: colours section:row({ label = 'Colours', value = getArg('colours') }) -- PARAMETER: adjective section:row({ label = 'Adjective', value = getArg('adjective') }) end -- 5. Categories if onmain() then builder:wikitext(addcategories(args)) end return tostring(builder) .. '<div style="clear:left;"></div>' end function addcategories(args) local ret = {} -- Configuration for category mapping local cat_map = { -- Added if the parameter has content defined = { }, -- Added if the parameter has no content notdefined = { }, } -- Helper to check if a specific param is defined in args local function is_defined(param) return args[param] and args[param] ~= '' end -- Process 'defined' map for param, cat in pairs(cat_map.defined) do if is_defined(param) then table.insert(ret, cat) end end -- Process 'notdefined' map for param, cat in pairs(cat_map.notdefined) do if not is_defined(param) then table.insert(ret, cat) end end -- Format wikicode for i, v in ipairs(ret) do if (v ~= '') then ret[i] = string.format('[[Category:%s]]', v) end end return table.concat(ret, '') end return p
Summary:
Please note that all contributions to RuneScape: Dragonwilds Wiki are considered to be released under the CC BY-NC-SA 3.0 (see
Dragonwilds:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, 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.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Pages included on this page:
Template:Clear
(
edit
)
Template:DependencyList
(
edit
)
Template:DependencyList/doc
(
edit
)
Template:Documentation
(
edit
)
Template:Infobox Deity
(
edit
)
Template:Infobox Deity/doc
(
edit
)
Template:No documentation
(
edit
)
Template:PageType
(
edit
)
Module:Array
(
edit
)
Module:DPLlua
(
edit
)
Module:DependencyList
(
edit
)
Module:Documentation
(
edit
)
Module:InfoboxBuilder
(
edit
)
Module:Infobox Deity/doc
(
edit
)
Module:Mainonly
(
edit
)
Module:Paramtest
(
edit
)
Module:Tooltip
(
edit
)
Module:User error
(
edit
)
Module:Yesno
(
edit
)
This page is a member of 2 hidden categories:
Category:Pages using DynamicPageList4 parser function
Category:Pages using DynamicPageList4