Template:Section link/testcases

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Lua code Wikitext code Result
mSectionLink('Paris','Architecture') {{section link|Paris|Architecture}} Paris § Architecture
{{section link/sandbox|Paris|Architecture}} Paris § Architecture
mSectionLink('Paris',{'Architecture','Culture'}) {{section link|Paris|Architecture|Culture}} Paris §§ Architecture​ and Culture
{{section link/sandbox|Paris|Architecture|Culture}} Paris §§ Architecture and Culture
mSectionLink('Paris',{'Architecture','Culture','Sport'}) {{section link|Paris|Architecture|Culture|Sport}} Paris §§ Architecture, Culture, and Sport
{{section link/sandbox|Paris|Architecture|Culture|Sport}} Paris §§ Architecture, Culture, and Sport
mSectionLink('Paris',{'Architecture','Culture','Sport'},{nopage=true}) {{section link|Paris|Architecture|Culture|Sport|nopage=yes}} §§ Architecture, Culture, and Sport
{{section link/sandbox|Paris|Architecture|Culture|Sport|nopage=yes}} §§ Architecture, Culture, and Sport

Invalid usage

[edit source]

Not enough params

[edit source]
Case 1: no parameters
{{Section link}}

{{Section link}}

{{Section link}}: required section parameter(s) missing

{{Section link/sandbox}}

{{Section link}}: required section parameter(s) missing

Case 2: only one parameter
{{Section link|Article}}

{{Section link}}

{{Section link}}: required section parameter(s) missing

{{Section link/sandbox}}

{{Section link}}: required section parameter(s) missing

Valid usage

[edit source]

One section

[edit source]
Case 3: article and section
Case 4a: only section (Null article parameter)
{{Section link||Section}}

{{Section link}}

§ Section

{{Section link/sandbox}}

§ Section

Case 4b: only section (No article parameter at all)
Case 4c: only section (No article parameter at all and nopage set)
{{Section link|2=Section |nopage=yes}}

{{Section link}}

§ Section

{{Section link/sandbox}}

§ Section

Case 15: anchor in title

Multiple sections

[edit source]
Case 5: article and 2 sections
{{Section link|Article|Section 1|Section 2}}

{{Section link}}

Article §§ Section 1​ and Section 2

{{Section link/sandbox}}

Article §§ Section 1 and Section 2

Case 6: article and 3 sections
{{Section link|Article|Section 1|Section 2|Section 3}}

{{Section link}}

Article §§ Section 1, Section 2, and Section 3

{{Section link/sandbox}}

Article §§ Section 1, Section 2, and Section 3

Case 7: article and 4 sections
{{Section link|Article|Section 1|Section 2|Section 3|Section 4}}

{{Section link}}

Article §§ Section 1, Section 2, Section 3, and Section 4

{{Section link/sandbox}}

Article §§ Section 1, Section 2, Section 3, and Section 4

Case 8: article and 5 sections
{{Section link|Article|Section 1|Section 2|Section 3|Section 4|Section 5}}

{{Section link}}

Article §§ Section 1, Section 2, Section 3, Section 4, and Section 5

{{Section link/sandbox}}

Article §§ Section 1, Section 2, Section 3, Section 4, and Section 5

Case 9a: 5 sections only (null article parameter)
{{Section link||Section 1|Section 2|Section 3||Section 5}}

{{Section link}}

§§ Section 1, Section 2, Section 3, and Section 5

{{Section link/sandbox}}

§§ Section 1, Section 2, Section 3, and Section 5

Case 9b: 5 sections only (no article parameter and 5th positional parameter)
{{Section link|2=Section 1 |3=Section 2 |4=Section 3 |6=Section 5}}

{{Section link}}

Template:Section link/testcases §§ Section 1, Section 2, Section 3, and Section 5

{{Section link/sandbox}}

Template:Section link/testcases §§ Section 1, Section 2, Section 3, and Section 5

Case 9c: 5 sections only (no article parameter, 5th positional parameter, and nopage set)
{{Section link|2=Section 1 |3=Section 2 |4=Section 3 |6=Section 5 |nopage=yes}}

{{Section link}}

§§ Section 1, Section 2, Section 3, and Section 5

{{Section link/sandbox}}

§§ Section 1, Section 2, Section 3, and Section 5

Case 16: anchor in title and section
{{Section link|Article#Section 1|Section 2}}

{{Section link}}

Article §§ Section 1​ and Section 2

{{Section link/sandbox}}

Article §§ Section 1 and Section 2

Case 18: custom conjunction word
{{Section link|2=Section 1 |3=Section 2 |conjunction=or}}

{{Section link}}

Template:Section link/testcases §§ Section 1​ and Section 2

{{Section link/sandbox}}

Template:Section link/testcases §§ Section 1 or Section 2

Display title

[edit source]
Case 13: display title
{{Section link|Wikipedia:Page name|Section|display=:wikipedia: _ ''p''a<sup>g</sup><sub>e</sub>_'''''n''a'''&#109;<sup><sup>e</sup></sup>}}

{{Section link}}

Lua error: Display title ":wikipedia: _ ''p''a<sup>g</sup><sub>e</sub>_'''''n''a'''&#109;<sup><sup>e</sup></sup>" was ignored since it is not equivalent to the page's actual title.

{{Section link/sandbox}}

Lua error: Display title ":wikipedia: _ ''p''a<sup>g</sup><sub>e</sub>_'''''n''a'''&#109;<sup><sup>e</sup></sup>" was ignored since it is not equivalent to the page's actual title.

Case 17: multiple sections plus display title
{{Section link|Article|Section 1|Section 2|display=''Article''}}

{{Section link}}

Article §§ Section 1​ and Section 2

{{Section link/sandbox}}

Article §§ Section 1 and Section 2

Invalid

[edit source]
Case 14: non-matching display title
{{Section link|Wikipedia:Page name|Section|display=WP:PNAME}}

{{Section link}}

Lua error: Display title "WP:PNAME" was ignored since it is not equivalent to the page's actual title.

{{Section link/sandbox}}

Lua error: Display title "WP:PNAME" was ignored since it is not equivalent to the page's actual title.

Case 12: subpage links
{{Section link|../|Usage}}

{{Section link}}

../ § Usage

{{Section link/sandbox}}

../ § Usage

Misuse

[edit source]

Gaps in params

[edit source]
Case 10 (misuse): only positional parameters 3, 4 and 6
{{Section link|||Section 2|Section 3||Section 5}}

{{Section link}}

§§ Section 2, Section 3, and Section 5

{{Section link/sandbox}}

§§ Section 2, Section 3, and Section 5

Case 11 (misuse): only positional parameters 4 and 6
{{Section link||||Section 3||Section 5}}

{{Section link}}

§§ Section 3​ and Section 5

{{Section link/sandbox}}

§§ Section 3 and Section 5