Content deleted Content added
create |
Create new #Text output detailing how to translate the string outputted by the module |
||
(16 intermediate revisions by 13 users not shown) | |||
Line 1:
{{high-use}}
This module produces hatnote saying "The main article for this category is x." It implements the {{tl|cat main}} template.▼
{{Lua|Module:Hatnote|Module:Format link|Module:Yesno|Module:TableTools|Module:Arguments}}
▲This module produces hatnote saying "The main article for this category is x." It implements the {{tl|
== Use from wikitext ==
This module should usually be used via the {{tl|
== Use from other Lua modules ==
Line 9 ⟶ 11:
Load the module:
<
local mCatMain = require('Module:
</syntaxhighlight>
You can then use the _catMain function like this:
<
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".
Line 26 ⟶ 28:
; Example 1
<
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>
Line 35 ⟶ 37:
; Example 2
<
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>
Line 44 ⟶ 46:
; Example 3
<
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>
Line 56 ⟶ 58:
This module uses [[Module:Hatnote]] to format the hatnote text.
=== Text output ===
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||▼
This module has five lines that must be translated when exported to wikis in other languages.
<!-- Categories go here and interwikis go in Wikidata. -->▼
{| class="wikitable sortable"
|-
! scope="col" | Variable
! scope="col" | Code
! scope="col" colspan="2" | Translatable text
|-
! scope="row" rowspan="3" | {{Code|pagetype}}
| {{Code|lang=html+handlebars|1=
pagetype = yesno(options.article) ~= false and 'article' or 'page'
}}
| {{Code|1=article}}
| {{Code|1=page}}
|-
| {{Code|lang=html+handlebars|1=
pagetype = mw.title.new(page).namespace == 0 and "article" or "page"
}}
| {{Code|1=article}}
| {{Code|1=page}}
|-
| {{Code|lang=html+handlebars|1=
pagetype = "article"
}}
| colspan="2" | {{Code|1=article}}
|-
! scope="row" rowspan="2" | {{Code|stringToFormat}}
| {{Code|lang=html+handlebars|1=
stringToFormat = 'The main %ss for this [[Help:Categories|category]] are %s.'
}}
| colspan="2" | {{Code|1=The main %ss for this [[Help:Categories|category]] are %s.}}
|-
| {{Code|lang=html+handlebars|1=
stringToFormat = 'The main %s for this [[Help:Categories|category]] is %s.'
}}
| colspan="2" | {{Code|1=The main %s for this [[Help:Categories|category]] is %s.}}
|}
▲<!-- Categories go here and interwikis go in Wikidata. -->
[[Category:Hatnote modules]]
}}</includeonly>
<noinclude>
[[Category:Module documentation pages]]
</noinclude>
|