Module:English variant notice: Difference between revisions

Content deleted Content added
update based on sandbox
per edit request at Template talk:English variant notice#Edit request 16 August 2025 - remove unnecessary text
 
(14 intermediate revisions by 9 users not shown)
Line 1:
--TODO:add some more comments so I don't forget what everything does months later
local p = {}
local categoryHandler = require( 'Module:Category handler' ).main
Line 13 ⟶ 12:
n = mArguments.getArgs(frame, {parentFirst = true})
n.variant = n.variant or templatetitle --automatically use title generated from template name
if n.doc ~= 'no' then
return frame:expandTemplate {title = 'English variant notice/documentation', args = n}
end
end
return p._main (frame, templatetitle)
Line 44 ⟶ 45:
bOxford = yesno(n.Oxford)
bIUPAC = yesno(n.IUPAC)
chemtext = "; ''aluminium'', ''sulfur'', and ''caesium''"
if bOxford then
n.spelling_examples = "''colour'', ''realize'', ''organization'', ''analyse''; note that '''-ize''' is used instead of -ise"
Line 59 ⟶ 60:
elseif bIUPAC then
n.extravariant = ' with [[IUPAC]] spelling'
n.spelling_examples = n.spelling_examples and n.spelling_examples..chemtext or "''aluminium'', ''sulfur'', and ''caesium''"
p.IUPAC ()
return
Line 75 ⟶ 76:
 
function p.base_text (frame)
n.subjectspace = frame:expandTemplate{ title = require('SUBJECTSPACE_formattedModule:Pagetype' }).main()
n.spelling_examples = n.spelling_examples and string.format(' (%s)', n.spelling_examples) or ''
n.terms = n[1] or n.terms
n.terms = n.terms and string.format(', (including %s,)', n.terms) or ''
n.compare = n.compare and (n.compare..' ') or ''
n.text = string.format([=[This %s is '''written in [[%s]]%s'''%s%s, and some terms that are used in it%s may be different or absent from %sother [[List of dialects of the English language|varieties of English]]. According to the [[WPWikipedia:ENGVARManual of Style#National varieties of English|relevant style guide]]%s, this should not be changed without [[Wikipedia:Consensus#Levels of consensus|broad consensus]].__EXPECTUNUSEDTEMPLATE__]=],
n.subjectspace, n.variant, n.extravariant, n.spelling, n.spelling_examples, n.terms, n.compare, n.extraguide)
end
Line 86 ⟶ 87:
function p.style (frame)
local size
if yesno(n.small) then size = '30px' else size = '50px' end
elseif n.size then size = n.size
else size = '50px'
end
if n.image then
if n.flag == nil or yesno(n.flag) then
Line 104 ⟶ 108:
--categorize editnotice if specified
if yesno(n.editnotice_cat) then
p.cat(string.format('Pages with editnotice %s editnotice', n.variant))
end
return frame:expandTemplate{title = 'editnotice', args = n}