Content deleted Content added
new optional feature for New Caledonia national football team 1980–99 results (only works if supported by style) |
fix text color in dark mode; this generally works but may cause problems, in which case revert or try specifying a different CSS value |
||
(27 intermediate revisions by 7 users not shown) | |||
Line 2:
-- See documentation for details
require('
local p = {}
Line 19:
local team_list = {}
local jj, jjj
local table_anchor = mw.ustring.gsub(Args['section'] and 'sports-table-' .. Args['section'] or '', ' ', '_')
-- Exit early if we are using section transclusion for a different section
if( tsection ~= '' and bsection ~= '' ) then
return ''▼
if( tsection ~= bsection ) then
▲ return ''
end▼
end
local templatestyles = frame:extensionTag{
name = 'templatestyles', args = { src = 'Module:Sports table/styles.css' }
}
-- Edit links if requested
local baselink = frame:getParent():getTitle()
if
if mw.title.getCurrentTitle().fullText == baselink then baselink = '' end
or ''
Line 65 ⟶ 73:
-- Show all stats in table or just matches played and points
local full_table = true
local hide_results = yesno(Args['hide_results'] or 'no')
local hide_footer = yesno(Args['hide_footer'] or 'no')
local pld_pts_val = string.lower(Args['only_pld_pts'] or 'no')
local show_class_rules = yesno(Args['show_class_rules'] or 'yes') and true or false
Line 101 ⟶ 111:
-- Alternative syntax for team list
if Args['team_order'] and Args['team_order'] ~= '' then
local team_order_offset = (tonumber(Args['team_order_start']) or 1) - 1
local tlist = mw.text.split(Args['team_order'], '%s*[;,]%s*')
for k, tname in ipairs(tlist) do
if tname ~= '' then
Args['team' .. (k + team_order_offset)] = tname
end
end
Line 152 ⟶ 163:
local VTE_text = ''
if (template_name ~= '') then
VTE_text = require('Module:Navbar')._navbar({
template_name,
mini=1,
style='float:right',
brackets=1
})
-- remove the next part if https://en.wikipedia.org/w/index.php?oldid=832717047#Sortable_link_disables_navbar_links?
-- is ever fixed
Line 168 ⟶ 185:
Args['table_header'] = Args['table_header'] .. Args['table_header_source']
title_source = true
end
-- Add a table anchor
if table_anchor ~= '' then
table.insert(t, '<span class="anchor" id="' .. table_anchor .. '"></span>\n')
end
Line 175 ⟶ 197:
-- Add empty column header
t_return.count = t_return.count+1
table.insert(t_return.tab_text,'! scope="row" class="unsortable" style="background-color:white;color:black;border-top:white;border-bottom:white;line-width:3pt;"| \n')
-- Add rest of header
Line 218 ⟶ 240:
local new_res_ii = ii_start
-- Pre-check for existence of column
if not hide_results then
if Args[respre..'result'..ii] and Args[respre..'text_' .. Args[respre..'result'..ii]] then results_defined = true end
end
end
-- Remove results header if it is unused
Line 248 ⟶ 272:
local result_local = Args[respre..'result'..ii] or nil
local bg_col = nil
-- Get local background colour
if result_local then
bg_col = result_col[Args[respre..'col_'..result_local]] or Args[respre..'col_'..result_local] or 'inherit'
else
▲ end
end
end
if not bg_col then bg_col = 'background-color:transparent; color: inherit;' end -- Becomes default if undefined
-- Bold this line or not
Line 324 ⟶ 352:
end
end
end
-- Only add brackets/dash and bolding if it exist
if not status_let_first then
if t_status.position == 'before' then
Line 394 ⟶ 422:
-- Get background colour
bg_col = nil
if Args[respre..'result'..ii] then
bg_col = result_col[Args[respre..'col_'..result_local]] or Args[respre..'col_'..result_local] or 'inherit'
if bg_col == '
else
bg_col = 'background-color:'..bg_col..';color:black;' -- Full style tag
end
end
if not bg_col then bg_col = 'background-color:transparent; color: inherit;' end -- Becomes default if undefined
-- Check for notes
local note_res_string, note_ref, note_text = '', '', ''
Line 462 ⟶ 494:
local legs = tonumber(Args['legs']) or 1
-- Add empty cell
table.insert(t,'| style="background-color:white;color:black;border-top:white;border-bottom:white;"| \n')
-- Now include note to match results if needed
Line 519 ⟶ 551:
-- Close table
table.insert(t, '|}
-- Get info for footer
Line 531 ⟶ 563:
-- Date updating
local matches_text = Args['matches_text'] or 'match(es)'
if string.lower(update)=='complete' or hide_footer then
-- Do nothing
elseif update=='' then
Line 538 ⟶ 570:
elseif string.lower(update)=='future' then
-- Future start date
table.insert(t_footer,'First '..matches_text..' will be played
else
table.insert(t_footer,'Updated to '..matches_text..' played on '..update..'. ')
Line 549 ⟶ 581:
local stack_string = '<br>'
if footer_break and (not (string.lower(update)=='complete')) and not hide_footer then table.insert(t_footer,stack_string) end
if source ~= '' and not hide_footer then
table.insert(t_footer,'Source: '..source)
end
if class_rules and full_table and show_class_rules and not hide_footer then
if (#t_footer > 0) then table.insert(t_footer,'<br>
table.insert(t_footer,'Rules for classification: '..class_rules)
end
Line 576 ⟶ 609:
end
end
-- Now
if status_exist and not hide_footer then
if (#t_footer > 0) then table.insert(t_footer,'<br>') end
status_string =
table.insert(t_footer,status_string)
end
-- Add notes (if applicable)
if notes_exist then
if (#t_footer > 0) then table.insert(t_footer,'<br>
table.insert(t_footer,'Notes:')
-- As reflist size text
t_footer = '<div class="
t_footer = t_footer..frame:expandTemplate{ title = 'notelist', args = { group='lower-alpha'} }
else
-- As reflist size text
t_footer = '<div class="
end
Line 638 ⟶ 673:
if Args['float'] then
return frame:expandTemplate{ title = 'stack begin', args = {clear = 'true', margin = '1', float = Args['float']} }
.. templatestyles .. '\n' .. table.concat(t) .. frame:expandTemplate{ title = 'stack end'}
end
return templatestyles .. '\n' .. table.concat(t)
end
|