Difference between revisions of "Template:Glossary/doc"
imported>Edokter m (Reverted edits by 178.16.5.71 (talk) to last version by Edokter) |
imported>Gonnym (no need for this convoluted system. Each template should only have its own documentation and is linked in the see also of the others.) |
||
| (7 intermediate revisions by 6 users not shown) | |||
| Line 1: | Line 1: | ||
| − | + | {{Documentation subpage}} | |
| − | + | ==Usage== | |
| − | == | ||
| − | |||
The template {{tlx|glossary}} (a.k.a. {{tnull|glossary start}} or {{tnull|glossary begin}}) is used with {{tlx|glossary end}} to explicitly bracket a glossary or glossary-like description list (also called a definition list or association list), especially in a [[Wikipedia:Manual of Style/Glossaries|template-structured glossary]], although such lists can be used more generally. This is ''required'' (as a technical matter) for template-structured glossaries, and is good practice anywhere description/definition lists are used for glossaries. The template pair invoke the {{tag|dl}} ''description list'' [[HTML Element#Lists|HTML element]]. Unfortunately, the "{{tlf|dl}}" mnemonic is not available as a redirect as of this writing. | The template {{tlx|glossary}} (a.k.a. {{tnull|glossary start}} or {{tnull|glossary begin}}) is used with {{tlx|glossary end}} to explicitly bracket a glossary or glossary-like description list (also called a definition list or association list), especially in a [[Wikipedia:Manual of Style/Glossaries|template-structured glossary]], although such lists can be used more generally. This is ''required'' (as a technical matter) for template-structured glossaries, and is good practice anywhere description/definition lists are used for glossaries. The template pair invoke the {{tag|dl}} ''description list'' [[HTML Element#Lists|HTML element]]. Unfortunately, the "{{tlf|dl}}" mnemonic is not available as a redirect as of this writing. | ||
| Line 9: | Line 7: | ||
Typical usage: | Typical usage: | ||
| − | + | {{bxt|1={{tlf|glossary}} }} | |
| − | {{bxt|1={{ | + | {{gray|1={{tl|term|1{{=}}<var>term</var>}} }} |
| − | {{gray|1={{ | + | {{gray|1={{tl|defn|1{{=}}<var>Definition.</var>}} }} |
| − | {{gray|1={{ | + | {{bxt|1={{tlf|glossary end}} }} |
| − | {{bxt|1={{ | ||
| − | |||
| − | |||
===Parameters=== | ===Parameters=== | ||
| − | |||
| − | |||
*{{para|id}} can be used to assign a one-word ID name to the glossary. This can be used as a <code>#{{var|id}}</code> link target, and could have other metadata uses. | *{{para|id}} can be used to assign a one-word ID name to the glossary. This can be used as a <code>#{{var|id}}</code> link target, and could have other metadata uses. | ||
*{{para|style}} will pass CSS styling on to the {{tag|dl|o}} element. I.e., this styles the definition list itself, as a container, not the individual terms and definitions with it. ''There is rarely any reason to do this.'' | *{{para|style}} will pass CSS styling on to the {{tag|dl|o}} element. I.e., this styles the definition list itself, as a container, not the individual terms and definitions with it. ''There is rarely any reason to do this.'' | ||
*{{para|class}} will pass one or more space-separate CSS classes on to {{tag|dl|o}} element, in addition to the automatically included class <code>glossary</code>. ''There is rarely any reason to do this.'' | *{{para|class}} will pass one or more space-separate CSS classes on to {{tag|dl|o}} element, in addition to the automatically included class <code>glossary</code>. ''There is rarely any reason to do this.'' | ||
| − | |||
===Examples=== | ===Examples=== | ||
| − | + | This shows both a very simple then a rather complex instance in a structured glossary (including an entry with a block quotation, using the glossary block quotation template, {{tl|gbq}}): | |
| − | + | {| | |
| + | | style="border: 1px solid black; vertical-align: top;" | <syntaxhighlight lang="moin" highlight="3,15"> | ||
| + | ==A–M== | ||
| + | |||
| + | {{glossary}} | ||
| + | |||
| + | {{term|1=applesnorkel}} | ||
| + | {{defn|1=Definition of term 1.}} | ||
| + | |||
| + | {{term|term=arglefarst |content=''{{lang|xx|arglefarst}}''{{anchor|argle-farst|argle farst}} }} | ||
| + | {{defn|no=1 |defn=Beginning of first definition of term 2 | ||
| + | {{gbq|1=Block quotation in first definition of term 2.}} | ||
| + | Conclusion of first definition of term 2. | ||
| + | }} | ||
| + | {{defn|no=2 |defn=Second definition of term 2.}} | ||
| − | + | {{glossary end}} | |
| − | + | </syntaxhighlight> | |
| − | + | |- | |
| − | + | | style="border: 1px solid black; vertical-align: top;" | <blockquote><poem> | |
| − | {{ | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | < | ||
{{fake heading|A–M}} | {{fake heading|A–M}} | ||
| Line 57: | Line 48: | ||
{{term|term=|arglefarst|content=''arglefarst''{{anchor|argle-farst|argle farst}} }} <!-- Avoid actually using {{lang}} template in examples, as it generates unwanted transclusions. --> | {{term|term=|arglefarst|content=''arglefarst''{{anchor|argle-farst|argle farst}} }} <!-- Avoid actually using {{lang}} template in examples, as it generates unwanted transclusions. --> | ||
| − | {{defn|no=1 |defn= | + | {{defn|no=1 |defn=Beginning of first definition of term 2 |
| − | Beginning of first definition of term 2 | + | |
{{gbq|1=Block quotation in first definition of term 2.}} | {{gbq|1=Block quotation in first definition of term 2.}} | ||
Conclusion of first definition of term 2. | Conclusion of first definition of term 2. | ||
| Line 65: | Line 56: | ||
{{glossary end}} | {{glossary end}} | ||
| − | </ | + | </poem></blockquote> |
| − | </ | + | |} |
| − | |||
===Scope=== | ===Scope=== | ||
| − | |||
| − | |||
This family of templates, like the underlying definition list code, is {{em|primarily}} intended for definitional uses, but can have other applications. The ''[http://www.w3.org/TR/1999/REC-html401-19991224/struct/lists.html HTML 4.01 Specification]'' itself says: | This family of templates, like the underlying definition list code, is {{em|primarily}} intended for definitional uses, but can have other applications. The ''[http://www.w3.org/TR/1999/REC-html401-19991224/struct/lists.html HTML 4.01 Specification]'' itself says: | ||
{{quote|1=Definition lists...generally consist of a series of term/definition pairs (although definition lists may have other applications). Thus, when advertising a product, one might use a definition list: | {{quote|1=Definition lists...generally consist of a series of term/definition pairs (although definition lists may have other applications). Thus, when advertising a product, one might use a definition list: | ||
| Line 84: | Line 72: | ||
Thus, editors should feel free to use definition list markup as an alternative to bulleted or numbered lists when the material is well-suited to definition list presentation. | Thus, editors should feel free to use definition list markup as an alternative to bulleted or numbered lists when the material is well-suited to definition list presentation. | ||
| − | |||
| − | |||
| − | |||
| − | |||
==See also== | ==See also== | ||
{{glossary templates see also}} | {{glossary templates see also}} | ||
| + | {{HTML lists}} | ||
| − | + | <includeonly>{{Sandbox other|| | |
<!-- CATEGORIES HERE, THANKS --> | <!-- CATEGORIES HERE, THANKS --> | ||
[[Category:Glossary templates]] | [[Category:Glossary templates]] | ||
[[Category:Definition list templates]] | [[Category:Definition list templates]] | ||
}}</includeonly> | }}</includeonly> | ||
Latest revision as of 18:50, 17 November 2020
| This is a documentation subpage for Template:Glossary. It contains usage information, categories and other content that is not part of the original template page. |
Contents
Usage
The template {{glossary}} (a.k.a. {{glossary start}} or {{glossary begin}}) is used with {{glossary end}} to explicitly bracket a glossary or glossary-like description list (also called a definition list or association list), especially in a template-structured glossary, although such lists can be used more generally. This is required (as a technical matter) for template-structured glossaries, and is good practice anywhere description/definition lists are used for glossaries. The template pair invoke the <dl>...</dl> description list HTML element. Unfortunately, the "{{dl}}" mnemonic is not available as a redirect as of this writing.
The pair of templates incidentally prevent Wikipedia's MediaWiki software engine from auto-creating redundant definition list code (<dl>...</dl>) around terms and definitions if they have blank lines between them, as they often do, especially in non-structured glossaries.
Typical usage:
{{glossary}} {{term}} {{defn}} {{glossary end}}
Parameters
|id=can be used to assign a one-word ID name to the glossary. This can be used as a#idlink target, and could have other metadata uses.|style=will pass CSS styling on to the<dl>element. I.e., this styles the definition list itself, as a container, not the individual terms and definitions with it. There is rarely any reason to do this.|class=will pass one or more space-separate CSS classes on to<dl>element, in addition to the automatically included classglossary. There is rarely any reason to do this.
Examples
This shows both a very simple then a rather complex instance in a structured glossary (including an entry with a block quotation, using the glossary block quotation template, {{gbq}}):
==A–M==
{{glossary}}
{{term|1=applesnorkel}}
{{defn|1=Definition of term 1.}}
{{term|term=arglefarst |content=''{{lang|xx|arglefarst}}''{{anchor|argle-farst|argle farst}} }}
{{defn|no=1 |defn=Beginning of first definition of term 2
{{gbq|1=Block quotation in first definition of term 2.}}
Conclusion of first definition of term 2.
}}
{{defn|no=2 |defn=Second definition of term 2.}}
{{glossary end}}
|
|
Scope
This family of templates, like the underlying definition list code, is primarily intended for definitional uses, but can have other applications. The HTML 4.01 Specification itself says:
Definition lists...generally consist of a series of term/definition pairs (although definition lists may have other applications). Thus, when advertising a product, one might use a definition list:
Template:Term
- The new version of this product costs significantly less than the previous one!
Template:Term- We've changed the product so that it's much easier to use!
Template:Term- You can leave your kids alone in a room with this product and they won't get hurt (not a guarantee).
Thus, editors should feel free to use definition list markup as an alternative to bulleted or numbered lists when the material is well-suited to definition list presentation.
See also
{{glossary}}a.k.a.{{gloss}}– Half of a template pair; uses<dl>with a class to open the structured glossary definition list that{{glossend}}closes.{{glossary end}}a.k.a.{{glossend}}– The other half of this template pair; uses</dl>to close the definition list that{{gloss}}opens.{{term}}– The glossary term to which the{{defn}}definition applies; a customized<dt>with a class and an embedded<dfn>.{{defn}}– The definition that applies to the{{term}}; uses<dd>with a class{{ghat}}– a hatnote template properly formatted for the top of a{{defn}}definition{{gbq}}a.k.a.{{gquote}}– a block quotation template properly formatted for inclusion in a{{defn}}definition{{glossary link}}– meta-template for creating shortcut templates for linking to definitions in specific glossaries- Wikipedia:Manual of Style/Glossaries