Module:DailyFeatured: Difference between revisions
No edit summary |
No edit summary |
||
| Line 115: | Line 115: | ||
end | end | ||
local linkedFile = value:match("%[%[%s*[Ff]ile%s*:%s*([^|%]]+)") | local linkedFile = | ||
value:match("%[%[%s*[Ff]ile%s*:%s*([^|%]]+)") | |||
or value:match("%[%[%s*[Ii]mage%s*:%s*([^|%]]+)") | or value:match("%[%[%s*[Ii]mage%s*:%s*([^|%]]+)") | ||
| Line 148: | Line 149: | ||
for line in mw.text.gsplit(wikitext, "\n", true) do | for line in mw.text.gsplit(wikitext, "\n", true) do | ||
local value = line:match("^%s*|%s*image%d*%s*=%s*(.-)%s*$") | local value = | ||
line:match("^%s*|%s*image%d*%s*=%s*(.-)%s*$") | |||
or line:match("^%s*|%s*photo%d*%s*=%s*(.-)%s*$") | |||
or line:match("^%s*|%s*portrait%d*%s*=%s*(.-)%s*$") | |||
or line:match("^%s*|%s*logo%d*%s*=%s*(.-)%s*$") | or line:match("^%s*|%s*logo%d*%s*=%s*(.-)%s*$") | ||
or line:match("^%s*|%s*flag%d*%s*=%s*(.-)%s*$") | or line:match("^%s*|%s*flag%d*%s*=%s*(.-)%s*$") | ||
or line:match("^%s*|%s*emblem%d*%s*=%s*(.-)%s*$") | |||
if value then | if value then | ||
| Line 161: | Line 166: | ||
end | end | ||
local fallback = wikitext:match("%[%[%s*[Ff]ile%s*:%s*([^|%]]+)") | local fallback = | ||
wikitext:match("%[%[%s*[Ff]ile%s*:%s*([^|%]]+)") | |||
or wikitext:match("%[%[%s*[Ii]mage%s*:%s*([^|%]]+)") | or wikitext:match("%[%[%s*[Ii]mage%s*:%s*([^|%]]+)") | ||
| Line 201: | Line 207: | ||
image = image | image = image | ||
} | } | ||
end | |||
local function makeImageBlock(data) | |||
if not data.image then | |||
return "" | |||
end | |||
return | |||
'<div style="float:right; width:105px; margin:0 0 0.5em 0.75em; padding:4px; border:1px solid #a2a9b1; background:#f8f9fa; border-radius:6px; text-align:center;">' .. | |||
'[[' .. data.image .. '|frameless|100x100px|link=' .. data.title .. '|' .. data.title .. ']]' .. | |||
'</div>' | |||
end | end | ||
| Line 219: | Line 236: | ||
end | end | ||
local imageBlock = | local imageBlock = makeImageBlock(data) | ||
return | return | ||
| Line 247: | Line 257: | ||
end | end | ||
local imageBlock = | local imageBlock = makeImageBlock(data) | ||
return | return | ||