Template:Tlg/doc
This is a documentation subpage for
Template documentation[edit]
Template sandbox and testcases for TEMPLATE_NAME[edit]Overview[edit]This page provides a clean workflow to safely edit and validate TEMPLATE_NAME:
Use this page to:
Quick links[edit]
How to test[edit]1. Edit the sandbox at Template:TEMPLATE_NAME/sandbox. 2. Open this test page and click “Show preview” to render the sandbox with inputs below. 3. Verify each testcase: Does the “Actual output” match the “Expected output”? 4. If all pass, consider copying sandbox to live using an edit summary like: “Sync from /sandbox: passes all /testcases as of YYYY-MM-DD.” Previewing tips[edit]
Test harness[edit]The following sections render the sandbox template against curated inputs. Each testcase shows:
Testcase A: Minimal invocation[edit]Parameters: {{TEMPLATE_NAME}} Expected output: [Minimal successful output with defaults: e.g., a neutral message or basic box] Actual output (sandbox): Character and language test sandbox This sandbox is used to test how Template:TEMPLATE NAME behaves with special characters (such as Greek letters) and language-specific spans. Basic examples[edit]
Within the template[edit]Below are example calls of the template using these characters as parameters. {{TEMPLATE NAME | title = Greek test: α γ | summary = Demonstrating Greek letters: α, β, γ, and entities like γ. | attr1 = Direct Greek: α β γ δ | attr2 = Entity Greek: α β γ δ | attr3 = German label: <span lang="de">A</span>, English label: A }} Preview the page to check if:
Notes[edit]
Testcase B: Common parameters[edit]Parameters: {{TEMPLATE_NAME | param1 = Alpha | param2 = Beta | flag = yes }} Expected output: [Example: shows "Alpha" and "Beta" in designated slots; flag toggles enhanced styling] Actual output (sandbox): Character and language test sandbox This sandbox is used to test how Template:TEMPLATE NAME behaves with special characters (such as Greek letters) and language-specific spans. Basic examples[edit]
Within the template[edit]Below are example calls of the template using these characters as parameters. {{TEMPLATE NAME | title = Greek test: α γ | summary = Demonstrating Greek letters: α, β, γ, and entities like γ. | attr1 = Direct Greek: α β γ δ | attr2 = Entity Greek: α β γ δ | attr3 = German label: <span lang="de">A</span>, English label: A }} Preview the page to check if:
Notes[edit]
Testcase C: Edge values and escaping[edit]Parameters: {{TEMPLATE_NAME | param1 = [[Linked target|Visible text]] | param2 = {{subst:CURRENTTIMESTAMP}} | raw = <code><span class="x">escaped</span></code> }} Expected output: [Links render correctly; timestamp subst is literal in expected; raw shows escaped markup] Actual output (sandbox): Character and language test sandbox This sandbox is used to test how Template:TEMPLATE NAME behaves with special characters (such as Greek letters) and language-specific spans. Basic examples[edit]
Within the template[edit]Below are example calls of the template using these characters as parameters. {{TEMPLATE NAME | title = Greek test: α γ | summary = Demonstrating Greek letters: α, β, γ, and entities like γ. | attr1 = Direct Greek: α β γ δ | attr2 = Entity Greek: α β γ δ | attr3 = German label: <span lang="de">A</span>, English label: A }} Preview the page to check if:
Notes[edit]
Testcase D: Internationalization (i18n)[edit]Parameters: {{TEMPLATE_NAME | lang = ja | text = こんにちは世界 }} Expected output: [Text displays correctly for non-ASCII; applies lang attribute or rtl/ltr where applicable] Actual output (sandbox): Character and language test sandbox This sandbox is used to test how Template:TEMPLATE NAME behaves with special characters (such as Greek letters) and language-specific spans. Basic examples[edit]
Within the template[edit]Below are example calls of the template using these characters as parameters. {{TEMPLATE NAME | title = Greek test: α γ | summary = Demonstrating Greek letters: α, β, γ, and entities like γ. | attr1 = Direct Greek: α β γ δ | attr2 = Entity Greek: α β γ δ | attr3 = German label: <span lang="de">A</span>, English label: A }} Preview the page to check if:
Notes[edit]
Testcase E: Error handling[edit]Parameters: {{TEMPLATE_NAME | param1 = | required = <!-- intentionally omitted --> }} Expected output: [Shows a gentle error or maintenance category; does not break page layout] Actual output (sandbox): Character and language test sandbox This sandbox is used to test how Template:TEMPLATE NAME behaves with special characters (such as Greek letters) and language-specific spans. Basic examples[edit]
Within the template[edit]Below are example calls of the template using these characters as parameters. {{TEMPLATE NAME | title = Greek test: α γ | summary = Demonstrating Greek letters: α, β, γ, and entities like γ. | attr1 = Direct Greek: α β γ δ | attr2 = Entity Greek: α β γ δ | attr3 = German label: <span lang="de">A</span>, English label: A }} Preview the page to check if:
Notes[edit]
Maintenance[edit]
Categories[edit]Copy-paste skeletons[edit]Below are ready-to-use skeletons for the sandbox and testcases subpages. Skeleton: Template:TEMPLATE_NAME/sandbox[edit]<!-- Sandbox for TEMPLATE_NAME --> <!-- Copy the entire template source here; edit safely. --> {{#if:{{{required|}}} | <!-- normal output --> <div class="tmpl"> <b>{{{param1|}}}</b> · <i>{{{param2|}}}</i> {{#if:{{{flag|}}}|<span class="flag">✓</span>|}} {{#if:{{{raw|}}}|<span class="raw">{{{raw}}}</span>|}} </div> | <!-- error / missing required --> <span class="error">TEMPLATE_NAME: missing required parameter</span> [[Category:Pages with TEMPLATE_NAME errors]] }} Skeleton: Template:TEMPLATE_NAME/testcases[edit]<!-- Testcases for TEMPLATE_NAME; render against /sandbox --> ; Minimal : {{TEMPLATE_NAME/sandbox}} ; Common params : {{TEMPLATE_NAME/sandbox | param1 = Alpha | param2 = Beta | flag = yes }} ; Edge and escaping : {{TEMPLATE_NAME/sandbox | param1 = [[Linked target|Visible text]] | param2 = 20250101T000000Z | raw = <code><span class="x">escaped</span></code> }} ; I18n : {{TEMPLATE_NAME/sandbox | lang = ja | text = こんにちは世界 }} ; Error handling : {{TEMPLATE_NAME/sandbox | required = }} Review checklist[edit]
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]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]
Behavior details[edit]
Examples[edit]
{{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]
Lua-powered variant (optional)[edit]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]It may contain usage information, categories and other content that is not part of the original template page. |
Explanation
[edit]{{tlg}} (template link, general) is a general template for inserting a template link. It can be used to replace or implement any of the more specific {{tl*}} templates, e.g. {{tl}}, {{tlx}} or {{tlb}}. Parameters are:
: Boldface the text, like forbold=yes{{tlb}}and{{tlxb}}: Italicizes the parameters, like foritalic=yes{{tlxi}}: Use a monospaced font, like fortt=yes{{tlx}}and{{tlxb}}: Use thecode=yes<code>...</code>HTML attribute (usually a monospaced font), like for{{tlc}}: Don't insert a template link, like fornolink=yes{{tlf}},{{tld}}, and{{tlc}}: Allow linking to arbitrary page (not just template), as withanypage=yes{{tlu}}: Put braces inside the link, like forbraceinside=yes{{tn}}: Add asubst=yesprefix, like forsubst:{{tls}}: Specify alternative surface text for a link, like foralttext=FOO{{tla}}
Examples
[edit]| Code | Result | Remark |
|---|---|---|
{{Tlg|Abc}} |
{{Abc}} | |
{{Tlg|ABC}} |
{{ABC}} | |
{{Tlg|AbC}} |
{{AbC}} | |
{{Tlg|x0}} |
{{x0}} | |
{{Tlg|x0|bold=yes}} |
{{x0}} | |
{{Tlg|x1|one|italic=yes}} |
{{x1|one}} | |
{{Tlg|x0|code=yes}} |
{{x0}} |
|
{{Tlg|x0|tt=yes}} |
{{x0}} | |
{{Tlg|x0|nolink=yes}} |
{{x0}} | |
{{Tlg|x0|subst=yes}} |
{{subst:x0}} | |
{{Tlg|x0|braceinside=yes}} |
{{x0}} | |
{{Tlg|x0|alttext=Link to x0 template}} |
{{Link to x0 template}} | |
{{Tlg|x0|anypage=yes}} |
{{x0}} | Now the expression links to x0 (the spaceship, genetic disease, etc.) rather than Template:x0. Mostly useful for templates in user space. |
{{Tlg|x0|bold=yes|tt=yes|braceinside=yes}} |
{{x0}} | No reason you can't combine multiple parameter settings. |
{{Tlg|x1|one}} |
{{x1|one}} | |
{{Tlg|x2|one|two}} |
{{x2|one|two}} | |
{{Tlg|x2|bold=yes|tt=yes|one|two}} |
{{x2|one|two}} | Can combine named and anonymous parameters ... |
{{Tlg|x2|one|two|bold=yes|tt=yes}} |
{{x2|one|two}} | ... in any order … |
{{Tlg|x2|one|tt=yes|two|bold=yes|three}} |
{{x2|one|two|three}} | ... even intermixed ... |
{{Tlg|x2|one|tt=yes|two|bold=yes|three|italic=yes}} |
{{x2|one|two|three}} | ... with many different configurations. |
{{Tlg|x3|1|2|3|4|5|6|7|8|9|10}} |
{{x3|1|2|3|4|5|6|7|8|9|10}} | |
{{Tlg|x4|1|2|3|4|5|6|7|8|9|10|11}} |
{{x4|1|2|3|4|5|6|7|8|9|10|...}} | up to 10 parameters, then ... |
{{Tlg|x5|1|2|3|4|5|6|7|8|9|10|11}} |
{{x5|1|2|3|4|5|6|7|8|9|10|11}} | | for more |
{{Tlg|convert|<nowiki>14|m|ftin|abbr=out|sp=us</nowiki>}} |
unlimited parameters as one nowiki string | |
{{Tlg}} |
{{Tlg/doc}} | with no arguments, the current page name is substituted |
{{Tlg|x1|x=u}} |
{{x1}} | = won't work |
{{Tlg|x1|x=u}} |
{{x1|x=u}} | = is okay |
{{Tlg|x1|x{{=}}u}} |
{{x1|x=u}} | {{=}} is okay |
{{Tlg|x1|<nowiki>x=u</nowiki>}} |
{{x1|x=u}} | sticky nowiki is okay |
{{Tlg|x2| |two}} |
{{x2|two}} | empty won't work |
{{Tlg|x2| |two}} |
{{x2| |two}} |   is okay |
{{Tlg|x2| |two}} |
{{x2| |two}} | is okay |
{{Tlg|x2| | two}} |
{{x2| | two}} | | is okay |
{{Tlg|x2| {{!}} two}} |
{{x2| | two}} | {{!}} is dubious |
{{Tlg|x2|2=|3=two}} |
{{x2|two}} | empty really doesn't work |
{{Tlg|x2|2=one|two}} |
{{x2|two}} | two clobbers 2=one |
{{Tlg|x2|3=two|2=one}} |
{{x2|one|two}} | right to left okay |