Module:Calendar widget: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 258:
local col_span = (props.iso_wk and 8) or 7; -- assume no prev/next
 
if not props.show_yearhide_year then
hdr_year = get_display_year (props); -- if to be shown, add wikilink, etc when required
end
Line 351:
end
return repeat_tags ('td', td_items, options)
end
 
 
--[[--------------------------< G E T _ Y E A R _ H E A D E R >------------------------------------------------
 
 
]]
 
local function get_year_header (props)
local cols = props.cols or 4 -- TODO: move this to initializaion
 
if not props.hide_year then
local header = mw.html.create('tr');
header:tag ('tr')
:addClass ('ycalhdr')
:tag ('th')
:addClass ('ycal')
:attr ('colspan', cols)
:wikitext (props.title or props.year);
return tostring (header)
end
return '';
end
 
Line 376 ⟶ 399:
:addClass ('ycal' .. (props.y_float_r and ' floatright' or '')) -- float table right; leading space required to separate classes
:css (props.y_center and {['clear'] = 'both', ['margin-left'] = 'auto', ['margin-right'] = 'auto'} or {}) -- centers table; TODO: add to styles.css?
:wikitext (get_year_header(props)); -- get year header if not hidden
:tag ('tr')
:addClass ('ycalhdr')
:tag ('th')
:addClass ('ycal')
:attr ('colspan', cols)
:wikitext (props.title or year)
:done() -- close <th>
:done() -- close <tr>
 
for row_num = 1, rows do
Line 403 ⟶ 419:
local function _calendar (props)
if props.month_num then
props.show_year = true; -- show year in individual month calendars
return display_month (props.month_num, props);
else
Line 452 ⟶ 467:
cal_props.title = args.title; -- year calendar title
cal_props.hide_year = ('yes' == args.hide_year) or ('off' == args.show_year); -- year normally displayed; this hides year display
 
if args.month then