Template:Main article/doc: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
(Corrections and general improvements.)
Line 12: Line 12:


====Mandatory parameter====
====Mandatory parameter====
The only mandatory parameter is the first one, <code>1</code> (no name needs to be entered). If it hasn't been entered, an error message will be displayed.
* '''<code>1</code>''': The name of the main article
This is the only mandatory parameter. No parameter name needs to be entered. If this parameter is left out, an error message will be displayed.


''Usage:'' <code><nowiki>{{</nowiki>main article|'''1'''<nowiki>}}</nowiki></code>
Usage:
* <code><nowiki>{{</nowiki>main article|'''1'''<nowiki>}}</nowiki></code>


====Optional parameters====
====Optional parameters====
;Additional main articles
;<big>Additional main articles</big>
There are nine (9) optional parameters to specify additional main articles, {{Nowrap|1=<code>2</code>, <code>3</code>, …, <code>10</code>}} (no names need to be entered). The template can't contain more than 10 articles. If that limit is exceeded, an error message will be displayed.
* '''<code>2</code>–<code>10</code>''': The names of the main articles
There are nine (9) optional parameters to specify additional main articles, {{Nowrap|1=<code>2</code>, <code>3</code>, …, <code>10</code>}} (no parameter names need to be entered). The template can't contain more than 10 articles. If that limit is exceeded, an error message will be displayed.


''Usage:'' <code><nowiki>{{</nowiki>main article|1|'''2'''|'''3'''|'''4'''|'''5'''|'''6'''|'''7'''|'''8'''|'''9'''|'''10'''<nowiki>}}</nowiki></code>
Usage:
* <code><nowiki>{{</nowiki>main article|1|'''2'''|'''3'''|'''4'''|'''5'''|'''6'''|'''7'''|'''8'''|'''9'''|'''10'''<nowiki>}}</nowiki></code>


 
;<big>Custom link text</big>
;Custom link text
* '''<code>l1</code>–<code>l10</code>''': Custom text
There are ten (10) optional parameters to specify custom link texts for any of the referenced main articles. The parameter names use the latin letter "l" (i.e. lower-case "L") with the number of the main article to which you want to assign the custom link text; {{Nowrap|1=<code>l1</code>, <code>l2</code>, …, <code>l10</code>}}.
There are ten (10) optional parameters to specify custom link texts for any of the referenced main articles. The parameter names use the latin letter "l" (i.e. lower-case "L") with the number of the main article to which you want to assign the custom link text: {{Nowrap|1=<code>l1</code>, <code>l2</code>, …, <code>l10</code>}}.


'''NB!''' Custom link text should only be used when absolutely necessary in order to clarify something! The main rule is to ''always'' use the main articles names as they are in the wiki.
'''NB!''' Custom link text should only be used when absolutely necessary in order to clarify something! The main rule is to ''always'' use the main articles names as they are in the wiki.


''Usage:'' <code><nowiki>{{</nowiki>main article|1|'''l1='''One<nowiki>}}</nowiki></code>
Usage:
* <code><nowiki>{{</nowiki>main article|1|'''l1='''One<nowiki>}}</nowiki></code>


 
;<big>Scientific names</big>
;Scientific names
* '''<code>latin</code>''': Scientific name of the organism the main article covers
Lastly, there is an optional parameter for denoting scientific names of organisms, <code>latin</code>.
Lastly, there is an optional parameter for denoting scientific names of organisms, <code>latin</code>.


''Usage:'' <code><nowiki>{{</nowiki>main article|1|'''latin='''Species prima<nowiki>}}</nowiki></code>
Usage:
* <code><nowiki>{{</nowiki>main article|1|'''latin='''Species prima<nowiki>}}</nowiki></code>


===Examples===
===Examples===
====Correct use====
{| class="wikitable"
{| class="wikitable"
|-
|-
! Example case !! What you write !! What you see
! Example case !! What you write !! What you see
|-
|-
| ''no specified param'' || <code><nowiki>{{main article}}</nowiki></code> || {{main article}}
| &le; 10 articles || <code><nowiki>{{main article|1|2|3|4|5|6|7|8|9|10}}</nowiki></code> || {{main article|1|2|3|4|5|6|7|8|9|10}}
|-
|-
| ''param'' <code>1</code> || <code><nowiki>{{main article|Contribute}}</nowiki></code> || {{main article|Contribute}}
| 1 article || <code><nowiki>{{main article|Contribute}}</nowiki></code> || {{main article|Contribute}}
|-
|-
| ''params'' <code>1</code>, <code>l1</code> || <code><nowiki>{{main article|Contribute|l1=To "Contribute"}}</nowiki></code> || {{main article|Contribute|l1=To "Contribute"}}
| 1 article with custom link text || <code><nowiki>{{main article|Contribute|l1=Join Mozilla}}</nowiki></code> || {{main article|Contribute|l1=Join Mozilla}}
|-
|-
| ''params'' <code>1</code>, <code>2</code> || <code><nowiki>{{main article|Contribute|Firefox}}</nowiki></code> || {{main article|Contribute|Firefox}}
| 2 articles || <code><nowiki>{{main article|Contribute|Firefox}}</nowiki></code> || {{main article|Contribute|Firefox}}
|-
|-
| ''params'' <code>1</code>, <code>2</code>, <code>l1</code>, <code>l2</code> || <code><nowiki>{{main article|Contribute|l1=To "Contribute"|Firefox|l2=To "Firefox"}}</nowiki></code> || {{main article|Contribute|l1=To "Contribute"|Firefox|l2=To "Firefox"}}
| 2 articles with custom link texts || <code><nowiki>{{main article|Contribute|l1=Join Mozilla|Firefox|l2=Web browser}}</nowiki></code> || {{main article|Contribute|l1=Join Mozilla|Firefox|l2=Web browser}}
|-
|-
| ''one article outside the main namespace'' || <code><nowiki>{{main article|MozillaWiki:About}}</nowiki></code> || {{main article|MozillaWiki:About}}
| 1 article outside the main namespace || <code><nowiki>{{main article|MozillaWiki:About}}</nowiki></code> || {{main article|MozillaWiki:About}}
|-
|-
| ''two articles outside the main namespace'' || <code><nowiki>{{main article|MozillaWiki:About|MozillaWiki:Accounts}}</nowiki></code> || {{main article|MozillaWiki:About|MozillaWiki:Accounts}}
| 2 articles outside the main namespace || <code><nowiki>{{main article|MozillaWiki:About|MozillaWiki:Accounts}}</nowiki></code> || {{main article|MozillaWiki:About|MozillaWiki:Accounts}}
|-
|-
| ''mix of articles within and outside the main namespace'' || <code><nowiki>{{main article|Contribute|MozillaWiki:About}}</nowiki></code> || {{main article|Contribute|MozillaWiki:About}}
| 1 article within and 1 article outside the main namespace || <code><nowiki>{{main article|Contribute|MozillaWiki:About}}</nowiki></code> || {{main article|Contribute|MozillaWiki:About}}
|-
| Scientific name || <code><nowiki>{{main article|Fennec|latin=Vulpes zerda}}</nowiki></code> || {{main article|Fennec|latin=Vulpes zerda}}
|}
 
====Incorrect use====
{| class="wikitable"
|-
|-
| ''&le; 10 articles'' || <code><nowiki>{{main article|1|2|3|4|5|6|7|8|9|10}}</nowiki></code> || {{main article|1|2|3|4|5|6|7|8|9|10}}
! Example case !! What you write !! What you see (error message)
|-
|-
| ''&gt; 10 articles'' || <code><nowiki>{{main article|1|2|3|4|5|6|7|8|9|10|11}}</nowiki></code> || {{main article|1|2|3|4|5|6|7|8|9|10|11}}
| &gt; 10 articles || <code><nowiki>{{main article|1|2|3|4|5|6|7|8|9|10|11}}</nowiki></code> || {{main article|1|2|3|4|5|6|7|8|9|10|11}}
|-
|-
| ''param'' <code>latin</code> || <code><nowiki>{{main article|Fennec|latin=Vulpes zerda}}</nowiki></code> || {{main article|Fennec|latin=Vulpes zerda}}
| No&nbsp;parameter || <code><nowiki>{{main article}}</nowiki></code> || {{main article}}
|}
|}



Revision as of 20:53, 28 October 2014

Edit-copy green.svg
This is a documentation subpage for Template:Main article.
It contains usage information, categories and other content that is not part of the original template page.

Usage

{{main article}} displays one or more links to point the reader towards the more substantial main article for further reading. The output text is indented and italic.

The template is useful, e.g. when an article section takes up something that already is thoroughly explained in a main article, or when an article includes a citation from another article at MozillaWiki. It is ment to make it easier to include internal references, and to lessen the need for over-extensive article sections and parallel articles.

When the referenced articles reside in the main namespace, the template shows the text "Main article" (if only one article is specified) or "Main articles" (for more than one articles). If, however, the referenced articles are in other namespaces than the main one, or if the articles are in both the main and some other namespaces, the template will show "Main page" or "Main pages", for a single reference and multiple references respectively.

Parameters

There are a total of 21 parameters, of which ten are unnamed. The template has one mandatory parameter for specifying the first main article (1), and 20 optional parameters. Of the latter, nine parameters may be used to specify additional main articles (2 through 10). There is an option to assign custom link texts to the articles through another ten optional parameters (l1 through l10), but use of that feature is not recommended. There is also an optional parameter for scientific names (latin).

Mandatory parameter

  • 1: The name of the main article

This is the only mandatory parameter. No parameter name needs to be entered. If this parameter is left out, an error message will be displayed.

Usage:

  • {{main article|1}}

Optional parameters

Additional main articles
  • 210: The names of the main articles

There are nine (9) optional parameters to specify additional main articles, 2, 3, …, 10 (no parameter names need to be entered). The template can't contain more than 10 articles. If that limit is exceeded, an error message will be displayed.

Usage:

  • {{main article|1|2|3|4|5|6|7|8|9|10}}
Custom link text
  • l1l10: Custom text

There are ten (10) optional parameters to specify custom link texts for any of the referenced main articles. The parameter names use the latin letter "l" (i.e. lower-case "L") with the number of the main article to which you want to assign the custom link text: l1, l2, …, l10.

NB! Custom link text should only be used when absolutely necessary in order to clarify something! The main rule is to always use the main articles names as they are in the wiki.

Usage:

  • {{main article|1|l1=One}}
Scientific names
  • latin: Scientific name of the organism the main article covers

Lastly, there is an optional parameter for denoting scientific names of organisms, latin.

Usage:

  • {{main article|1|latin=Species prima}}

Examples

Correct use

Example case What you write What you see
≤ 10 articles {{main article|1|2|3|4|5|6|7|8|9|10}}
Main articles: 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10
1 article {{main article|Contribute}}
Main article: Contribute
1 article with custom link text {{main article|Contribute|l1=Join Mozilla}}
Main article: Join Mozilla
2 articles {{main article|Contribute|Firefox}}
Main articles: Contribute and Firefox
2 articles with custom link texts {{main article|Contribute|l1=Join Mozilla|Firefox|l2=Web browser}}
Main articles: Join Mozilla and Web browser
1 article outside the main namespace {{main article|MozillaWiki:About}}
Main page: MozillaWiki:About
2 articles outside the main namespace {{main article|MozillaWiki:About|MozillaWiki:Accounts}}
1 article within and 1 article outside the main namespace {{main article|Contribute|MozillaWiki:About}}
Main pages: Contribute and MozillaWiki:About
Scientific name {{main article|Fennec|latin=Vulpes zerda}}
Main article: Fennec

Incorrect use

Example case What you write What you see (error message)
> 10 articles {{main article|1|2|3|4|5|6|7|8|9|10|11}}
Error in {{main article}}: Too many articles. The template can't handle more than 10 articles.
No parameter {{main article}}
Error in {{main article}}: No parameter specified. You have to include at least one article name.

See also

  • {{main}} – simple template for referencing only one main article