Difference between revisions of "Template:IPA link/doc"

From blackwiki
Jump to navigation Jump to search
imported>Nardog
 
(102 intermediate revisions by 21 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
+
<!-- Categories go where indicated at the bottom of this page, please; interwikis go to Wikidata (see also: [[Wikipedia:Wikidata]]). -->
{{SpecialChars}}
+
{{lua|Module:IPA symbol}}
The templates {{tl|IPAlink}} and {{tl|IPAblink}} automatically [[wikilink]] as IPA symbol to the respective sound article. IPAlink displays only the IPA letters; IPAblink (IPA bracket link) displays them within [brackets].  
+
The template {{tl|IPA link}} takes an IPA symbol and turns it into a link to the respective article which discusses the sound the symbol represents.
  
The conversion table is not defined in this template, but inherited from {{tl|IPAsym}}.
+
Versions with defined brackets are also available:
 +
* For phonetic representations, {{tl|IPAblink}} encloses the link in square brackets: {{IPAblink|a}}
 +
* For phonemic representations, {{tl|IPAslink}} encloses the link in slashes: {{IPAslink|a}}
 +
* For orthographic representations, {{tl|IPAalink}} encloses the link in angle brackets: {{IPAalink|a}}
  
=== Usage ===
+
Another version is {{tl|IPAplink}}, which encloses the link in neither brackets nor {{tag|span|attribs=class="IPA"}}, which is useful if the link is already inside {{tl|IPA}}, avoiding superfluous nesting of the same class.
These templates have only one parameter. If the IPA symbol is not defined in the IPAsym table, then the argument is linked to "[[{{IPAsym|this is definitely not in the table}}]]", but please note that a change to this is [[Template_talk:IPAsym#Default_string|under discussion]].
 
  
:<tt><nowiki>{{IPAlink|m}}</nowiki></tt> &rarr; {{IPAlink|m}}
+
== Usage ==
:<tt><nowiki>{{IPAlink|ɡb}}</nowiki></tt> &rarr; {{IPAlink|ɡb}}
+
'''First parameter''' (required): any IPA symbol.
:<tt><nowiki>{{IPAblink|m}}</nowiki></tt> &rarr; {{IPAblink|m}}
+
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|m}}</code> → {{{{BASEPAGENAME}}|m}}
:<tt><nowiki>{{IPAblink|ɡb}}</nowiki></tt> &rarr; {{IPAblink|ɡb}}
+
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|ɡb}}</code> {{{{BASEPAGENAME}}|ɡb}}
:<tt><nowiki>{{IPAlink|pʰɪk}}</nowiki></tt> &rarr; {{IPAlink|pʰɪk}}
 
  
The latter is normally more an example of accidental misuse than intentional use, or it could be a sign that a symbol is missing from the {{tl|IPAsym}} table.
+
'''Second parameter''': changes the label of the wikilink.
 +
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|m|Any text}}</code> → {{{{BASEPAGENAME}}|m|Any text}}
  
=== Extending this template ===
+
'''Audio link'''
Please keep this template simple. In particular, please preserve the only responsibility of this template to providing a wikilink to the corresponding sound. If you wish to add new features, like enclosing the link in <code><nowiki><big>...</big></nowiki></code> tags, please create a new template (for example [[Template:IPAbiglink]]).
 
  
=== See also ===
+
{{para|audio|yes}} adds a link to the corresponding audio file:
{{tl|IPAsym}} – Provides the conversion table for this template. Input: IPA-symbol. Returns: Wikipedia-article name.
+
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|ɽ|audio=yes}}</code> → {{{{BASEPAGENAME}}|ɽ|audio=yes}}
  
<includeonly><!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
+
If the value in {{para|audio}} is not "yes", "y", "true", etc., it is treated as the name of an audio file:
[[Category:IPA_templates]]
+
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|ɽ|audio=Retroflex flaps.ogg}}</code> → {{{{BASEPAGENAME}}|ɽ|audio=Retroflex flaps.ogg}}
</includeonly>
+
 
 +
If the audio file is not specified at [[Module:IPA symbol/data]], the link will not appear:
 +
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|s̬|audio=yes}}</code> → {{{{BASEPAGENAME}}|s̬|audio=yes}}
 +
 
 +
'''Errors'''
 +
 
 +
If the IPA symbol is not defined at [[Module:IPA symbol/data]], then an error message is returned and the page will be categorized into [[:Category:International Phonetic Alphabet pages needing attention]].
 +
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|xyz}}</code> → {{{{BASEPAGENAME}}|xyz}}
 +
 
 +
The error message can be customized in {{para|errortext}}. This cancels the addition of the error category. If set to <code>blank</code>, the message will not appear at all.
 +
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|xyz|errortext=Custom error message}}</code> → {{{{BASEPAGENAME}}|xyz|errortext=Custom error message}}
 +
* <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|xyz|errortext=blank}}</code> → {{{{BASEPAGENAME}}|xyz|errortext=blank}}
 +
 
 +
{{IPA templates}}
 +
 
 +
{{collapse top|TemplateData}}
 +
<templatedata>
 +
{
 +
"params": {
 +
"1": {
 +
"label": "IPA symbol",
 +
"description": "IPA symbol whose article to link to",
 +
"example": "ʉː",
 +
"type": "string",
 +
"required": true
 +
},
 +
"2": {
 +
"label": "Display text",
 +
"description": "Text to show instead of the IPA symbol",
 +
"type": "string"
 +
},
 +
"audio": {
 +
"label": "Audio",
 +
"description": "Adds a link to sound if available",
 +
"example": "yes",
 +
"type": "string"
 +
},
 +
"errortext": {
 +
"label": "Error text",
 +
"example": "blank",
 +
"type": "string"
 +
}
 +
}
 +
}
 +
</templatedata>
 +
{{collapse bottom}}
 +
<includeonly>{{sandbox other||
 +
<!-- Categories go below this line, please; interwikis go to Wikidata, thank you! -->
 +
[[Category:IPA symbol templates]]
 +
[[Category:Templates that add a tracking category]]
 +
}}</includeonly>

Latest revision as of 23:06, 11 February 2019

The template {{IPA link}} takes an IPA symbol and turns it into a link to the respective article which discusses the sound the symbol represents.

Versions with defined brackets are also available:

  • For phonetic representations, {{IPAblink}} encloses the link in square brackets: [a]
  • For phonemic representations, {{IPAslink}} encloses the link in slashes: /a/
  • For orthographic representations, {{IPAalink}} encloses the link in angle brackets: ⟨a

Another version is {{IPAplink}}, which encloses the link in neither brackets nor <span class="IPA">...</span>, which is useful if the link is already inside {{IPA}}, avoiding superfluous nesting of the same class.

Usage

First parameter (required): any IPA symbol.

  • {{IPA link|m}}m
  • {{IPA link|ɡb}}ɡb

Second parameter: changes the label of the wikilink.

Audio link

|audio=yes adds a link to the corresponding audio file:

  • {{IPA link|ɽ|audio=yes}}ɽ (Audio file "Retroflex flap.ogg" not found)

If the value in |audio= is not "yes", "y", "true", etc., it is treated as the name of an audio file:

If the audio file is not specified at Module:IPA symbol/data, the link will not appear:

  • {{IPA link|s̬|audio=yes}}

Errors

If the IPA symbol is not defined at Module:IPA symbol/data, then an error message is returned and the page will be categorized into Category:International Phonetic Alphabet pages needing attention.

  • {{IPA link|xyz}}Error using {{IPA symbol}}: "xyz" not found in list

The error message can be customized in |errortext=. This cancels the addition of the error category. If set to blank, the message will not appear at all.

  • {{IPA link|xyz|errortext=Custom error message}} → Custom error message
  • {{IPA link|xyz|errortext=blank}}
TemplateData

No description.

Template parameters

ParameterDescriptionTypeStatus
IPA symbol1

IPA symbol whose article to link to

Example
ʉː
Stringrequired
Display text2

Text to show instead of the IPA symbol

Stringoptional
Audioaudio

Adds a link to sound if available

Example
yes
Stringoptional
Error texterrortext

no description

Example
blank
Stringoptional