Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

User:Evon R'al/Wiki coding notes: Difference between revisions

From EVE University Wiki
m Special cases: Add missing >
m More notes on linking.
Line 42: Line 42:


=== Linking ===
=== Linking ===
==== Wiki internal ====
See also: [[mediawikiwiki:Help:Links]]


'''Syntax:''' <code><nowiki>[[<Namespace>:<Page name>#<Anchor>|<Display>]]</nowiki></code>
==== Piped link ====
; Namespace : The namespace of the page, separated from the Page name by a colon(:). Default is the main namespace. Options: User, Template, etc. Namespace is NOT case sensitive.
A piped link is an internal or [[#interwiki|interwiki]] link where the link target and link label are both specified.
; Page name : The name of the page<ref name="main">In the main namespace called article</ref>. Page name is case sensitive with the exception of the first letter.
; Anchor : To an ID somewhere inside a page. Anchor must be preceded by a #. Headings have an automatic ID identical to the header name. ID can be added manually by using {{T|Anchor}} or adding an <code>ID=</code> manually.ID's must be unique. Anchor's are case sensitive.
; Display : The text that appears visible. Only needed when different from the linking part. Display is preceded by the pipe(|) symbol


Internal wiki links check the existence of the target page. If the page doesn't exist, is misspelled or the case is incorrect the link turns [[redlink|red]].
==== Internal ====
Internal (or intrawiki) links check the existence of the target page. If the page doesn't exist, is misspelled or the case is incorrect the link turns [[redlink|red]].
 
'''Syntax:''' <code><nowiki>[[<namespace>:<page name>#<anchor>|<label>]]</nowiki></code>
:; Namespace : The namespace of the page, separated from the Page name by a colon(:). Default is the main namespace. Options: User, Template, etc. Namespace is NOT case sensitive.
:; Page name : The name of the page<ref name="main">In the main namespace called article</ref>. Page name is case sensitive with the exception of the first letter.
:; Anchor : To an ID somewhere inside a page. Anchor must be preceded by a #. Headings have an automatic ID identical to the header name. ID can be added manually by using {{T|Anchor}} or adding an <code>ID=</code> manually. ID's must be unique. Anchor's are case sensitive.
:; Label : The text that appears visible. Only needed when different from the linking(target) part. the label is preceded by the pipe(|) symbol


'''Usage:'''
'''Usage:'''
; Page name only : Using the page name only links to a page<ref name="main" /> in the main namespace with display identical to page name:<br>
:; Page name only : Using the page name only links to a page<ref name="main" /> in the main namespace with display identical to page name:<br>
<nowiki>[[Venture]]</nowiki> results in [[Venture]]<br>
<code><nowiki>[[Venture]]</nowiki></code> results in [[Venture]]<br>
As the first letter is not case sensitive <nowiki>[[venture]]</nowiki> also results in a valid link [[venture]]
As the first letter is not case sensitive <code><nowiki>[[venture]]</nowiki></code> also results in a valid link [[venture]]
 
{{Note box|'''Link end "trick"''' (Word-ending links)
Putting text directly connecting to the closing ]] results in that text being added to the displayed text.<br>
<code><nowiki>[[Venture]]s</nowiki></code> results in [[Venture]]s while the link still goes to Venture.<br>
<code><nowiki>[[Venture]]abunchofletters</nowiki></code> results in [[Venture]]abunchofletters while the link still goes to Venture.


; Link end "trick". : Putting text directly connecting to the closing ]] results in that text being added to the displayed text.<br>
For more details see: [[mediawikiwiki:Help:Links]]
<nowiki>[[Venture]]s</nowiki> results in [[Venture]]s while the link still goes to Venture.<br>
|italics= no}}
<nowiki>[[Venture]]abunchofletters</nowiki> results in [[Venture]]abunchofletters while the link still goes to Venture.


; Namespace and Page name
:; Namespace and Page name : To go to a page outside the main namespace the namespace needs to be added to the link
: To go to a page outside the main namespace the namespace needs to be added to the link
<code><nowiki>[[User:Evon R'al]]</nowiki></code> gives [[User:Evon R'al]]<br>
<nowiki>[[User:Evon R'al]]</nowiki> gives [[User:Evon R'al]]<br>
<code><nowiki>[[UniWiki:Manual of Style]]</nowiki></code> gives [[UniWiki:Manual of Style]]
<nowiki>[[UniWiki:Manual of Style]]</nowiki> gives [[UniWiki:Manual of Style]]


; Page name and Anchor : Using a Page name and an Anchor gets to a specific location within a page.
:; Page name and Anchor : Using a Page name and an Anchor gets to a specific location within a page.
: Using an Anchor only, leads to a specific location within the page.
:: Using an Anchor only, leads to a specific location within the page.
<nowiki>[[combat sites#Expeditions]]</nowiki> gives [[combat sites#Expeditions]]<br>
<code><nowiki>[[combat sites#Expeditions]]</nowiki></code> gives [[combat sites#Expeditions]]<br>
The existence of the page is still checked, but the existence of the anchor is not.<br>
The existence of the page is still checked, but the existence of the anchor is not.<br>
Note: If a non existing anchor is used the link goes to the top of the page.<br>
Note: If a non existing anchor is used the link goes to the top of the page.<br>
<nowiki>[[combat sites#no exist]]</nowiki> gives [[combat sites#no exist]], leading ot the top of the combat sites page
<code><nowiki>[[combat sites#no exist]]</nowiki></code> gives [[combat sites#no exist]], leading ot the top of the combat sites page
 
<code><nowiki>[[#Signatures]]</nowiki></code> gives [[#Signatures]] leading to the Signatures heading on this page.
 
:; Page name and label
<code><nowiki>[[Venture|Venture]]</nowiki></code> results in [[Venture|Venture]]. More then double the amount of typing for the same result as when using a page name only link and more cluttered reading in the source.<br>
But when doing this: <code>Example of a <nowiki>[[Venture|mining]]</nowiki> frigate</code>, we get "Example of a [[Venture|mining]] frigate" leading to the Venture article.
 
The use of label is particularly useful when namespaces or anchors are used. To increase readability.<br>
<code><nowiki>[[User:Evon R'al|Evon R'al]]</nowiki>'s user page</code> gives [[User:Evon R'al|Evon R'al]]'s user page<br>
<code>A link to <nowiki>[[combat sites#Expeditions|Expeditions]]</nowiki></code> gives "A link to [[combat sites#Expeditions|Expeditions]]".
{{Note|While not particularly useful the link end trick will work.}}
 
{{Note box|'''Pipe trick''':


<nowiki>[[#Signatures]]</nowiki> gives [[#Signatures]] leading to the Signatures heading on this page.
The pipe trick uses the pipe character ("{{!}}") to save typing the label of a piped link for several kinds of wiki links. This can avoid potentially making an error while typing the label.<br>
The basic rule when the pipe trick is used is that an (initial) namespace prefix, a final part beginning with a comma, or a final parenthesis is suppressed in the rendering of the link.<br>
The expansion of the text happens when saving. The expansion is also visible when previewing the edit making it possible to check if it gives the desired result.


; Page name and display
Example's:
<nowiki>[[Venture|Venture]]</nowiki> results in [[Venture|Venture]]. More then double the amount of typing for the same result as when using a page name only link and more cluttered reading in the source.<br>
But when doing this: Example of an <nowiki>[[Venture|mining]]</nowiki> frigate, we get Example of a [[Venture|mining]] frigate.


The use of display is particularly useful when namespaces or anchors are used. To increase readability.<br>
Typing <code><nowiki>[[User:Evon R'al|]]</nowiki></code> will produce <nowiki>[[User:Evon R'al|Evon R'al]]</nowiki>.<br>
<nowiki>[[User:Evon R'al|Evon R'al]]</nowiki>'s user page gives [[User:Evon R'al|Evon R'al]]'s user page<br>
<code><nowiki>[[Guardian's Gala (2020)|]]</nowiki></code> gives <nowiki>[[Guardian's Gala (2020)|Guardian's Gala]]</nowiki>
A link to <nowiki>[[combat sites#Expeditions|Expeditions]]</nowiki> gives A link to [[combat sites#Expeditions|Expeditions]]<br>


For more details see [[wikipedia:Help:Pipe trick]] and [[metawikipedia:Help:Piped link]]
|italics= no}}


===== Special cases =====
===== Special cases =====
; File namespace
; File namespace
<nowiki>[[File:Helpicon.png]]</nowiki> gives [[File:Helpicon.png]] the file embedded at the location of the link.<br>
<code><nowiki>[[File:Helpicon.png]]</nowiki></code> gives [[File:Helpicon.png]] the file embedded at the location of the link.<br>
To get a link to the file page the namespace needs to be preceded by a colon (:)<br>
To get a link to the file page the namespace needs to be preceded by a colon (:)<br>
<nowiki>[[:File:Helpicon.png]]</nowiki> gives [[:File:Helpicon.png]] a link to the file page.<br>
<code><nowiki>[[:File:Helpicon.png]]</nowiki></code> gives [[:File:Helpicon.png]] a link to the file page.<br>
<nowiki>[[:File:Evon R'al.jpg]]</nowiki> gives [[:File:Evon R'al.jpg]]<br>
<code><nowiki>[[:File:Evon R'al.jpg]]</nowiki></code> gives [[:File:Evon R'al.jpg]]<br>
Display can be used like <nowiki>[[:File:Evon R'al.jpg|Evon R'al]]</nowiki> to change the presentation: The file page of [[:File:Evon R'al.jpg|Evon R'al]]'s portrait.<br>
A label can be used like <code><nowiki>[[:File:Evon R'al.jpg|Evon R'al]]</nowiki></code> to change the presentation: The file page of [[:File:Evon R'al.jpg|Evon R'al]]'s portrait.<br>
For parameters to influence size and placement of a file see [[Mediawikiwiki:Help:Images]]
For parameters to influence size and/or placement of a file see [[Mediawikiwiki:Help:Images]]


; Media namespace : Is a virtual namespace which gives a direct link to a file.
; Media namespace : Is a virtual namespace which gives a direct link to a file.
<nowiki>[[Media:Evon R'al.jpg]]</nowiki> gives [[Media:Evon R'al.jpg]]<br>
<code><nowiki>[[Media:Evon R'al.jpg]]</nowiki></code> gives [[Media:Evon R'al.jpg]] (follow the link to see the difference)<br>
Display can be used: <nowiki>[[Media:Evon R'al.jpg|portrait]]</nowiki> to get Evon R'al's [[Media:Evon R'al.jpg|portrait]].
A label can be used: <code><nowiki>[[Media:Evon R'al.jpg|portrait]]</nowiki></code> to get Evon R'al's [[Media:Evon R'al.jpg|portrait]].


; Category namespace
; Category namespace
<nowiki>[[Category:Pilots]]</nowiki> gives a link to the Category category and the pilots category in a separate box at the bottom of the page.<br>
<code><nowiki>[[Category:Pilots]]</nowiki></code> gives a link to the Category category and the Pilots category in a separate box at the bottom of the page.<br>
To get a link to the Pilots category in the text use <nowiki>[[:Category:Pilots]]</nowiki> which gives [[:Category:Pilots]]
To get a link to the Pilots category in the text use <code><nowiki>[[:Category:Pilots]]</nowiki></code> which gives [[:Category:Pilots]]
 
* [https://wiki.eveuniversity.org/api.php?action=query&meta=siteinfo&siprop=namespaces&format=xml List of namespaces (In raw XML)]
 
==== Interwiki ====
Interwiki links are internal-style links to other websites using an "interwiki prefix". For a list of valid interwiki prefixes see [[Special:interwiki]].
 
Interwiki links are made by using the interwiki prefix as the first parameter in an internal link.
 
A intrawiki link to MediaWiki's help page about links looks like <code><nowiki>[[Mediawikiwiki:Help:Links]]</nowiki></code> which gives [[Mediawikiwiki:Help:Links]]
 
The link end and pipe tricks described at internal links work for interwiki links just as-well.
 
==== External ====
External links are rendered different from internal and interwiki links. On the UNI Wiki the links have a marker at the end. The exact marker depends on if the link is HTTP of HTTPS.
 
The most basic form for an external link is to just put in the raw link, like <code><nowiki>https://wiki.eveuniversity.org/index.php?title=User:Evon_R%27al</nowiki></code> which produces https://wiki.eveuniversity.org/index.php?title=User:Evon_R%27al. While it works as a link it does not look particularly nice.
 
More control over the link can be reached by using single square braces.<br>
'''Syntax:''' <code>[URL label]</code>
; URL : the full URL of the link
; label : the text visible in the page (optional)
The wiki parser uses the first space it encounters as the divider between the URL and the label.
 
* Without using a label <code><nowiki>[https://wiki.eveuniversity.org/index.php?title=User:Evon_R%27al]</nowiki></code> produces [https://wiki.eveuniversity.org/index.php?title=User:Evon_R%27al]. The wiki parser automatically adds a number as the label.


Further reading [[mediawikiwiki:Help:Links]]
* Using a label <code><nowiki>[https://wiki.eveuniversity.org/index.php?title=User:Evon_R%27al Evon R'al's user page]</nowiki></code> produces [https://wiki.eveuniversity.org/index.php?title=User:Evon_R%27al Evon R'al's user page].


[https://wiki.eveuniversity.org/api.php?action=query&meta=siteinfo&siprop=namespaces&format=xml List of namespaces (In raw XML)]
* Finally the external link rendering can be suppressed by using the CSS class {{Co|wheat|plainlinks}} making the link look like an internal one. <code><nowiki><span class="plainlinks">[https://wiki.eveuniversity.org/index.php?title=User:Evon_R%27al Evon R'al's user page]</span></nowiki></code> produces <span class="plainlinks">[https://wiki.eveuniversity.org/index.php?title=User:Evon_R%27al Evon R'al's user page]</span>


=== MessageBox with logo ===
=== MessageBox with logo ===