Template:Marriage/doc

From Black Cat Studios
< Template:Marriage
Revision as of 00:36, 20 June 2023 by Blackcat (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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:

Examples
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

Spouses
John Smith
(m. Template:Tooltip⁠–⁠Template:Tooltip)
John Doe
(m. 1885; died Template:Tooltip)
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
John Smith
(m. Template:Tooltip⁠–⁠Template:Tooltip)
John Doe
(m. 1885; died Template:Tooltip)
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 his death or her death for this purpose has been deprecated (see discussion).
  • d, d., or died includes Template:Xtn within the parentheses if the marriage ended on the spouse's death.
  • div, div., or divorced includes Template:Xtn or Template:Xtn within the parentheses.
  • Otherwise, |end=value includes customized text. For example:


Usage

Wraps a short span of text in <syntaxhighlight> tags (see mw:Extension:SyntaxHighlight). This template should be used for short samples; longer content should use <pre>...</pre> or <syntaxhighlight>...</syntaxhighlight>. See Help:Wiki markup for an explanation of what the various tags do.

If the content includes an equals sign (=), you must specify the parameter explicitly: {{code|1=date=30 Feb 2010}}.

The template uses the <syntaxhighlight> tag with the attribute inline=1. This works like the combination of the <code> and <nowiki> tags, applied to the expanded wikitext. For example, {{code|some '''wiki''' text}} will not render the word "wiki" in bold, and will render the tripled-single-quotes:

Template loop detected: Template:Code

However, {{code|a {{template}} call}} will still invoke the template:

Template loop detected: Template:Code

Use <nowiki>...</nowiki> around the template name to avoid this problem:

Template loop detected: Template:Code

When used inline with regular text, {{code}} generally looks best and is easiest to read when it is explicitly spaced apart from the regular text:

Template loop detected: Template:Code

is well spaced:

foo  Template loop detected: Template:Code  quux.

versus:

Template loop detected: Template:Code

which is going to be visually confusing for many:

foo Template loop detected: Template:Code quux.

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 |2=, or more explicitly as |lang=) to specify a language for mw:Extension:SyntaxHighlight. This option defaults to plain-text, i.e. no highlighting. There is no highlighting option for wikitext as a markup language, though Template loop detected: Template:Code and Template loop detected: Template:Code are valid values, as are Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code and many others. Attempting to use an invalid one causes a list of valid ones to be displayed in place of the template output, when the page is previewed or saved.

This template does not need to be substituted.

Examples

Markup Renders asScript error: No such module "For loop".

Included templates

Embedded 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 <code>...</code> as a wrapper instead of this template.

Templates used inside {{code}} expose the rendered HTML— this can be useful. For example:

Markup Renders asScript error: No such module "For loop".

The above example shows the HTML rendered by the citation template, including the hidden metadata.

TemplateData

This 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.

TemplateData for Marriage

Script error: No such module "Format TemplateData".

See also

which produces:

Template:Block indent

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

Categories populated via parameter validation

TemplateData

This 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.

TemplateData for Marriage

No description.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Spouse's name1

Name of the person to whom the subject is married.

Stringsuggested
Date married2

Date the marriage began.

Datesuggested
Date ended3

Date the marriage was dissolved or the spouse of the article's subject died.

Dateoptional
Reason endedend reason

Reason for marriage's end. If the marriage ended because of the death of the article's subject, do not provide a reason.

Suggested values
died divorced
Stringoptional