Content deleted Content added
No edit summary |
No edit summary |
||
Line 84:
--[[--------------------------< G E T _ D I S P L A Y _ Y E A R >----------------------------------------------
and stand-alone calendars
]]
Line 95 ⟶ 93:
if props.lk_y then -- if to be linked
if props.lk_pref_y or props.lk_suff_y then -- when prefix or suffix, [[prefix .. link .. suffix|label]]
year_text = make_wikilink (props.year);▼
year_text = make_wikilink ((props.lk_pref_y or '') .. year_text .. (props.lk_suff_y or ''), year_text);
else
end
end
return year_text;
end
Line 104 ⟶ 106:
--[[--------------------------< G E T _ D I S P L A Y _ M O N T H >--------------------------------------------
returns month from
argument mnum is nil when rendering stand-alone calendar
]]
Line 112 ⟶ 116:
month_text = monthname[month_text];
if props
month_text = month_text .. ' ' .. props.year; -- composite month and year link
end
if props.lk_m or props['lk_m&y'] then
if props.lk_pref_m or props.lk_suff_m then -- when prefix or suffix, [[prefix .. link .. suffix|label]]
month_text = make_wikilink ((props.lk_pref_m or '') .. month_text .. (props.lk_suff_m or ''), month_text);
Line 132 ⟶ 140:
local function get_display_day (day_text, mnum, props)
if props.lk_d then
local link_text = (
day_text = make_wikilink (link_text, day_text);
end
Line 166 ⟶ 174:
table.insert (tags, tostring (repeat_tag)); -- make a string of this object
end
return table.concat (tags); -- concatenate them all together
end
Line 259 ⟶ 268:
local col_span = (props.iso_wk and 8) or 7; -- assume no prev/next
if not props.hide_year and props.month_num then -- props.month_num has value only for stand-alone month calendars
hdr_year = get_display_year (props); -- if to be shown, add wikilink, etc when required
end
Line 274 ⟶ 283:
end
if props['lk_m&y'] then -- for composite links
table.insert (result, repeat_tags ('th', {get_display_month (mnum, props) .. ' ' .. hdr_year}, {['class']='mcal', ['attr']={['colspan']=col_span}}));▼
table.insert (result, repeat_tags ('th', {get_display_month (mnum, props)}, {['class']='mcal', ['attr']={['colspan']=col_span}}));
else
▲
end
if props.prevnext then
Line 303 ⟶ 316:
end
if props.month_num then -- month_num only set when doing
table_css.border = '1px solid grey'; -- put this is styles.css as a separate class?
end
Line 329 ⟶ 342:
end
month_cal:done() -- close <table>
--mw.log (tostring (month_cal))
return tostring (month_cal)
end
Line 351 ⟶ 364:
end
end
return repeat_tags ('td', td_items, options)
end
Line 364 ⟶ 378:
local css_opts = {};
if props.hide_year
css_opts['display'] = 'none'; -- use css to hide the year header (but not when |title= has a value)
end
Line 375 ⟶ 389:
:css(css_opts)
:attr ('colspan', props.cols)
:wikitext (props.title or get_display_year (props
return tostring (header)
end
Line 476 ⟶ 490:
end
cal_props.hide_year = ('yes' == args.hide_year) or ('off' == args.show_year); -- year normally displayed; this hides year display▼
if args.month then
local mnum = tonumber(args.month)
Line 534 ⟶ 546:
args.lk = args.lk and args.lk:lower();
if args.lk and ({['yes']=1, ['m&y']=1, ['dm&y']=1, ['dm']=1, ['my']=1, ['dy']=1, ['d']=1, ['m']=1, ['y']=1})[args.lk] then -- if valid keywords▼
if 'yes' == args.lk then -- all date components are individually linked▼
▲ if args.lk and ({['yes']=1, ['dm']=1, ['my']=1, ['dy']=1, ['d']=1, ['m']=1, ['y']=1})[args.lk] then -- if valid keywords
▲ if 'yes' == args.lk then -- all date components are linked
cal_props.lk_d = true;
cal_props.lk_m = true;
cal_props.lk_y = true;
elseif 'm&y' == args.lk and cal_props.month_num then -- stand-alone month calendars only; month and year as a single composite link
cal_props['lk_m&y'] = true;
elseif 'dm&y' == args.lk and cal_props.month_num then -- stand-alone month calendars only; month and year as a single composite link
cal_props['lk_m&y'] = true;
cal_props.lk_d = true;
else
cal_props.lk_d = 'd' == args.lk:match ('d'); -- decode the keywords to know which components are to be linked
Line 546 ⟶ 562:
end
end
if not (cal_props.title or cal_props.lk_y or cal_props['lk_m&y']) then
▲
end
cal_props.lk_pref = args.lk_pref; -- prefix for all links except previous nad next
cal_props.lk_suff = args.lk_suff; -- suffix for all links except previous nad next
|