Template:Marriage/doc: Difference between revisions
en>Pedantical m (Reverted 1 edit by Karimul islam 786 (talk) to last revision by Neveselbert) |
m (1 revision imported) |
(No difference)
|
Latest revision as of 00:36, 20 June 2023
This is a documentation subpage for Template:Marriage. It may contain usage information, categories and other content that is not part of the original template page. |
This template employs intricate features of template syntax.
You are encouraged to familiarise yourself with its setup and parser functions before editing the template. If your edit causes unexpected problems, please undo it quickly, as this template may appear on a large number of pages. You can conduct experiments, and should test all major changes, in either this template's sandbox, the general template sandbox, or your user space before changing anything here. |
This template is used on many pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
File:Lua-Logo.svg | This template uses Lua: |
File:Farm-Fresh css add.svg | This template uses TemplateStyles: |
Usage
This template is intended for use in infoboxes; specifically {{Infobox person}} and templates calling Infobox person.
{{Marriage}} takes up to three unnamed parameters (name, start date, end date)—plus an optional named parameter |end=
(|reason=
)—to produce output such as the following:
Template | OutputScript error: No such module "For loop". |
---|---|
Use of the first two parameters with |end=
(|reason=
) will cause a line break between the name and the start date.
In an infobox
{{Infobox person}} | |
---|---|
Spouses | Jane Doe (m. 2002)John Q. Public (m. 2002–2010)John Q. Citizen
(m. 2002; div. 2010)
(m. 2012)John Q. Taxpayer
(m. 2002, divorced)Joe Blow (div. 2010)Joe Bloggs (before 2010)Joe Sixpack (until 2010)Joe Schmo (divorced)Juan Perez (after 2010) |
Infoboxes already reduce text size to 88%, and MOS:FONTSIZE sets a lower limit for text size at 85% of the normal page font size, so it is not appropriate to use font size reduction when this template is used in an infobox. The example here is produced by: <syntaxhighlight style="font-size:small;" lang="wikitext">
Marriage/doc | |
---|---|
Spouses | Jane Doe (m. 2002)John Q. Public (m. 2002–2010)John Q. Citizen
(m. 2002; div. 2010)
(m. 2012)John Q. Taxpayer
(m. 2002, divorced)Joe Blow (div. 2010)Joe Bloggs (before 2010)Joe Sixpack (until 2010)Joe Schmo (divorced)Juan Perez (after 2010) |
</syntaxhighlight>
Syntax and parameters
{{marriage | <text> | <start date> | <end date> [| end= ]}}
Parameter | Description | ||||||||||
<text> | (First unnamed parameter) Some text—usually a spouse's name—preceding the parenthesis carrying the marriage date/s, etc. This parameter may be omitted, typically for a remarriage to the same spouse. | ||||||||||
<start date> | (Second unnamed parameter) Year or full date when the marriage began. Only the year will be displayed. If a full date is provided, it is given via a tooltip; i.e., {{Tooltip}}. (See first and second examples above.) | ||||||||||
<end date> | (Third unnamed parameter) Year or full date when the marriage ended. Only the year will be displayed. If a full date is provided, it is given via a tooltip; i.e., {{Tooltip}}. (See first and second examples above.) If the marriage ended because of the death of the article's subject, Template:Insource. | ||||||||||
|end= or |reason= | Reason for marriage's end. If the marriage ended because of the death of the article's subject, Template:Insource; use of
UsageWraps a short span of text in If the content includes an equals sign (=), you must specify the parameter explicitly: The template uses the
However,
Use
When used inline with regular text,
is well spaced:
versus:
which is going to be visually confusing for many:
because "foo" and "Template loop detected: Template:Code" will seem more closely associated than "Template loop detected: Template:Code" and "Template loop detected: Template:Code"; the width of the space character in a monospaced font is almost always larger than in a proportional font. Use parameter {{{2}}} (unnamed, as This template does not need to be substituted. Examples
Included templatesEmbedded templates do not function as expected inside {{code}}; for longer, free-form blocks of code, which can contain templates such as {{var}} and {{samp}}, use Templates used inside {{code}} expose the rendered HTML— this can be useful. For example:
The above example shows the HTML rendered by the citation template, including the hidden metadata. TemplateDataThis is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. Click here to see a monthly parameter usage report for this template based on this TemplateData.
Script error: No such module "Format TemplateData".
TemplateData for Marriage See also
which produces:Template:Qnote |
None of the parameters are required on their own, but if a template is missing all three of start date, end date, and reason, an error message will be displayed.
Tracking categories
Categories populated via template logic
- Category:Marriage template errors (0): invalid or missing dates; unsupported parameters or values
Categories populated via parameter validation
- Category:Pages using Marriage with duplicate parameters (0)
- Category:Pages using Marriage with unknown parameters (0)
- Category:Pages using Marriage with deprecated parameters (0)
TemplateData
TemplateData for Marriage
No description.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Spouse's name | 1 | Name of the person to whom the subject is married. | String | suggested |
Date married | 2 | Date the marriage began. | Date | suggested |
Date ended | 3 | Date the marriage was dissolved or the spouse of the article's subject died. | Date | optional |
Reason ended | end reason | Reason for marriage's end. If the marriage ended because of the death of the article's subject, do not provide a reason.
| String | optional |