Шаблон:Glossary link — разлика између измена

Садржај обрисан Садржај додат
+
 
+
 
Ред 1:
<dfn id="{{{id|}}}">[[:en:{{{glossary|}}}#{{lcfirst:{{{term|{{{1}}}}}}}}|<span title="See entry {{#if:{{{glossary|}}}|at: {{{glossary}}}|on this page at}} &sect;&#8198;{{{term|{{{1}}}}}}" style="color:{{{color|inherit}}}; {{{style|}}}" class="{{{class|}}}">{{#if:{{{text|{{{2|}}}}}}|{{{text|{{{2}}}}}}|{{{term|{{{1}}}}}}}}</span>]]</dfn><noinclude>
{{Documentation subpage|[[Template:Cuegloss]]}}
<!--Categories go in the /doc subpage.-->
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
{{Documentation}}
The {{tlx|cuegloss}} template is used to create links from a word or phrase to corresponding entry in the [[glossary of cue sports terms]] article. It makes proper use of the <code><nowiki><dfn></nowiki></code> HTML element (as documented at the parent meta-template, [[Template:glossary link]]). The {{tlx|glossary link internal}} variant, which does not use that markup (it is reserved for term entries), is usually used only inside the glossary itself, for cross-references to other entries within it, though it can also be used in other articles where the same term is linked twice because of article length (<code><nowiki><dfn></nowiki></code> should only be used once per term per page, as it means "this is the defining instance of this term on this page").
</noinclude>
 
==Usage==
 
Syntax:
From an article to the glossary:
*{{tlx|cuegloss|<var>term in glossary</var>|<var>text in article</var>}}
If the text being linked matches the name of (or an anchor present at) the glossary entry, regardless of upper or lower case, you can simply do:
*{{tlx|cuegloss|<var>text in article that is a term in glossary</var>}}
It will also handle suffixes like plurals, etc., added onto it:
*<code><nowiki>{{</nowiki>cuegloss|<var>text in article that is a term in glossary</var><nowiki>}}</nowiki>ized</code>
 
or (in [[glossary of cue sports terms]] itself, or for duplicate links in same article):
*{{tlx|glossary link internal|<var>term in glossary</var>|<var>text in article</var>}}
 
This template makes it very simple to add links, in article prose, talk pages, etc., to entries in the [[Glossary of cue sports terms]], a [[WP:MOSGLOSS|stand-alone glossary]] list article. It takes one or two parameters, depending on needs, as detailed below.
 
If <var>term in glossary</var> (or <var>text in article that is a term in glossary</var>) contains a double quote (") character, it {{em|must}} be escaped as <code>&amp;quot;</code> or the second half of tooltip will not show up <small>[Note to maintainers: This should be fixed at [[Template:Glossary link]] and [[Template:Glossary link internal]] with URL encoding or some other form of detection and escaping.]</small>:
{{in5}}{{xt|Right:}} {{tnull|cuegloss|&amp;quot;D&amp;quot;, the|the "D"}} which gives {{cuegloss|&quot;D&quot;, the|the "D"}}<br />
{{in5}}{{!xt|Wrong:}} {{tnull|cuegloss|"D", the|the "D"}} which gives {{cuegloss|"D", the|the "D"}}
It is easiest to simply create an anchor in the glossary at that entry with {{tlx|anchor|the D|...}}, so we can do {{!xt|{{tnull|cuegloss|the D|the "D"}}}}. This has already been done for this entry, but keep this in mind when adding any new entries that include double quotes.
 
Wikitext example:
 
{{in5}}<code>In bank pool, all shots must be <nowiki>{{Cuegloss|Bank shot|banked}}</nowiki>.</code>
 
Result:
 
{{in5}}In bank pool, all shots must be {{Cuegloss|Bank shot|banked}}.
 
This template also supports this sort of usage, exactly as a regular wikilink would: <code><nowiki>{{Cuegloss|Bank shot|bank}}ed</nowiki></code>.
 
The first parameter is the <em>exact</em> name of the term to be linked to in [[glossary of cue sports terms]] (or any alias of it as defined in the glossary with {{tlx|anchor}}), and the second parameter is the text string to be wikilinked from in the article. Lower-case versions of the
 
For example, in this case the term to be defined is covered at [[Glossary of cue sports terms#bank shot]], so ''Bank shot'' is the first parameter.
The second parameter is optional if the text string to be wikilinked from in the article is exactly the same (including case, plurality, etc.) as the glossary term (or alternative {{tnull|anchor}}}} in the first parameter:
 
:<code><nowiki>{{Cuegloss|Bank shot}}s</nowiki> are the only shot type used in bank pool.</code>
 
Result:
 
:{{Cuegloss|Bank shot}}s are the only shot type used in bank pool.</code>
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Cue sports templates]]
[[Category:Glossary link templates]]
}}</includeonly>