Template:Glossary/doc: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
(Import template documentation from enwiki and extensively rewrite to make applicable to editors on Kodi Wiki)
 
(Polish and update documentation)
Line 1: Line 1:
{{Documentation subpage}}
{{Documentation subpage}}
== Usage ==
== Usage ==
The {{Tnull|Glossary}} template is used with <code>{{Tl|Glossary end}}</code> to explicitly bracket a glossary or glossary-like description list (also called a definition list or association list). This is a good practice anywhere description/definition lists are used for defining large lists of technical terms. The template pair invoke the {{Tag|dl}} ''description list'' HTML element.
The <code><nowiki>{{</nowiki>[[Template:Glossary|Glossary]]<nowiki>}}</nowiki></code> template is used with <code>{{Tl|Glossary end}}</code> to explicitly bracket a glossary or glossary-like description list (also called a definition list or association list). This is a good practice anywhere lists are used for defining large numbers of technical terms. Together, the template pair invoke the {{Tag|dl|o}} ''description list'' HTML5 element.


The pair of templates incidentally prevent Kodi Wiki's MediaWiki software engine from auto-creating redundant definition list code ({{Tag|dl}}) around terms and definitions if they have blank lines between them, as they often do, especially in non-structured glossaries.
Incidentally, they also prevent the MediaWiki parser engine from creating redundant definition list code ({{Tag|dl|p}}) around terms and definitions if they have blank lines between them, as they often do, especially in non-structured glossaries.


Typical usage:
Typical use most often resembles:


  <span class="example example-bold" style="color: #006400; font-weight: bold;">{{Tnull|Glossary}}</span>
  <span class="example example-bold" style="color: #006400; font-weight: bold;"><nowiki>{{</nowiki>[[Template:Glossary|Glossary]]<nowiki>}}</nowiki></span>
  <span style="color: gray;">{{Tl|Term|1{{=}}<var>term</var>}}</span>
  <span style="color: gray;">{{Tl|Term|1{{=}}<var>term</var>}}</span>
  <span style="color: gray;">{{Tl|Defn|1{{=}}<var>Definition.</var>}}</span>
  <span style="color: gray;">{{Tl|Defn|1{{=}}<var>Definition.</var>}}</span>
  <span class="example example-bold" style="color: #006400; font-weight: bold;">{{Tnull|Glossary end}}</span>
  <span class="example example-bold" style="color: #006400; font-weight: bold;"><nowiki>{{</nowiki>[[Template:Glossary end|Glossary end]]<nowiki>}}</nowiki></span>


=== Parameters ===
=== Parameters ===
Line 20: Line 20:
This shows both a very simple then a rather complex instance in a structured glossary (including an entry with a block quotation):
This shows both a very simple then a rather complex instance in a structured glossary (including an entry with a block quotation):


{| style="border: 1px solid black; border-collapse: collapse;"
{| style="border: 1px solid black; border-collapse: collapse; text-align: left;"
  | style="vertical-align: top;" | <syntaxhighlight lang="moin" highlight="3,15">
  | style="vertical-align: top;" | <syntaxhighlight highlight="2,12">
== A&ndash;M ==
== A&ndash;M ==
{{Glossary}}
{{Glossary}}
{{Term|1=applesnorkel}}
{{Term|1=applesnorkel}}
{{Defn|1=Definition of first term.}}
{{Defn|1=Definition of first term.}}
Line 31: Line 29:
{{Term|term=arglefarst|content=''arglefarst''{{Anchor|argle-farst|argle farst}}}}
{{Term|term=arglefarst|content=''arglefarst''{{Anchor|argle-farst|argle farst}}}}
{{Defn|num=1|defn=Beginning of first definition of second term
{{Defn|num=1|defn=Beginning of first definition of second term
<blockquote class="templatequote glossary-blockquote" style="line-height: 1.5em; margin: 0 0 -1.35em; overflow: hidden; padding: 0 0 1.6em 2.5em; text-align: left;">Block quotation in first definition of second term.</blockquote>
<blockquote class="templatequote glossary-blockquote" style="font: oblique small-caps 500 1.05em/1.4 Georgia, serif; margin: 0 0 -1.35em; padding: 0 0 1.2em 3em;">Block Quotation In First Definition Of Second Term.</blockquote>
Conclusion of first definition of second term.
<span style="margin-left: 19px;">Conclusion of first definition of second term.</span>
}}
}}
{{Defn|num=2|defn=Second definition of second term.}}
{{Defn|num=2|defn=Second definition of second term.}}
{{Glossary end}}
{{Glossary end}}
</syntaxhighlight>
</syntaxhighlight>
  |- style="border-top: 4px dashed darkslategray;"
  |- style="border-top: 4px dashed darkslategray;"
  | style="vertical-align: top;" | <div style="padding-left: 3em; padding-right: 1em; overflow: hidden;">
  | style="vertical-align: top;" | <div style="padding-left: 3em; padding-right: 1em;">
<div style="color: #000000; background: none; overflow: hidden; page-break-after: avoid; font-size: 1.5em; font-family: Georgia,Times,serif; margin-top: 1em; margin-bottom: 0.25em; line-height: 1.3; padding: 0; border-bottom: 1px solid #AAAAAA;">A&ndash;M</div>
<div style="background: none; border-bottom: 1px solid #aaa; color: #000; font: 1.5em/1.3 Georgia, 'Times New Roman', serif; margin-bottom: 0.25em; margin-top: 1em; padding: 0; page-break-after: avoid;">A&ndash;M</div>
 
{{Glossary}}
{{Glossary}}
{{Term|applesnorkel}}
{{Term|applesnorkel}}
{{Defn|1=Definition of first term.}}
{{Defn|1=Definition of first term.}}


{{Term|term=arglefarst|content=''arglefarst''{{Anchor|argle-farst|argle farst}}}}
{{Term|term=arglefarst|content=''arglefarst''{{Anchor|argle-farst|argle farst}}}}
{{Defn|num=1|defn=Beginning of first definition of second term
{{Defn|num=1|defn=Beginning of first definition of second term<blockquote class="templatequote glossary-blockquote" style="font: oblique small-caps 500 1.05em/1.4 Georgia, serif; margin: 0 0 -1.35em; padding: 0 0 1.2em 3em;">Block Quotation In First Definition Of Second Term.</blockquote><span style="margin-left: 19px;">Conclusion of first definition of second term.</span>}}
<blockquote class="templatequote glossary-blockquote" style="line-height: 1.5em; margin: 0 0 -1.35em; overflow: hidden; padding: 0 0 1.6em 2.5em; text-align: left;">Block quotation in first definition of second term.</blockquote>
Conclusion of first definition of second term.
}}
{{Defn|num=2|defn=Second definition of second term.}}
{{Defn|num=2|defn=Second definition of second term.}}
{{Glossary end}}
{{Glossary end}}
</div>
</div>
Line 59: Line 50:


=== Scope ===
=== Scope ===
This family of templates, like the underlying definition list code, is <em>primarily</em> 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</em> intended for definitional uses, but can have other applications. The ''[https://www.w3.org/TR/WCAG21/ Web Content Accessibility Guidelines (WCAG) 2.1]'' and the ''[https://html.spec.whatwg.org/multipage/grouping-content.html#the-dl-element HTML 5.01 Specification]'' say:
<blockquote>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:
<blockquote>
The '''{{Red|dl}}''' element represents an ''association list'' consisting of … name-value groups (a description list). … Name-value groups may be terms and definitions, metadata topics and values, questions and answers, or any other groups of name-value data. Thus, when advertising a product, one might use a definition list:
{{Glossary}}
{{Glossary}}
{{Term|Lower cost}}
{{Term|Lower cost}}
Line 68: Line 60:
{{Term|Safe for kids}}
{{Term|Safe for kids}}
{{Defn|You can leave your kids alone in a room with this product and they won't get hurt (not a guarantee).}}
{{Defn|You can leave your kids alone in a room with this product and they won't get hurt (not a guarantee).}}
{{Glossary end}}</blockquote>
{{Glossary end}}
</blockquote>
 
Accordingly, editors should feel free to use definition list markup as an alternative to bulleted or numbered lists when the material is well-suited to that style of 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.<includeonly>
=== See also ===
* {{Tl|Glossary end}}
* {{Tl|Term}}
* {{Tl|Defn}}<includeonly>




<!-- CATEGORIES HERE, THANKS -->
<!-- CATEGORIES HERE, THANKS -->
[[Category:Definition list templates]]
[[Category:Definition list templates]]
[[Category:Glossary templates]]</includeonly>
[[Category:Glossary templates]]</includeonly><noinclude>
[[Category:Template documentation pages]]</noinclude>

Revision as of 03:53, 6 March 2022

Usage

The {{Glossary}} template is used with {{Glossary end}} to explicitly bracket a glossary or glossary-like description list (also called a definition list or association list). This is a good practice anywhere lists are used for defining large numbers of technical terms. Together, the template pair invoke the <dl> description list HTML5 element.

Incidentally, they also prevent the MediaWiki parser engine from 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 use most often resembles:

{{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 #id link target, and could have other metadata uses.
  • |style= will pass CSS styling on to the <dl> element. 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-delimited CSS classes on to the <dl> element, in addition to the automatically included class glossary. There is rarely any reason to do this, either.

Examples

This shows both a very simple then a rather complex instance in a structured glossary (including an entry with a block quotation):

== A&ndash;M ==
{{Glossary}}
{{Term|1=applesnorkel}}
{{Defn|1=Definition of first term.}}

{{Term|term=arglefarst|content=''arglefarst''{{Anchor|argle-farst|argle farst}}}}
{{Defn|num=1|defn=Beginning of first definition of second term
<blockquote class="templatequote glossary-blockquote" style="font: oblique small-caps 500 1.05em/1.4 Georgia, serif; margin: 0 0 -1.35em; padding: 0 0 1.2em 3em;">Block Quotation In First Definition Of Second Term.</blockquote>
<span style="margin-left: 19px;">Conclusion of first definition of second term.</span>
}}
{{Defn|num=2|defn=Second definition of second term.}}
{{Glossary end}}
A–M
applesnorkel
Definition of first term.
arglefarst
1.  Beginning of first definition of second term

Block Quotation In First Definition Of Second Term.

Conclusion of first definition of second term.
2.  Second definition of second term.

Scope

This family of templates, like the underlying definition list code, is primarily intended for definitional uses, but can have other applications. The Web Content Accessibility Guidelines (WCAG) 2.1 and the HTML 5.01 Specification say:

The dl element represents an association list consisting of … name-value groups (a description list). … Name-value groups may be terms and definitions, metadata topics and values, questions and answers, or any other groups of name-value data. Thus, when advertising a product, one might use a definition list:

Lower cost
The new version of this product costs significantly less than the previous one!
Easier to use
We've changed the product so that it's much easier to use!
Safe for kids
You can leave your kids alone in a room with this product and they won't get hurt (not a guarantee).

Accordingly, editors should feel free to use definition list markup as an alternative to bulleted or numbered lists when the material is well-suited to that style of presentation.

See also