Difference between revisions of "Template:Bug Header"

From Nookipedia, the Animal Crossing wiki
(Switching to CSS colour class)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{#vardefine:number|{{#cargo_query:|tables=nh_bug|fields=number|where=nh_bug._pageTitle='<includeonly>{{#switch:{{PAGENAME}}|Rajah Brooke's Birdwing=Rajah Brooke\'s Birdwing|Queen Alexandra's Birdwing=Queen Alexandra\'s Birdwing|{{PAGENAME}}}}</includeonly><noinclude>Yellow Butterfly</noinclude>'|no html}}}}{{#vardefine:leftname|{{#cargo_query:|tables=nh_bug|fields=name|where=nh_bug.number='{{#ifeq:{{PAGENAME}}|Common Butterfly|80|{{#expr:{{#var:number}}-1}}}}'|no html}}}}{{#vardefine:rightname|{{#cargo_query:|tables=nh_bug|fields=name|where=nh_bug.number='{{#ifeq:{{PAGENAME}}|Scorpion|1|{{#expr:{{#var:number}}+1}}}}'|no html}}}}
+
{{#vardefine:number|{{#cargo_query:|tables=nh_bug|fields=number|where=nh_bug._pageTitle='<includeonly>{{#switch:{{PAGENAME}}|Rajah Brooke's birdwing=Rajah Brooke\'s birdwing|Queen Alexandra's birdwing=Queen Alexandra\'s birdwing|{{PAGENAME}}}}</includeonly><noinclude>Yellow butterfly</noinclude>'|no html}}}}{{#vardefine:leftname|{{#cargo_query:|tables=nh_bug|fields=name|where=nh_bug.number='{{#ifeq:{{PAGENAME}}|Common butterfly|80|{{#expr:{{#var:number}}-1}}}}'|no html}}}}{{#vardefine:rightname|{{#cargo_query:|tables=nh_bug|fields=name|where=nh_bug.number='{{#ifeq:{{PAGENAME}}|Scorpion|1|{{#expr:{{#var:number}}+1}}}}'|no html}}}}
 
{{Header Box
 
{{Header Box
|bg-color        = #e4f6bc
+
|colorclass      = color-bug
|left-link      = {{#cargo_query:|tables=nh_bug|fields=_pageTitle|where=nh_bug.number='{{#ifeq:{{PAGENAME}}|Common Butterfly|80|{{#expr:{{#var:number}}-1}}}}'|no html}}
+
|left-link      = {{#cargo_query:|tables=nh_bug|fields=_pageTitle|where=nh_bug.number='{{#ifeq:{{PAGENAME}}|Common butterfly|80|{{#expr:{{#var:number}}-1}}}}'|no html}}
|left-text      = ('''{{#cargo_query:|tables=nh_bug|fields=number|where=nh_bug.name='{{#replace:{{#var:leftname}}|'|\'}}'|no html}}''') {{#var:leftname}}
+
|left-text      = ('''{{#cargo_query:|tables=nh_bug|fields=number|where=nh_bug.name='{{#replace:{{#var:leftname}}|'|\'}}'|no html}}''') {{#invoke:SentenceCase|main|{{#var:leftname}}}}
|middle-link    = Bugs/New Horizons
+
|middle-link    = Bug/New Horizons
 
|middle-text    = {{NH|short|nolink}} bugs
 
|middle-text    = {{NH|short|nolink}} bugs
 
|right-link      = {{#cargo_query:|tables=nh_bug|fields=_pageTitle|where=nh_bug.number='{{#ifeq:{{PAGENAME}}|Scorpion|1|{{#expr:{{#var:number}}+1}}}}'|no html}}
 
|right-link      = {{#cargo_query:|tables=nh_bug|fields=_pageTitle|where=nh_bug.number='{{#ifeq:{{PAGENAME}}|Scorpion|1|{{#expr:{{#var:number}}+1}}}}'|no html}}
|right-text      = {{#var:rightname}} ('''{{#cargo_query:|tables=nh_bug|fields=number|where=nh_bug.name='{{#replace:{{#var:rightname}}|'|\'}}'|no html}}''')
+
|right-text      = {{#invoke:SentenceCase|main|{{#var:rightname}}}} ('''{{#cargo_query:|tables=nh_bug|fields=number|where=nh_bug.name='{{#replace:{{#var:rightname}}|'|\'}}'|no html}}''')
|left-image      = File:{{#cargo_query:|tables=nh_bug|fields=image|where=nh_bug.number='{{#ifeq:{{PAGENAME}}|Common Butterfly|80|{{#expr:{{#var:number}}-1}}}}'|no html}}
+
|left-image      = File:{{#cargo_query:|tables=nh_bug|fields=image|where=nh_bug.number='{{#ifeq:{{PAGENAME}}|Common butterfly|80|{{#expr:{{#var:number}}-1}}}}'|no html}}
 
|left-imagesize  = 40px
 
|left-imagesize  = 40px
 
|right-image    = File:{{#cargo_query:|tables=nh_bug|fields=image|where=nh_bug.number='{{#ifeq:{{PAGENAME}}|Scorpion|1|{{#expr:{{#var:number}}+1}}}}'|no html}}
 
|right-image    = File:{{#cargo_query:|tables=nh_bug|fields=image|where=nh_bug.number='{{#ifeq:{{PAGENAME}}|Scorpion|1|{{#expr:{{#var:number}}+1}}}}'|no html}}
 
|right-imagesize = 40px
 
|right-imagesize = 40px
 
}}<noinclude>{{Documentation}} [[Category:Header templates]][[Category:Pages using the Variables extension]]</noinclude>
 
}}<noinclude>{{Documentation}} [[Category:Header templates]][[Category:Pages using the Variables extension]]</noinclude>

Latest revision as of 08:15, May 18, 2024

Template documentation (view)


Notes

This template is for use only on New Horizons bug pages and will not function properly elsewhere. It automatically generates the previous and last bug in the series based on that bug's internal number, as sourced from its Cargo data. It uses {{PAGENAME}} as input, so the bug's name as stored in Cargo must exactly match its article name for proper functionality.

See also