ಟೆಂಪ್ಲೇಟ್:Dfn
{{{1}}}
Usage
[ಸಂಪೊಲಿಪುಲೆ]This template applies the HTML phrase element <dfn>
around the text given as the first parameter, the term, and, if the optional second definition parameter is present, applies a dotted underline (a common style throughout the Web for indicating a term with a definition feature) and a definition pop-up "tool tip" when cursor focus is on the term.
Without the second parameter, it does not do anything user-facing, and is just a form of meta-data that can be detected and acted upon by internal and external software (statistics-gathering bots, rich Web 2.0 applications, etc.), and can provide valuable contextual information to editors.
It is used as a meta-template by some other templates. When used by itself, its most common purpose would be around a term boldfaced in an article and immediately defined there such as a key piece of terminology introduced after the lead section. Wikipedia is not a dictionary, so this template should not be used to draw metadata attention to everyday words, and is best suited in spots where there is a short definition or clarification of jargon that is important in the context.
(Tech detail: By using an internal <span>...</span>
with its own independent title
attribute for tool tip fun, it sets this up in a way that does not violate the HTML 5 specification on the handing of the title
attribute of <dfn>
, which is the exact term defined, not its definition.)
Purpose and application
[ಸಂಪೊಲಿಪುಲೆ]This markup indicates that the text is the defining instance of that term (word, phrase, name, etc.) on the page in which it appears. Thus it should be used only once per term per page.
Wikipedia is not a dictionary, so this template should not be used to provide definitions for everyday words at all, and is best suited for short definition or clarification of jargon that is important in the context but unlikely to be fully understood by all of our general readership. The template can be adapted to most directly editable cases in which the <dfn>
element would be useful.
Because the definition parameter's content is not readily accessible to users of most if not all screen reader software, text-only browsers, mobile phone browsers, etc., the second parameter should never be used to provide information vital to understanding the article subject, only convenient or augmenting for those who can access it; vital information belongs in the main article prose.
This template should not be used for marking up entries or links to them; see {{term}} and {{glossary link}} instead, respectively. Likewise, this template should not be used to mark up the bold-faced article subject in the lead; [it is anticipated that] another template, [name forthcoming, probably Template:Subject], is [to be created to be] used for this purpose, including the needed bold-facing and [perhaps] other markup and metadata features.
This is semantic markup, not simply presentational style, and has a particular, pre-defined meaning; do not misuse this template just to get its display effects. If the content being marked up is not suitable for the <dfn>
element as defined by the W3C HTML specifications, then you should not use this template.
Parameters
[ಸಂಪೊಲಿಪುಲೆ]There are two basic parameters, the mandatory first parameter, the term, and the optional second one, the definition:
If the definition parameter is supplied and the reader's browser supports the functionality, moving browser focus to the term (e.g., hovering the mouse cursor over it, or in some browsers using keyboard navigation to tab to it) will change the cursor to the "help" version (usually a question mark) and bring up the definition text in a pop-up tool tip (or some other interface, as provided by the browser in question). Without a second parameter, no such underlining and tool tip effects occur.
It is safest to explicitly number them, but this is only absolutely required if the content contains an equals sign somewhere:
{{dfn|1=term|2=definition}}
{{dfn|term|2=definition}}
– this works if only the definition has a "=" in it.- ಟೆಂಪ್ಲೇಟ್:!bxt – this fails; if parameter 1 is numbered, so must be parameter 2
If no definition is provided, the template is invisible:
{{dfn|ecdysis|moulting of the exoskeleton}}
results in: ecdysis{{dfn|ecdysis}}, the moulting of the exoskeleton
results in: ecdysis, the moulting of the exoskeleton[[Ecdysis|{{dfn|ecdysis}}]]
results in: ecdysis
The "invisible" second and third cases won't be noticed by casual readers, but can still be detected and acted upon by internal and external software (statistics-gathering bots, rich Web 2.0 applications, etc.), and can provide valuable contextual information to editors.
The definition parameter is most commonly omitted when the text following the term provides the defining content inline in the prose, or when the term is linked to an explanation elsewhere, as shown above. A common case of this is when an article provides a bold-faced term and an explanation of it, often at the start of a paragraph or section, indicating a significant side-topic in the article, subordinate to the main article subject boldfaced in the lead.
Other optional parameters
[ಸಂಪೊಲಿಪುಲೆ]|title=exact, plaintext term being defined
– used a) when the content in the first parameter (term) contains any wikimarkup or HTML; or b) when the term being defined is actually slightly different from (i.e. more precise than) the marked up content; the true term being defined goes in this parameter. Any double-quotation mark ("
) must be escaped, as"
.
Real-world example: showing imprecise term in text and its precise official name as the|title=
, with escaped quotation marks:{{dfn|Mac OS X Lion|title=Mac OS X 10.7 "Lion"}}
, which results in: Mac OS X Lion (hover over it to see that tooltip is different from base content)|id=an_ID
– an ID (no spaces, must begin with alphabetic letter) for #linking and possibly other purposes|style=arbitrary:css;
– CSS directives for custom-styling the instance|class=css_class
– a CSS class or classes (separated by spaces not commas if more than one)
Problem characters
[ಸಂಪೊಲಿಪುಲೆ]If there would be a "=
" (equals sign) in the term, either a) both unnamed parameters if present must explicitly be numbered:
{{dfn|1=E=MC2|2=Mass–energy equivalence}}
which results in: E=MC2
or b) the character itself can be escaped as the HTML character entity reference code =
or the {{=}}
template:
{{dfn|E=MC2|Mass–energy equivalence}}
which results in: E=MC2{{dfn|E{{=}}MC2|Mass–energy equivalence|title=E=MC²}}
which results in: E=MC2
No other characters are known to be problematic in the term.
For technical reasons, the second parameter (|2=
, the definition) is more "brittle". The equals sign (=
) must be escaped by one of the techniques just mentioned, and the standard keyboard (straight, not curly) double-quotation mark ("
) must also be escaped, no matter what, as "
or "
. This double-quote must also be escaped the same way in the |title=
parameter:
{{dfn|1=ACT UP's slogan|2="Silence = Death"}}
which results in: ACT UP's slogan{{dfn|ACT UP's slogan|"Silence {{=}} Death"}}
which results in: ACT UP's slogan{{dfn|ACT UP's slogan|"Silence = Death"}}
which results in: ACT UP's slogan{{dfn|"Teenage Wasteland"{{sic}}|title="Baba O'Riley"}}
which results in: "Teenage Wasteland"ಟೆಂಪ್ಲೇಟ್:Sic
Links and markup
[ಸಂಪೊಲಿಪುಲೆ]Linking and wikimarkup should be done outside the template when possible:
- Right:
'''[[Foo|{{dfn|Foo}}]]'''
- Wrong:
ಟೆಂಪ್ಲೇಟ್:!bxt
The term content in the first parameter can be marked up with wikimarkup or HTML, at the inline
level, such as italics, superscript other text-formatting code (versus block
-level elements, such as paragraphs, tables, block quotations, and so on), if absolutely necessary. If this is done, the |title=
parameter must contain the un-marked-up, plaintext term. Example: The displayed text (first parameter) uses superscript markup, for accessibility reasons, while the real plaintext in the title parameter uses a Unicode character entity (doesn't count as wikimarkup) for a superscripted 2, which is actually more correct but may not display properly on older systems:
{{dfn|1=E=MC<sup>2</sup>|title=E=MC²}}
yields:
- E=MC2
while this:
{{dfn|1=E=MC<sup>2</sup>|2=Mass–energy equivalence; E is energy, m is mass, and c is the speed of light in a vacuum|title=E=MC²}}
gives:
- E=MC2
Note that in the first case, the mouse hover tooltip is the Unicode version of the term, as given in the |title=
, while in the latter it is the definition given in the |2=
parameter.
Linked version:
[[Mass–energy equivalence|
{{dfn|1=E=MC2|2=Mass–energy equivalence; E is energy, m is mass, and c is the speed of light in a vacuum|title=E=MC²}}
]]
gives:
It still has a dotted underline indicating a tooltip, but is also a bluelink. Mouse hovering shows both the tooltip and, in the status bar, the target URL, in browsers that support these features.
Link inside the {{dfn}}
:
{{dfn|1=[[Mass–energy equivalence|E=MC2]]|2=Mass–energy equivalence; E is energy, m is mass, and c is the speed of light in a vacuum|title=E=MC²}}
results in:
This doesn't mess up the page, but the definition fails and there's no tooltip cursor, meanwhile the markup is hard for other editors to understand anyway so it is deprecated.
Links, HTML, wikimarkup, and other markup cannot be applied to content in the |2=
(definition) parameter, nor in a |title=
parameter, only plain text and character entity references ("&-codes", like "
).
Anchors and id
[ಸಂಪೊಲಿಪುಲೆ]Example where an {{anchor}} is added. Because 2=
is missing, no text appears when the mouse hovers over the newly defined term "open set
".
An {{em|{{dfn|1=open set|id=dfn-anchorname open set}}}} is defined as ...<br/><br/> This makes it an example of an [[#dfn-anchorname open set|open set]].
results in:
- An open set is defined as ...
This makes it an example of an open set.
Contrast to the alternative that uses the {{visible anchor}} template:
An {{em|{{visible anchor|open set}}}} is defined as ...<br/><br/> This makes it an example of an [[#open set|open set]].
which results in:
- An ಟೆಂಪ್ಲೇಟ್:Visible anchor is defined as ...
This makes it an example of an open set.
Note that clicking on the "open set" link results in the text being highlighted.
See also
[ಸಂಪೊಲಿಪುಲೆ]- {{dfni}} is a wrapper for {{dfn}} that applies italics for uses
- Related to {{glossary link}}, a variant for use with
- {{abbr}}
- {{tooltip}}
- Not to be confused with {{defn}} (but see the related glossary templates {{glossary}}, {{glossary end}} and especially {{term}}; the last of these also makes use of the
dfn
HTML element)