Fyrimynd:Glossary link/doc
Hetta er ein dokumentatión undirsíða til Template:Glossary link and Template:Glossary link internal. Hon inniheldur kunning um nýtsluna, bólkar og um annað innihald, ið ikki er við í uppruna fyrimynd síðuni. |
Nýtsla
rættaThe template {{glossary link}}
and its variant {{glossary link internal}}
({{gli}}
for short) are meta-templates for creating templates that make structured links to particular entries in topical glossaries (e.g. the {{cuegloss}}
template); they should not be used directly in an article. The documentation below explains how to use them for your topic's . Like {{dfn}}
, it uses the <dfn>
HTML element properly. (Note that {{glossary link internal}}
necessarily does not use it; <dfn>
should only be used once per term on a single page.)
{{Glossary link}}
creates a normal blue link. To prevent the "sea of blue" effect, {{Glossary link internal}}
uses the light dashed underline style that has become a de facto Web standard for definitional markup.[1]
Tech detail: By using an internal <span>...</span>
with its own independent title
attribute for a tool tip, 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.
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 Glossary article title (if on another page) and what the entry's name is, as specified by the template. This should replace the default Wikipedia tooltip for such a link, which would only give the article title.
Syntax (basic use cases)
rætta- Linking from regular article prose to glossary entries
- Use a term as it appears in a separate glossary article:
{{glossary link|glossary=Glossary of botanical terms|utricle}}
– gives: utricle - Use an alternative term, linking to the related term in a separate glossary article:
{{glossary link|glossary=Glossary of botanical terms|utricle|utricular}}
– gives: utricular
- Use a term as it appears in the glossary section of the same article:
{{glossary link|chicken nugget}}
– gives: chicken nugget - Use an alternative term, linking to a the related term in the glossary section of the same article:
{{glossary link|chicken nugget|Compressed and breaded poultry snacks}}
– gives: Compressed and breaded poultry snacks
Normally this is done with a derived, glossary specific template. For example, {{glossary link|glossary=Glossary of cue sports terms|massé}}
can be done simply with {{cuegloss|massé}}
.
- Linking between glossary entries
We use the {{glossary link internal}}
variant to not plaster the page with blue links; ones that go to full articles on terms will thus stand out from links to other short definitions in the same glossary:
- Use a term as it appears within the same glossary page:
{{glossary link internal|Example code}}
– gives: Example code - Use an alternative term, linking to the related term within the same glossary page:
{{glossary link internal|Example code|some examples}}
– gives: some examples
- Use a term as it appears on a different page of the same multi-page glossary:
{{glossary link internal|glossary=Glossary of education terms (M–O)|MEB}}
– gives: MEB - Use an alternative term, linking to the related term on a different page of the same multi-page glossary:
{{glossary link internal|glossary=Glossary of education terms (M–O)|MEB|Master's in European Business}}
– gives: Master's in European Business
Normally this is done with the {{gli}}
shortcut. For example, {{glossary link internal|Example code}}
can be shortened to {{gli|Example code}}
.
Syntax (geeky version)
rætta{{glossary link|glossary=glossary article|term=term in glossary}}
results in: term in glossary{{glossary link|glossary=glossary article|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{{glossary link|glossary=glossary article|term in glossary|text in article}}
results in: text in article{{glossary link|term in glossary}}
results in: text in article{{glossary link|term in glossary|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, since we don't want to create a "sea of blue" link mess.
{{glossary link internal|term in glossary}}
results in: text in article{{glossary link internal|term in glossary|text in article}}
results in: text in article
Each version of the template takes three case-sensitive, named parameters for its data:
|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
rættaExample code
rættaThe template {{cuegloss}}
for cue sports:
{{glossary link |glossary=Glossary of cue sports terms |term={{{1}}} |text={{{2|}}} }}
The {{glossary link internal}}
variant is used inside such an article as Glossary of cue sports terms:
{{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.
See also
rætta- {{glossary}}, {{glossary end}}, {{term}} and {{defn}}, the glossary structure templates
- {{dfn}} the more general
<dfn>
template
Keldur
rætta