Dicemonger (talk | contribs) mNo edit summary |
Dicemonger (talk | contribs) mNo edit summary |
||
Line 3: | Line 3: | ||
function p.begin(frame) | function p.begin(frame) | ||
local cols = getCols(frame) | local cols = getCols(frame) | ||
return "<div style=\"column-count:" | return "<div style=\"column-count:" .. cols .. "; column-width:" .. getWidth(cols) .. "; column-gap:40px; column-rule: 2px solid #d6d6d6;\">" | ||
end | end | ||
function p.div(frame) | function p.div(frame) | ||
local cols = getCols(frame) | local cols = getCols(frame) | ||
return "</div><div style=\"column-count:" | return "</div><div style=\"column-count:" .. cols .. "; column-width:" .. getWidth(cols) .. "; column-gap:40px; column-rule: 2px solid #d6d6d6;\">" | ||
end | end | ||
Revision as of 15:15, 9 June 2023
Mark sections of text with column-count css.
Functions
begin
{{#invoke:Columns|begin|cols=2}}
This function marks the beginning of a section.
cols | The number of columns (2 to 4). Defaults to 2. |
stop
{{#invoke:Columns|stop}}
This function marks the end of a section. It has no parameters.
div
{{#invoke:Columns|div|cols=2}}
This function is basically "stop" immediately followed by "begin". This creates a break between two sections.
cols | The number of columns (2 to 4). Defaults to 2. |
local p = {}
function p.begin(frame)
local cols = getCols(frame)
return "<div style=\"column-count:" .. cols .. "; column-width:" .. getWidth(cols) .. "; column-gap:40px; column-rule: 2px solid #d6d6d6;\">"
end
function p.div(frame)
local cols = getCols(frame)
return "</div><div style=\"column-count:" .. cols .. "; column-width:" .. getWidth(cols) .. "; column-gap:40px; column-rule: 2px solid #d6d6d6;\">"
end
function p.stop(frame)
return "</div>"
end
function getCols(frame)
local cols = frame.args['cols']
if cols == nil then
return 2
end
return cols
end
function getWidth(cols)
if cols == 2 then
return "300px"
elseif cols == 3 then
return "200px"
elseif cols == 4 then
return "150px"
end
end
return p