Module:Sports series: Difference between revisions

Content deleted Content added
m clearer parameter name
allow for simplified anchor links
Line 200:
:css('margin-bottom', '0.5em')
:wikitext("Legend: Blue = home team win; Yellow = draw; Red = away team win.")
end
 
-- Function to rewrite anchor links of match scores
local function rewriteAnchorLinks(text, baselink)
if not text then
return text
end
return text:gsub('(%[%[)(#[^%[%]]*%|)', '%1' .. baselink .. '%2')
end
 
Line 221 ⟶ 229:
local noFlagIcons = false
local fillBlanks = args.fill_blanks and (args.fill_blanks == 'y' or args.fill_blanks == 'yes' or args.fill_blanks == '1' or args.fill_blanks == 'true')
local baselink = frame:getParent():getTitle()
if mw.title.getCurrentTitle().text == baselink then baselink = '' end
 
-- Process the font size parameter
Line 417 ⟶ 427:
-- Clean the aggregate score
local cleanAggregate = cleanScore(aggregateScore)
-- Rewrite anchor links
if baselink ~= '' then
aggregateScore = rewriteAnchorLinks(aggregateScore, baselink)
end
-- Name the 1st/2nd leg scores for two-legged ties for possibly determining the winner on away goals
if legs == 2 then
Line 476 ⟶ 490:
-- Clean the aggregate score
local cleanAggregate = cleanScore(aggregateScore)
-- Rewrite anchor links
if baselink ~= '' then
aggregateScore = rewriteAnchorLinks(aggregateScore, baselink)
end
-- Name the 1st/2nd leg scores for two-legged ties for possibly determining the winner on away goals
if legs == 2 then
Line 530 ⟶ 548:
local legScore = args[legIndex]
if legScore ~= "null" then
if baselink ~= '' then
legScore = rewriteAnchorLinks(legScore, baselink)
end
row:tag('td'):css('text-align', 'center'):wikitext(legScore)
end