Template:Main

From LPFM Wiki
Revision as of 15:37, 26 July 2022 by Michi (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Template documentation

{{#ifeq:main |doc

    | 

{{#ifeq:show |show

         | Template:Mbox
        }}{{#if: |
         |   {{#ifexist:Template:Main
                  | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
                  |
                 }}
        }}
    | 
   }}

When a Wikipedia article is large, it is often written in summary style. This template is used after the heading of the summary, to link to the subtopic article that has been summarized. For Category namespace, please use {{Cat main}} instead.

Use of this template should be restricted to the purposes described above. It is not to be used as a substitute for inline links or {{Further}} template. The latter is used when the section expounds a specific aspect of the topic instead of summarizing its article. For example, in phthalate, the template under the "Endocrine disruptor" section should not be Lua error in Module:Template_link_general at line 144: attempt to concatenate local 'titlePart' (a nil value)., because the section specifically deals with phthalate as an endocrine disruptor and not endocrine disruptors in general.

This template should also not be used in lead sections. A lead section is always a summary of its own article, not any other; as such, the only appropriate target for a {{Main}} link in the lead section would be the article itself, which is not useful. {{Broader}} may be appropriate in this case.

Page Template:TOC limit/styles.css has no content.

Usage

{{#if:|

{{{1}}}

}}

Parameters

  • 1, 2, 3, ... – the pages to link to. If no page names are specified, the current page name is used instead (without the namespace prefix). Categories and files are automatically escaped with the colon trick, and links to sections are automatically formatted as page § section, rather than the MediaWiki default of page#section.
  • l1, l2, l3, ... orlabel 1, label 2, label 3, ... – optional labels for each of the pages to link to (this is for articles where a piped link would be used). Note that the extra parameters use a lower case 'L', for example, l1, not L1.
  • selfref – if set to "yes", "y", "true" or "1", adds the CSS class "selfref". This is used to denote self-references to Wikipedia. See Template:Selfref for more information. This is only necessary in articles and other content (e.g. templates) that will appear in articles, and need not be added for uses of this template on Wikipedia: namespace pages.

Template data

{{#switch:<translate></translate> |=

{{#if:{{safesubst:#switch:
|no
|n
|false
|0        = 
|         = 
|¬        = 
|yes
|y
|true
|1        = yes
|#default = yes

}}|{{#ifexpr:{{#if:|{{#ifeq:Template:Main|{{#switch:

|#default =  
| = 
   {{#ifeq:  | 
     | Template:{{{docpage}}}            
     |       
   }}

}}|0|1}}|not{{#ifexpr: ( {{#ifeq:main|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:main|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|0}}}}|{{#if:1||{{#if:|{{{text}}}|<translate> This box:</translate>}} }}{{#if:1|[}}[[{{#switch:

|#default = Main/doc 
| = 
   {{#ifeq:  | 
     | Template:Main/doc            
     | Main/doc      
   }}

}}|<span style="" title="<translate nowrap> View this template</translate>">{{#if:|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="" title="<translate nowrap> Discuss this template</translate>">{{#if:|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch:

|#default = Main/doc 
| = 
   {{#ifeq:  | 
     | Template:Main/doc            
     | Main/doc      
   }}

}}|action=edit}} <span style="" title="<translate nowrap> Edit this template</translate>">{{#if:|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:1|]}}}}}} {{#if:||<translate> This is the [[<tvar name=1>Special:MyLanguage/Help:TemplateData</tvar>|TemplateData]] documentation for this template used by [[<tvar name=2>Special:MyLanguage/VisualEditor</tvar>|VisualEditor]] and other tools.</translate>}}

Main

{{#ifeq:Main|sandbox||{{#if:{{#ifexpr: (

{{#ifeq:main|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:main|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|}}||}}}} | #default=

 {{#switch:

|=

{{#if:{{safesubst:#switch:
|no
|n
|false
|0        = 
|         = 
|¬        = 
|yes
|y
|true
|1        = yes
|#default = yes

}}|{{#ifexpr:{{#if:|{{#ifeq:Template:Main|{{#switch:

|#default =  
| = 
   {{#ifeq:  | 
     | Template:{{{docpage}}}            
     |       
   }}

}}|0|1}}|not{{#ifexpr: ( {{#ifeq:main|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:main|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|0}}}}|{{#if:1||{{#if:|{{{text}}}|<translate> This box:</translate>}} }}{{#if:1|[}}[[{{#switch:

|#default = Main/doc 
| = 
   {{#ifeq:  | 
     | Template:Main/doc            
     | Main/doc      
   }}

}}|<span style="" title="<translate nowrap> View this template</translate>">{{#if:|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="" title="<translate nowrap> Discuss this template</translate>">{{#if:|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch:

|#default = Main/doc 
| = 
   {{#ifeq:  | 
     | Template:Main/doc            
     | Main/doc      
   }}

}}|action=edit}} <span style="" title="<translate nowrap> Edit this template</translate>">{{#if:|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:1|]}}}}}} {{#if:||This is the TemplateData documentation for this template used by VisualEditor and other tools.}}

Main

{{#ifeq:Main|sandbox||{{#if:{{#ifexpr: (

{{#ifeq:main|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:main|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|}}||}}}} | #default=

 Lua error: expandTemplate: template loop detected.

}} }}

This template is used after the heading of a section, to link to a sub-article (or sub-articles) that is entirely about the topic of the section. The template will display, in italics, "Main article: Article 1, Article 2 and Article 3"

Template parameters

This template has custom formatting.

ParameterDescriptionTypeStatus
Page 11

The name of the first page that you want to link to. If this is not specified, the current page name (with no namespace prefix) is used instead.

Page namesuggested
Page 22

The name of the second page that you want to link to.

Page nameoptional
Page 33

The name of the third page that you want to link to. More pages can be added using the parameters "4", "5", etc.

Page nameoptional
Label 1l1 label 1

What the first linked page is to be displayed as.

Stringoptional
Label 2l2 label 2

What the second linked page is to be displayed as.

Stringoptional
Label 3l3 label 3

What the third linked page is to be displayed as. Other labels can be added by using increasing numbers (starting with "l4" for page 4) as parameter names.

Stringoptional
Self referenceselfref

Set to "yes" if the template is a self-reference to Wikipedia that would not make sense on mirrors or forks of the Wikipedia site.

Booleanoptional

Examples

  • {{Main}}Script error: No such module "Labelled list hatnote".
  • {{Main|Article}}Script error: No such module "Labelled list hatnote".
  • {{Main|Article#Section}}Script error: No such module "Labelled list hatnote".
  • {{Main|Article#Section|l1=Custom section label}}Script error: No such module "Labelled list hatnote".
  • {{Main|Article1|Article2|Article3}}Script error: No such module "Labelled list hatnote".
  • {{Main|Article1|l1=Custom label 1|Article2|l2=Custom label 2}}Script error: No such module "Labelled list hatnote".
  • {{Main|(15760) 1992 QB1|l1={{mp|(15760) 1992 QB|1}}}}Script error: No such module "Labelled list hatnote".

Errors

If the name of the first page that you want to link to is not specified, the current page name (with no namespace prefix) is used instead:

  • Script error: No such module "Labelled list hatnote".

No errors can be displayed due to the illegal usage of parameters or other usages (i.e. the first parameter can be omitted, other parameters can be used even if the first one is empty (and automatically filled with the current page name (with no namespace prefix)), equals sign can be used as one of the parameters, and template can be used by direct call to the module (using "#invoke")). This is not the case for {{see also}}, for example.

See also

  • {{Broader}}: For broader coverage of this topic, see Article.
  • {{Excerpt}}, which allows transclusion of text (such as an intro section) from one article into another
  • {{Further}}: Further information: Article.
  • {{Official website}}

{{#if:{{#ifeq:Main|sandbox|1}}{{#ifeq:Main|doc|1}}|| }}