Module:British regnal year: Difference between revisions

Content deleted Content added
create replacement for Template:British regnal year
 
m Changed protection settings for "Module:British regnal year": Up to template-protection as dependency of template-protected Module:Year in various calendars ([Edit=Require template editor access] (indefinite) [Move=Require administrator access] (indefinite))
 
(5 intermediate revisions by 3 users not shown)
Line 29:
end
local currentYear = tonumber( mw.language.getContentLanguage():formatDate( 'Y' ) )
-- The year 1066 is significant because it is when the Norman conquest of England occurred.
if inputYear < 1066 or inputYear > currentYear then
return "''N/A''"
Line 43 ⟶ 44:
local prevEndYear = t.prevEndYear
local linkPrev = t.linkPrev
local note = t.note
 
if inputYear > dataYear then
-- Years with the same monarch.
return mw.ustring.format(
'%d&nbsp;%s&nbsp;–&nbsp;%d&nbsp;%s%s',
currentRegnalYear - 1, linkCurrent, currentRegnalYear, linkCurrent, note or ''
)
elseif inputYear == dataYear and prevEndYear and linkPrev then
-- Years with a different monarch.
return mw.ustring.format(
'%d&nbsp;%s&nbsp;–&nbsp;%d&nbsp;%s%s',
prevEndYear, linkPrev, currentRegnalYear, linkCurrent, note or ''
)
else
-- This should only match the year 1066.
return mw.ustring.format(
'%d&nbsp;%s%s',
currentRegnalYear, linkCurrent, note or ''
)
end