https://mw-live.lojban.org/index.php?title=Module:Side_box&feed=atom&action=history
Module:Side box - Revision history
2024-03-28T21:59:16Z
Revision history for this page on the wiki
MediaWiki 1.38.4
https://mw-live.lojban.org/index.php?title=Module:Side_box&diff=98069&oldid=prev
Gleki at 14:24, 26 June 2014
2014-06-26T14:24:20Z
<p></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 14:24, 26 June 2014</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>-- This module implements {{<del style="font-weight: bold; text-decoration: none;">side </del>box}}.</div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>-- This module implements {{<ins style="font-weight: bold; text-decoration: none;">Side </ins>box}}.</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local yesno = require('Module:Yesno')</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>local yesno = require('Module:Yesno')</div></td></tr>
<!-- diff cache key mediawiki:diff::1.12:old-97970:rev-98069 -->
</table>
Gleki
https://mw-live.lojban.org/index.php?title=Module:Side_box&diff=97970&oldid=prev
Gleki: 1 revision
2014-06-26T08:06:19Z
<p>1 revision</p>
<p><b>New page</b></p><div>-- This module implements {{side box}}.<br />
<br />
local yesno = require('Module:Yesno')<br />
<br />
local p = {}<br />
<br />
function p.main(frame)<br />
local origArgs = frame:getParent().args<br />
local args = {}<br />
for k, v in pairs(origArgs) do<br />
v = v:match('%s*(.-)%s*$')<br />
if v ~= '' then<br />
args[k] = v<br />
end<br />
end<br />
return p._main(args)<br />
end<br />
<br />
function p._main(args)<br />
local data = p.makeData(args)<br />
return p.renderSidebox(data)<br />
end<br />
<br />
function p.makeData(args)<br />
local data = {}<br />
<br />
-- Main table classes<br />
data.classes = {}<br />
if yesno(args.metadata) ~= false then<br />
table.insert(data.classes, 'metadata')<br />
end<br />
if args.position and args.position:lower() == 'left' then<br />
table.insert(data.classes, 'mbox-small-left')<br />
else<br />
table.insert(data.classes, 'mbox-small')<br />
end<br />
table.insert(data.classes, args.class)<br />
<br />
-- Image<br />
if args.image and args.image ~= 'none' then<br />
data.image = args.image<br />
end<br />
<br />
-- Copy over data that doesn't need adjusting<br />
local argsToCopy = {<br />
-- Styles<br />
'style',<br />
'textstyle',<br />
<br />
-- Above row<br />
'above',<br />
'abovestyle',<br />
<br />
-- Body row<br />
'text',<br />
'imageright',<br />
<br />
-- Below row<br />
'below',<br />
}<br />
for i, key in ipairs(argsToCopy) do<br />
data[key] = args[key]<br />
end<br />
<br />
return data<br />
end<br />
<br />
function p.renderSidebox(data)<br />
-- Renders the sidebox HTML.<br />
<br />
-- Table root<br />
local root = mw.html.create('table')<br />
for i, class in ipairs(data.classes or {}) do<br />
root:addClass(class)<br />
end<br />
root:css{border = '1px solid #aaa', ['background-color'] = '#f9f9f9'}<br />
if data.style then<br />
root:cssText(data.style)<br />
end<br />
<br />
-- The "above" row<br />
if data.above then<br />
local aboveCell = root:newline():tag('tr'):tag('td')<br />
aboveCell<br />
:attr('colspan', data.imageright and 3 or 2)<br />
:addClass('mbox-text')<br />
if data.textstyle then<br />
aboveCell:cssText(data.textstyle)<br />
end<br />
if data.abovestyle then<br />
aboveCell:cssText(data.abovestyle)<br />
end<br />
aboveCell<br />
:newline()<br />
:wikitext(data.above)<br />
end<br />
<br />
-- The body row<br />
local bodyRow = root:newline():tag('tr'):newline()<br />
if data.image then<br />
bodyRow:tag('td')<br />
:addClass('mbox-image')<br />
:wikitext(data.image)<br />
else<br />
bodyRow:tag('td'):css('width', '1px')<br />
end<br />
local textCell = bodyRow:newline():tag('td')<br />
textCell:addClass('mbox-text plainlist')<br />
if data.textstyle then<br />
textCell:cssText(data.textstyle)<br />
end<br />
textCell:wikitext(data.text)<br />
if data.imageright then<br />
bodyRow:newline():tag('td')<br />
:addClass('mbox-imageright')<br />
:wikitext(data.imageright)<br />
end<br />
<br />
-- The below row<br />
if data.below then<br />
local belowCell = root:newline():tag('tr'):tag('td')<br />
belowCell<br />
:attr('colspan', data.imageright and 3 or 2)<br />
:addClass('mbox-text')<br />
if data.textstyle then<br />
belowCell:cssText(data.textstyle)<br />
end<br />
belowCell:wikitext(data.below)<br />
end<br />
<br />
return tostring(root)<br />
end<br />
<br />
return p</div>
Gleki