Template:Official website/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. |
Usage
[edit source]The purpose of this template is to provide a standard format for labeling links to official websites. The only required parameter is the URL. Three other parameters are also available:
name=is used to reformat the title if "official website" is not suitable.
- NOTE: This name should succinctly and accurately describe the external link in relation to the subject. In particular, it should not include the article subject's name as the reader reasonably expects that all external links pertain to the subject.
mobile=is optionally used if there is a different "official website" for use with Mobile Web devicesformat=flashis optionally used if the website requires Adobe Flash Player software
Some URLs that contain special characters, such as & or =, will break the template. The solution is to prepend the URL with 1=
| Code | Result |
|---|---|
{{Official website|example.org}} |
Official website |
{{Official website|www.example.org}} |
Official website |
{{Official website|http://www.example.org/}} |
Official website |
{{Official website|https://www.example.org/}} |
Official website |
{{Official website|1=http://www.example.org/?action=view}} |
Official website |
{{Official website|http://www.example.org|name=Example}} |
Example |
{{Official website|example.org|mobile=http://m.example.org}} |
Official website (Mobile) |
{{Official website|example.org|format=flash}} |
Lua error: expandTemplate: template "Link note" does not exist. |
TemplateData
[edit source]This is the TemplateData documentation for the template used by the new VisualEditor.
Official website
The purpose of this template is to provide a standard format for labeling links to official websites.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| URL | 1 | The URL that the template will link to | String | required |
| URL Text | name | The text the URL will display. If not provided this will default to 'Official website'' | String | optional |
| Mobile Website | mobile | If the website has a different 'official website' for mobile devices this website can be listed here | String | optional |
| Requires Flash | format | If the website requires Adobe Flash Player software to be displayed, set this parameters value to 'flash' | String | optional |
See also
[edit source]- {{URL}} – for use instead of {{Official website}} in infoboxes
- {{Official websites}} – for multiple websites such as for different countries (preferably in English)
- {{Official websites in}} – for multiple websites in different languages (preferably in English)