Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Cat main/doc
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{high-use}} This module produces hatnote saying "The main article for this category is x." It implements the {{tl|cat main}} template. == Use from wikitext == This module should usually be used via the {{tl|cat main}} template. However, it can also be used from #invoke with the syntax <code><nowiki>{{#invoke:Cat main|catMain|</nowiki>''parameters''<nowiki>}}</nowiki></code>. Please see the {{tl|cat main}} template documentation for available parameters. == Use from other Lua modules == Load the module: <syntaxhighlight lang="lua"> local mCatMain = require('Module:Cat main') </syntaxhighlight> You can then use the _catMain function like this: <syntaxhighlight lang="lua"> mCatMain._catMain(options, ...) </syntaxhighlight> <var>options</var> is an optional table that can be used to configure the function's output. There are two available options, "article" and "selfref". * '''article''' - if this is set to false, "no", "n", "false", or 0, the module outputs "The main page" rather than "The main article". Use the code {{code|1={article = false}|2=lua}}. * '''selfref''' - this is used when the output is a self-reference to Wikipedia. To set this option, use {{code|1={selfref = true}|2=lua}}. (See the {{tl|selfref}} template for more details on self-references.) The remaining arguments are page names to be turned into link(s) following the text "The main article for this category is". If no page names are specified, the current page name (minus the [[WP:NS|namespace]] name) is used for the first link. ; Example 1 <syntaxhighlight lang="lua"> mCatMain._catMain(nil, 'Foo') </syntaxhighlight> Produces: :<code><nowiki><div class="hatnote relarticle mainarticle">The main article for this [[Help:Categories|category]] is '''[[Foo]]'''.</div></nowiki></code> Displays as: {{cat main|Foo}} ; Example 2 <syntaxhighlight lang="lua"> mCatMain._catMain(nil, 'Foo', 'Bar', 'Baz') </syntaxhighlight> Produces: :<code><nowiki><div class="hatnote relarticle mainarticle">The main articles for this [[Help:Categories|category]] are '''[[Foo]]''', '''[[Bar]]''' and '''[[Baz]]'''.</div></nowiki></code> Displays as: {{cat main|Foo|Bar|Baz}} ; Example 3 <syntaxhighlight lang="lua"> mCatMain._catMain({article = false}, 'Foo') </syntaxhighlight> Produces: :<code><nowiki><div class="hatnote relarticle mainarticle">The main page for this [[Help:Categories|category]] is '''[[Foo]]'''.</div></nowiki></code> Displays as: {{cat main|Foo|article=no}} == Technical details == This module uses [[Module:Hatnote]] to format the hatnote text. <includeonly>{{sandbox other|| <!-- Categories go here and interwikis go in Wikidata. --> [[Category:Hatnote modules]] }}</includeonly>
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Cat main
(
edit
)
Template:Code
(
edit
)
Template:High-use
(
edit
)
Template:Tl
(
edit
)