Difference between revisions of "Template:Internal Link Popup/doc"
m (→Syntax) |
m (Update) |
||
Line 1: | Line 1: | ||
− | |||
− | |||
This template creates an internal link ''and'' a popup that appears when the user's mouse hover over the link, noting them that the linked page does not exist and that they may want to refer to Moegirlpedia in a different language. Workaround is used for mobile users (see below). You may also use the shortcut <code>{{[[Template:ILP|ILP]]<nowiki>}}</nowiki></code>. | This template creates an internal link ''and'' a popup that appears when the user's mouse hover over the link, noting them that the linked page does not exist and that they may want to refer to Moegirlpedia in a different language. Workaround is used for mobile users (see below). You may also use the shortcut <code>{{[[Template:ILP|ILP]]<nowiki>}}</nowiki></code>. | ||
==Prerequisite== | ==Prerequisite== | ||
− | This template | + | This template calls [[:Template:Internal_Link_Popup/style.css|this style sheet]] to work. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Without the stylesheet, or without a hoverable input (e.g. mobile users), the outgoing link will be shown after the internal link and no popups will appear, like this: <span>[[link|<span style="color:#6C9;">link</span>]]<span lang="zh">([[:zh:foreign link]])</span></span>. | Without the stylesheet, or without a hoverable input (e.g. mobile users), the outgoing link will be shown after the internal link and no popups will appear, like this: <span>[[link|<span style="color:#6C9;">link</span>]]<span lang="zh">([[:zh:foreign link]])</span></span>. | ||
− | ==Syntax== | + | == Recommended Syntax == |
#<code><nowiki>{{Internal Link Popup|link|foreign link}}</nowiki></code> | #<code><nowiki>{{Internal Link Popup|link|foreign link}}</nowiki></code> | ||
− | |||
− | |||
#<code><nowiki>{{Internal Link Popup|link|foreign link|lang=language code}}</nowiki></code> | #<code><nowiki>{{Internal Link Popup|link|foreign link|lang=language code}}</nowiki></code> | ||
#<code><nowiki>{{Internal Link Popup|link|foreign link|lang=language code|display=alternate display}}</nowiki></code> | #<code><nowiki>{{Internal Link Popup|link|foreign link|lang=language code|display=alternate display}}</nowiki></code> | ||
Line 53: | Line 17: | ||
Use <code>display</code> as you would the "piped" part of an internal link (<code><nowiki>[[link|THIS PART]]</nowiki></code>); <code><nowiki>{{Internal Link Popup|link|foreign link|display=alternate display}}</nowiki></code> yields {{Internal Link Popup|link|foreign link|display=alternate display}}. | Use <code>display</code> as you would the "piped" part of an internal link (<code><nowiki>[[link|THIS PART]]</nowiki></code>); <code><nowiki>{{Internal Link Popup|link|foreign link|display=alternate display}}</nowiki></code> yields {{Internal Link Popup|link|foreign link|display=alternate display}}. | ||
− | You may specify a language code; only <code>zh</code> and <code>ja</code> is accepted, as these are the only two other language that Moegirlpedia exists in. <code><nowiki>{{Internal Link Popup|link|foreign link|ja}}</nowiki></code> will show up as {{Internal Link Popup|link|foreign link|ja}}. | + | You may specify a language code; only <code>zh</code> and <code>ja</code> is accepted, as these are the only two other language that Moegirlpedia exists in. <code><nowiki>{{Internal Link Popup|link|foreign link|lang=ja}}</nowiki></code> will show up as {{Internal Link Popup|link|foreign link|ja}}. |
If the page in question exists, the message changes and the page will be added to [[:Category:Pages with Unnecessary ILP]]. <code><nowiki>{{Internal Link Popup|Mainpage|foreign link}}</nowiki></code> yields {{Internal Link Popup|Mainpage|foreign link|nocat=true}}. In that case, add appropriate interlanguage link to the existing page, and do not use ILP. | If the page in question exists, the message changes and the page will be added to [[:Category:Pages with Unnecessary ILP]]. <code><nowiki>{{Internal Link Popup|Mainpage|foreign link}}</nowiki></code> yields {{Internal Link Popup|Mainpage|foreign link|nocat=true}}. In that case, add appropriate interlanguage link to the existing page, and do not use ILP. | ||
− | <includeonly>[[Category:Maintenance Templates]][[Category:Informational Templates]]</includeonly><noinclude>[[Category:Template | + | |
+ | == Template Data == | ||
+ | <templatedata> | ||
+ | { | ||
+ | "params": { | ||
+ | "1": { | ||
+ | "label": "internal link", | ||
+ | "description": "the name of the local page", | ||
+ | "example": "Mainpage, Help:Colors/advanced", | ||
+ | "type": "wiki-page-name", | ||
+ | "required": true | ||
+ | }, | ||
+ | "2": { | ||
+ | "label": "Outgoing link", | ||
+ | "description": "The name of the page in Moegirlpedia of a different language to be refered to", | ||
+ | "example": "Mainpage, Help:颜色/高级", | ||
+ | "type": "string", | ||
+ | "required": true | ||
+ | }, | ||
+ | "3": { | ||
+ | "aliases": [ | ||
+ | "lang" | ||
+ | ], | ||
+ | "label": "language code", | ||
+ | "description": "Language code of the referred Moegirlpedia page.", | ||
+ | "example": "zh, ja", | ||
+ | "type": "string", | ||
+ | "default": "zh", | ||
+ | "autovalue": "zh", | ||
+ | "suggested": true | ||
+ | }, | ||
+ | "display": { | ||
+ | "description": "The alternative text you wanted to be displayed; work similarly as how piped links would", | ||
+ | "type": "string" | ||
+ | } | ||
+ | }, | ||
+ | "paramOrder": [ | ||
+ | "1", | ||
+ | "2", | ||
+ | "3", | ||
+ | "display" | ||
+ | ], | ||
+ | "format": "inline", | ||
+ | "description": " " | ||
+ | } | ||
+ | </templatedata> | ||
+ | <includeonly>[[Category:Maintenance Templates]][[Category:Informational Templates]]</includeonly><noinclude>[[Category:Template documentations]]</noinclude> |
Revision as of 19:37, 31 August 2019
This template creates an internal link and a popup that appears when the user's mouse hover over the link, noting them that the linked page does not exist and that they may want to refer to Moegirlpedia in a different language. Workaround is used for mobile users (see below). You may also use the shortcut {{ILP}}
.
Prerequisite
This template calls this style sheet to work.
Without the stylesheet, or without a hoverable input (e.g. mobile users), the outgoing link will be shown after the internal link and no popups will appear, like this: link(zh:foreign link).
Recommended Syntax
{{Internal Link Popup|link|foreign link}}
{{Internal Link Popup|link|foreign link|lang=language code}}
{{Internal Link Popup|link|foreign link|lang=language code|display=alternate display}}
Without a specified language code, the template's default reference language will be Chinese (zh), the largest of all Moegirlpedia by far. For example, the previous code, {{Internal Link Popup|link|foreign link}}
, will show up as linkThis page does not exist in English Moegirlpedia yet. You may want to refer to this page on Chinese Moegirlpedia: foreign link. (zh:foreign link).
Use display
as you would the "piped" part of an internal link ([[link|THIS PART]]
); {{Internal Link Popup|link|foreign link|display=alternate display}}
yields alternate displayThe page "link" does not exist in English Moegirlpedia yet. You may want to refer to this page on Chinese Moegirlpedia: foreign link. (zh:foreign link).
You may specify a language code; only zh
and ja
is accepted, as these are the only two other language that Moegirlpedia exists in. {{Internal Link Popup|link|foreign link|lang=ja}}
will show up as linkThis page does not exist in English Moegirlpedia yet. You may want to refer to this page on Japanese Moegirlpedia: foreign link. (ja:foreign link).
If the page in question exists, the message changes and the page will be added to Category:Pages with Unnecessary ILP. {{Internal Link Popup|Mainpage|foreign link}}
yields MainpageThis page does exist in English Moegirlpedia. You can still refer to this page on Chinese Moegirlpedia: foreign link. (zh:foreign link). In that case, add appropriate interlanguage link to the existing page, and do not use ILP.
Template Data
<templatedata> { "params": { "1": { "label": "internal link", "description": "the name of the local page", "example": "Mainpage, Help:Colors/advanced", "type": "wiki-page-name", "required": true }, "2": { "label": "Outgoing link", "description": "The name of the page in Moegirlpedia of a different language to be refered to", "example": "Mainpage, Help:颜色/高级", "type": "string", "required": true }, "3": { "aliases": [ "lang" ], "label": "language code", "description": "Language code of the referred Moegirlpedia page.", "example": "zh, ja", "type": "string", "default": "zh", "autovalue": "zh", "suggested": true }, "display": { "description": "The alternative text you wanted to be displayed; work similarly as how piped links would", "type": "string" } }, "paramOrder": [ "1", "2", "3", "display" ], "format": "inline", "description": " " } </templatedata>