Module:Infobox maker/doc
From A Wiki of Ice and Fire
This is the documentation page for Module:Infobox maker
This module is there to help create Infoboxes using Lua syntax instead of Wiki markup.
- Copy this to start a new infobox
local getArgs = require('Module:Arguments').getArgs
local ib = require('Module:Infobox maker')
-- Potentially useful:
-- local infobox_image = require('Module:InfoboxImage').InfoboxImage
-- local br = require('Module:Separated entries').br
-- local date = require('Module:Date').main
local function is_empty(s)
-- This function checks whether a string is empty
return s == nil or s == ''
end
local p = {}
function p.main(frame)
-- The main function cleans up and formats all the arguments before
-- passing them to the Infobox module.
local args = getArgs(frame) -- arguments passed to this module. this contains all the template {{{parameters}}}
ib.initialize(args)
--- General styling
ib.add_classes{
bodyclass = "",
titleclass = "",
aboveclass = "",
imageclass = "",
belowclass = "",
}
ib.add_styles{
bodystyle = "",
titlestyle = "",
abovestyle = "",
imagestyle = "",
captionstyle = "",
headerstyle = "",
labelstyle = "",
datastyle = "",
belowstyle = "",
}
ib.add_title{
title = "",
}
ib.add_above{
above = "",
}
ib.add_subheader{ -- use as often as necessary
subheader = "",
subheaderrowclass = "",
subheaderclass = "",
}
ib.add_image{ -- use as often as necessary
image = "",
size = "",
maxsize = "",
sizedefault = "",
alt = "",
border = "", -- yes/no
suppressplaceholder = "", -- yes/no
caption = "",
}
ib.add_below{
below = "",
}
-----
-- Main content
-----
ib.add_header{ -- adds a single header row
header = "",
rowstyle = "",
rowclass = "",
}
ib.add_row{ -- adds a single data row with optional label
label = "",
data = "",
rowstyle = "",
rowclass = "",
class = "",
}
ib.add_row_list{ -- adds a single row whose data is a list
singular = "", -- singular label
plural = "", -- plural label
prefix = '', -- name of the parameter, without number
rowstyle = "",
rowclass = "",
class = "",
}
ib.add_section{ -- adds a section with a header that appears only if a data row is not empty
header = "",
rowstyle = "", -- header's style
rowclass = "", -- header's class
rows = { -- add rows, list rows and headers in the order in which they should appear
{
rowtype = 'row',
label = "",
data = "",
rowstyle = "",
rowclass = "",
class = "",
},
{
rowtype = 'list',
singular = "",
plural = "",
prefix = '',
rowstyle = "",
rowclass = "",
class = "",
},
{
rowtype = 'header',
header = "",
rowstyle = "",
rowclass = "",
},
}
}
--- Categories
ib.add_category{ -- use as often as necessary
name = "",
key = "",
}
return ib.make_infobox()
end
return p