Difference between revisions of "Template:Main list/doc"

From blackwiki
Jump to navigation Jump to search
imported>Vanisaac
m (→‎See also: clean up per WP:CAT#T and WP:AWBREQ add template:Sandbox other)
test>WOSlinker
m (change source to syntaxhighlight)
Line 1: Line 1:
{{Documentation subpage}}
+
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{tsh|more}}
+
This module produces a "For a more comprehensive list, see [...]" link. It implements the {{tl|main list}} template.
{{lua|Module:Main list}}
 
  
This template is used to make [[Wikipedia:Summary style|summary style]] explicit. It looks like this:
+
== Use from wikitext ==
  
{{Main list|Article}}
+
This module cannot be used directly from #invoke. Instead, it can only be used through the {{tl|main list}} template. Please see the template page for documentation.
  
It is used in sections for which there is also a separate more comprehensive list article on the subject.
+
== Use from other Lua modules ==
  
== Usage ==
+
Load the module:
  
; Basic usage:
+
<syntaxhighlight lang="lua">
{{tnull|Main list|''article''}}
+
local mMainList = require('Module:Main list')
 +
</syntaxhighlight>
  
; With a topic:
+
You can then use the _mainList function like this:
{{tnull|Main list|''article 1''|''article 2''}}
 
  
; All parameters:
+
<syntaxhighlight lang="lua">
{{tnull|Main list|''article 1''|''article 2''|4=category=''no''}}
+
mMainList._mainList (page1, page2)
 +
</syntaxhighlight>
  
== Parameters ==
+
The <var>page1</var> variable is the page to be linked to, and is required. The page name can include a section link if desired. If the page includes a section link, it is automatically formatted as ''page § section'', rather than the MediaWiki default of ''page#section''.
  
This template accepts the following parameters:
+
The <var>page2</var> variable is optional; it is a second page link.
* <code>1</code> - the page to link to (required). Categories and files are automatically escaped with the [[Help:Colon trick|colon trick]], and links to sections are automatically formatted as ''page § section'', rather than the MediaWiki default of ''page#section''.
 
* <code>2</code> - a second page (optional). Same implications as the first parameter apply.
 
* <code>category</code> - if set to "no", "n", "false", or "0", suppresses the error tracking category ([[:Category:Hatnote templates with errors]]). This only has an effect if the first positional parameter (the page to link to) is omitted.
 
  
== Examples ==
+
=== Example 1 ===
 +
<syntaxhighlight lang="lua">
 +
mMainList._mainList ('Wikipedia:Hatnote#Hatnote templates')
 +
</syntaxhighlight>
 +
Produces:
 +
:<code><nowiki><div class="hatnote">For a more comprehensive list, see [[Wikipedia:Hatnote#Hatnote templates|Wikipedia:Hatnote § Hatnote templates]].</div></nowiki></code>
 +
Displays as:
 +
<div class="hatnote">For a more comprehensive list, see [[Wikipedia:Hatnote#Hatnote templates|Wikipedia:Hatnote § Hatnote templates]].</div>
  
* {{tnull|Main list|Wikipedia:Hatnote#Hatnote templates }}<!--
+
=== Example 2 ===
  --> → {{Main list|Wikipedia:Hatnote#Hatnote templates }}
+
<syntaxhighlight lang="lua">
* {{tnull|Main list|Wikipedia:Hatnote#Hatnote templates |Wikipedia:Template messages/Cleanup#Cleanup}}<!--
+
mMainList._mainList ('Wikipedia:Hatnote#Hatnote templates','Wikipedia:Template messages/Cleanup#Cleanup')
  --> → {{Main list|Wikipedia:Hatnote#Hatnote templates |Wikipedia:Template messages/Cleanup#Cleanup}}
+
</syntaxhighlight>
 +
Produces:
 +
:<code><nowiki><div class="hatnote">For a more comprehensive list, see [[Wikipedia:Hatnote#Hatnote templates|Wikipedia:Hatnote § Hatnote templates]] and [[Wikipedia:Template messages/Cleanup#Cleanup|Wikipedia:Template messages/Cleanup § Cleanup]].</div></nowiki></code>
 +
Displays as:
 +
<div class="hatnote">For a more comprehensive list, see [[Wikipedia:Hatnote#Hatnote templates|Wikipedia:Hatnote § Hatnote templates]] and [[Wikipedia:Template messages/Cleanup#Cleanup|Wikipedia:Template messages/Cleanup § Cleanup]].</div>
  
== Errors ==
+
== Technical details ==
  
If no page name is supplied, the template will output the following message:
+
This module uses [[Module:Hatnote]] to format the hatnote text and [[Module:Arguments]] to fetch the arguments from wikitext.
* {{Main list|category=no}}
 
  
If you see this error message, it is for one of three reasons:
+
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
# No parameters were specified (the template code was {{tnull|Main list}}). Please use {{tnull|Main list|''page''}} instead.
+
<!-- Categories go here and interwikis go in Wikidata. -->
# The page name was specified, but it contains an equals sign ("="). The equals sign has a special meaning in template code, and because of this it cannot be used in template parameters that do not specify a parameter name. For example, the template code {{tnull|Main list|<nowiki>2+2=4</nowiki>}} will produce this error. To work around this, you can specify the parameter name explicitly by using <code>1=</code> before the page name, like this: {{tnull|Main list|<nowiki>1=2+2=4</nowiki>}}.
+
[[Category:Hatnote modules]]
# You tried to access [[Module:Main list]] directly by using {{tnull|&#35;invoke:Main list|mainList|''text''}}. Use of #invoke in this way has been disabled for performance reasons. Please use {{tnull|Main list|''text''}} instead.
 
 
 
If you see this error message and are unsure of what to do, please post a message on [[WP:HD|the help desk]], and someone should be able to help you.
 
 
 
Pages that contain this error message are tracked in [[:Category:Hatnote templates with errors]].
 
 
 
== Alternative ==
 
For cases where the present context provides no short list to which this template "a more comprehensive list" wording could refer, see the template {{tl|Main listing}}, which is just a pointer to the list article.
 
 
 
==TemplateData==
 
{{Collapse top|[[Wikipedia:TemplateData|TemplateData]] documentation used by [[Wikipedia:VisualEditor|VisualEditor]] and other tools}}
 
{{TemplateData header|noheader=1}}
 
<templatedata>
 
{
 
"description": "This template is used to show readers where to find more details about a particular topic. It is usually placed at the top of a section or article.",
 
"params": {
 
"1": {
 
"label": "Article 1",
 
"description": "The name of the article that you want to link to (required). 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\".",
 
"type": "string",
 
"required": true
 
},
 
"2": {
 
"label": "Article 2",
 
"description": "Name of the second article you want to link to (optional). 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\".",
 
"type": "string",
 
"required": false
 
},
 
"category": {
 
"label": "Category",
 
"description": "Set to \"no\", \"n\", \"false\", or \"0\" to suppresses the error tracking category (Category:Hatnote templates with errors). This only has an effect if the hatnote text is omitted.",
 
"type": "boolean",
 
"autovalue": ""
 
}
 
},
 
"format": "block"
 
}
 
</templatedata>
 
{{Collapse bottom}}
 
 
 
==See also==
 
{{Hatnote templates}}
 
 
 
* {{tl|Summarize}} for use where details of one article need to be summed up in another
 
* {{tl|Summarize section}} for use where part of an article contains too many details
 
 
 
<includeonly>{{Sandbox other||
 
 
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
[[Category:Cross-reference templates]]
 
[[Category:Hatnote templates]]
 
[[Category:Hatnote templates for lists]]
 
[[Category:Wikipedia page-section templates]]
 
 
 
[[mk:Шаблон:Главен список]]
 
[[tr:Şablon:Analiste]]
 
 
}}</includeonly>
 
}}</includeonly>

Revision as of 16:26, 7 July 2020

This module produces a "For a more comprehensive list, see [...]" link. It implements the {{main list}} template.

Use from wikitext

This module cannot be used directly from #invoke. Instead, it can only be used through the {{main list}} template. Please see the template page for documentation.

Use from other Lua modules

Load the module:

local mMainList = require('Module:Main list')

You can then use the _mainList function like this:

mMainList._mainList (page1, page2)

The page1 variable is the page to be linked to, and is required. The page name can include a section link if desired. If the page includes a section link, it is automatically formatted as page § section, rather than the MediaWiki default of page#section.

The page2 variable is optional; it is a second page link.

Example 1

mMainList._mainList ('Wikipedia:Hatnote#Hatnote templates')

Produces:

<div class="hatnote">For a more comprehensive list, see [[Wikipedia:Hatnote#Hatnote templates|Wikipedia:Hatnote § Hatnote templates]].</div>

Displays as:

For a more comprehensive list, see Wikipedia:Hatnote § Hatnote templates.

Example 2

mMainList._mainList ('Wikipedia:Hatnote#Hatnote templates','Wikipedia:Template messages/Cleanup#Cleanup')

Produces:

<div class="hatnote">For a more comprehensive list, see [[Wikipedia:Hatnote#Hatnote templates|Wikipedia:Hatnote § Hatnote templates]] and [[Wikipedia:Template messages/Cleanup#Cleanup|Wikipedia:Template messages/Cleanup § Cleanup]].</div>

Displays as:

Technical details

This module uses Module:Hatnote to format the hatnote text and Module:Arguments to fetch the arguments from wikitext.