قالب:Glossary link/doc
هذه صفحة توثيق فرعية لـ Template:Glossary link and Template:Glossary link internal. تتضمن معلومات الاستعمال، التصنيفات وأي محتوى آخر ليس من محتويات الأصل لصفحة القالب. |
Usage
The template {{glossary link}}
and its variant {{glossary link internal}}
are meta-templates for creating templates that make structured links to particular entries in topical glossaries; they should never be used directly in an article. The documentation below explains how to use them for your topic's structured glossary. Like {{dfn}}
, it uses the <dfn>
HTML element properly. Unlike {{dfn}}
, which is just invisible metadata, this template also uses the light dashed underline style that has become a de facto Web standard for definitional markup. Because it does in fact link to another page as well to provide the definition, it retains the blue link color like any other wikilink. Due to lack of what would be a pretty sophisticated facility in the MediaWiki parser, there is no way to have the definition in the glossary be pulled into a pop-up tooltip on mouseover, which would be really cool. Maybe someday. For now it shows the article title and entry name.
(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 very geeky and backasswards HTML5 specs on the handing of the title
attribute of <dfn>
, which is the exact term defined, not its definition).
Syntax
{{glossary link|glossary=glossary article|term=term in glossary}}
results in: term in glossary
{{glossary link|glossary=glossary article|term=term in glossary|text=text in article}}
results in: text in article
The {{glossary link internal}}
variant works exactly the same, but is used inside the glossary itself to provide cross-references between entries, and is also used when the same term is linked twice in other articles (e.g. because the article is very long). Its only difference from {{glossary link}}
is that it does not use <dfn>
, since it is only supposed to be used once per page per term, and it does not blue-link the link, only underlines it like {{dfn}}
does, since we don't want to create a "sea of blue" link mess.
Each version of the template takes three case-sensitive, named parameters for its data (the first two mandatory):
|glossary=the name of the glossary article to be linked to
|term=the term entry in the glossary to be linked to
(or any{{anchor}}
for it); a double quote (") character must be escaped as"
or the second half (term) of tooltip will not show up. Templates based on this one need to mention this prominently in their documentation.|text=the actual text in the article to be linked from, if different from the term linked to
Limitations: The glossary and term parameters cannot have any HTML or wiki markup; they are basically parts of URLs (namely http://en.wikipedia.org/wiki/glossary#term
). If styling is needed (e.g. italics for a non-English term or a book title), it must be done around the entire template or inside the text
parameter.
A fourth |color=
parameter allows the color of the text to be changed. This should only be done when the rest of the text is also another color for some reason, e.g. because of white text in a dark-background table cell. The parameter will accept established HTML/CSS color names (e.g. white
) and hex values (e.g. #FFFFFF
), and is spelled "color
" since this is the spelling used by HTML and CSS.
Some little-used parameters that are there just in case:
|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)
Glossary entry formatting
Example code
The template {{cuegloss}}
for cue sports:
{{glossary link |glossary=Glossary of cue sports terms |term={{{1}}} |text={{{2|}}} }}
The {{cuegloss2}}
variant is used only inside the glossary of cue sports terms article:
{{glossary link internal |glossary=Glossary of cue sports terms |term={{{1}}} |text={{{2|}}} }}
For real-world application, see Template:Cuegloss/doc, the Glossary of cue sports terms article, and articles like nine-ball that use the template to link to terms in the glossary.
Transclusion limits
If templates at the bottom the glossary (or very long articles) start not appearing because the maximum number of transclusions per page has been reached, take your glossary's implementation of this template (e.g. {{cuegloss}} and {{cuegloss2}} in the above examples) and replace their code with customized code from this template, instead of a transclusion of this template. This had to done with {{cuegloss2}} in February 2012, so you can use it as a model.
See also
- {{gloss}}, {{glossend}}, {{term}} and {{defn}}, the glossary structure templates
- {{dfn}} the more general
<dfn>
template