Template:Film date/doc
This is a documentation subpage for
Template documentation[edit source]Template:Terminate sentence ensures a sentence ends with a specified terminator (default: a period). It avoids adding duplicate terminators and can optionally trim trailing spaces. It attempts to ignore trailing closing quotes or brackets when deciding whether a terminator is already present. Usage[edit source]Basic: {{Terminate sentence|This is a sentence}}
→ This is a sentence.
Named parameters: {{Terminate sentence
|text=He said "Hello"
|term=.
}}
→ He said "Hello".
Custom terminator: {{Terminate sentence|text=Warning|term=!}}
→ Warning!
Avoid duplicate terminator: {{Terminate sentence|text=Already done.|term=.}}
→ Already done.
Trim trailing spaces: {{Terminate sentence|text=Ends with space |trim=yes}}
→ Ends with space.
Skip processing: {{Terminate sentence|text=No changes here|skip=yes}}
→ No changes here
Append a note: {{Terminate sentence|text=Complete|note=(source: 2025)}}
→ Complete. (source: 2025)
Parameters[edit source]
Behavior details[edit source]
Examples[edit source]
{{Terminate sentence|text=He whispered "hush"|term=.}}
→ He whispered "hush".
{{Terminate sentence|text=Complete (verified)|term=.}}
→ Complete (verified).
{{Terminate sentence|text=Alert|term=!}}
→ Alert!
{{Terminate sentence|text=Wait...|term=.|allowdup=yes}}
→ Wait.... Best practices[edit source]
Lua-powered variant (optional)[edit source]For more robust detection (including multilingual quotes and punctuation), create -- Module:TerminateUtil
local M = {}
local closing = {
[")"] = true, ["]"] = true, ["}"] = true,
['"'] = true, ["'"] = true, ["”"] = true, ["’"] = true, ["»"] = true, ["›"] = true
}
local function trimRight(s)
return (s:gsub("%s+$",""))
end
function M.lastVisibleChar(args)
local s = args.s or ""
s = trimRight(s)
local i = #s
while i > 0 do
local c = s:sub(i,i)
if closing[c] then
i = i - 1
else
return c
end
end
return ""
end
return M
Then update the template to call: {{#invoke:TerminateUtil|lastVisibleChar|s=text}}
This improves detection for closing quotes and brackets. See also[edit source]It may contain usage information, categories and other content that is not part of the original template page. |
Purpose
[edit source]This template has two functions:
- To provide correct formatting of film release dates and their locations within {{Infobox film}}. A citation for each date/location may also be supplied.
- To automatically categorize films according to their first release date.
Usage
[edit source]This template is intended to supply a result to the | released = parameter of {{Infobox film}}.
The template adds either Category:Upcoming films for films before their first release or [[Category:YYYY films]] after their first release date, where YYYY is the year of first release.
Syntax
[edit source]This template allows up to five release dates/locations, but normally no more than two are needed. Please see WP:FILMRELEASE for a full explanation.
One release date only
[edit source]{{Film date|year|month|day|location|ref1=<ref name="xxxxx" />}}
If no location is specified, month and day may be omitted. If location is specified, then month and day must be supplied, though they may be left blank or empty if not known; ref1= is an optional parameter allowing a named reference ("xxxxx") to be used to verify the date/location of the release.
More than one release date
[edit source]{{Film date|year1|month1|day1|location1|ref1=<ref name="xxxxx" />|year2|month2|day2|location2|ref2=<ref name="yyyy" />}}and similarly for up to five dates/locations.
In this case, all the year, month, day and location parameters, except the last, must be supplied, but as before, month and day may be left empty or blank if not known. Note that ref1=, ref2=, etc. are optional named parameters, and may be omitted without affecting the other parameters.
Examples
[edit source]{{Film date|1993}} returns:
- 1993
{{Film date|1993|02}} returns:
- February 1993
{{Film date|1993|02|24}} returns:
- February 24, 1993
{{Film date|1993|February|24}} returns:
- February 24, 1993
{{Film date|1993|02|24||2008|03}} returns:
- February 24, 1993
- March 2008
{{Film date|1993|02|24|Latvia}} returns:
- February 24, 1993 (Latvia)
{{Film date|1993|02|24||2008|03|23}} returns:
- February 24, 1993
- March 23, 2008
Optional parameters
[edit source]- df can be set to "y" or "yes" to display the day before the month. Default is month before day.
{{Film date|1993|02|24|df=y}} returns:
- 24 February 1993
{{Film date|1993|02|24|Latvia|df=y}} returns:
- 24 February 1993 (Latvia)
- fy can be set to override the automatic category. For example:
{{Film date|1993|02|24||2008|03|23}} uses the category Category:1993 films
{{Film date|1993|02|24||2008|03|23|fy=2008}} uses the category Category:2008 films.
- TV is to be used for television films. It sorts films into
[[Category:YYYY television films]]in place of[[Category:YYYY films]]. SetTV=yorTV=yesto do this.
- ref1, ref2, ref3, ref4, ref5 are used to supply named references. See above for detail.
Technical note
[edit source]This template uses {{Start date}} to handle the hard work of date formatting, and {{Plainlist}} to format list items as recommended for use within infoboxes.
Redirects
[edit source]See also
[edit source]- {{Start date}}
- {{Nowrap}}
- {{Small}}