local p =
local infobox = require('Module:Infobox').infoboxlocal infobox_image = require('Module:InfoboxImage').InfoboxImagelocal br = require('Module:Separated entries').br
-- Add a book or category in the order it should appear in the infobox.-- The first element of each section is the section name.local books =
local function generate_arms(arms) --This function generates small coat of arms icons return infobox_imageend
function p.main(frame) -- The main function cleans up and formats all the arguments before -- passing them to the Infobox module. local original_arguments = frame.args -- arguments passed to this module local infobox_arguments = -- arguments given to the Infobox module ------ -- above (arms+name) ------ local above -- name local honorific_prefix = "" local honorific_suffix = "" if original_arguments.honorific_prefix and original_arguments.honorific_prefix ~= "" then honorific_prefix = mw.html.create('span') honorific_prefix:css('font-size', '80%') :css('font-weight', 'normal') :wikitext(original_arguments.honorific_prefix) end if original_arguments.honorific_suffix and original_arguments.honorific_suffix ~= "" then honorific_suffix = mw.html.create('span') honorific_suffix:css('font-size', '80%') :css('font-weight', 'normal') :wikitext(original_arguments.honorific_suffix) end local name = br
-- arms -- more than 2 arms if original_arguments['arms3'] then above = mw.html.create('div') local coats_of_arms = above:tag('div') coats_of_arms:css('text-align', 'justify') :css('text-justify', 'distribute-all-lines') :css('margin-bottom', '-1em') for i=1,5 do local arms if i ~= 1 then arms = original_arguments['arms' .. tostring(i)] elseif original_arguments['arms1'] then arms = original_arguments['arms' .. tostring(1)] else arms = original_arguments['arms'] end if arms then coats_of_arms:wikitext(generate_arms(arms)) coats_of_arms:wikitext(" ") end end coats_of_arms:tag('span') :css('display', 'inline-block') :css('width', '100%') :css('height', '0') above:wikitext(name) -- 1 or 2 arms elseif original_arguments['arms'] or original_arguments['arms1'] then above = mw.html.create('table') above:css('width', '100%') above_row = above:tag('tr') local arms1, arms2 if original_arguments['arms1'] then arms1 = original_arguments['arms1'] else arms1 = original_arguments['arms'] end if original_arguments['arms2'] then arms2 = original_arguments['arms2'] else arms2 = arms1 end above_row:tag('td') :css('vertical-align', 'top') :css('text-align', 'left') :css('width', '50px') :wikitext(generate_arms(arms1)) above_row:tag('td') :css('vertical-align', 'middle') :css('text-align', 'center') :css('padding-bottom', '5px') :wikitext(name) above_row:tag('td') :css('vertical-align', 'top') :css('text-align', 'right') :css('width', '50px') :wikitext(generate_arms(arms2)) -- no arms else above = name end infobox_arguments.above = tostring(above) ------ -- image, caption and copyright ------ infobox_arguments.image = infobox_image infobox_arguments.headerstyle = "background-color:#f8e9d0;border:none;" return infobox(infobox_arguments)end
return p