Template talk:Chart Box

From Bulbapedia, the community-driven Pokémon encyclopedia.
Latest comment: 18 November 2024 by Storm Aurora in topic Broaden the scope
⧼bulbapediamonobook-jumptonavigation⧽⧼bulbapediamonobook-jumptosearch⧽

Broaden the scope

I'm looking forward to broaden the scope of this template. As you can see, typing any roman numeral except for those from I to IX will always result in broken links. The good tidings is, I'm wondering if there's a possibility to fix the template so that the broken links will be replaced with with {{unknown color}}, {{unknown color dark}}, and {{unknown color light}}, respectively.

The template currently reads as follows:

{| class="roundy" style="margin:auto; text-align:center; background: #{{Gen {{{1|I}}} color}}; border: 2px solid #{{Gen {{{1|I}}} color light}}; width: 10em; height: 12em; position: relative; margin: 0.5em" cellspacing="0" cellpadding="0" border="0"
|-
! style="background:#{{Gen {{{1|I}}} color dark}}; {{roundytop|5px}}" | {{color2|{{Gen {{{1|I}}} color light}}|Generation {{{1|}}}|{{{1|Unknown}}}}}
|-
! [[File:{{{image|None.png}}}|100px]]
|- style="{{#if:{{{text|}}}||display: none;}}"
| style="font-size:80%" | {{color|000|{{{text}}}}}
|-
| style="background:#{{Gen {{{1|I}}} color dark}}; color: #{{Gen {{{1|I}}} color light}}; {{roundybottom|5px}}" | {{pcolor|{{{name|Unknown}}}|{{Gen {{{1|I}}} color light}}}}{{#if:{{{form|}}}|<br><small>{{{form|Unknown}}}</small>}}
|}<noinclude>[[Category:Table templates]]</noinclude>
Unknown
Unknown

However, once this proposal gets accepted, the template will read as follows:

{| class="roundy" style="margin:auto; text-align:center; background: #{{{{#switch:{{{1}}}|I=Kanto|II=Johto|III=Hoenn|IV=Sinnoh|V=Unova|VI=Kalos|VII=Alola|VIII=Galar|IX=Paldea|#default=Unknown}} color}}; border: 2px solid #{{{{#switch:{{{1}}}|I=Kanto|II=Johto|III=Hoenn|IV=Sinnoh|V=Unova|VI=Kalos|VII=Alola|VIII=Galar|IX=Paldea|#default=Unknown}} color light}}; width: 10em; height: 12em; position: relative; margin: 0.5em" cellspacing="0" cellpadding="0" border="0"
|-
! style="background:#{{{{#switch:{{{1}}}|I=Kanto|II=Johto|III=Hoenn|IV=Sinnoh|V=Unova|VI=Kalos|VII=Alola|VIII=Galar|IX=Paldea|#default=Unknown}} color dark}}; {{roundytop|5px}}" | {{color2|{{{{#switch:{{{1}}}|I=Kanto|II=Johto|III=Hoenn|IV=Sinnoh|V=Unova|VI=Kalos|VII=Alola|VIII=Galar|IX=Paldea|#default=Unknown}} color light}}|Generation {{{1|}}}|{{{1|Unknown}}}}}
|-
! [[File:{{{image|None.png}}}|100px]]
|- style="{{#if:{{{text|}}}||display: none;}}"
| style="font-size:80%" | {{color|000|{{{text}}}}}
|-
| style="background:#{{{{#switch:{{{1}}}|I=Kanto|II=Johto|III=Hoenn|IV=Sinnoh|V=Unova|VI=Kalos|VII=Alola|VIII=Galar|IX=Paldea|#default=Unknown}} color dark}}; {{roundybottom|5px}}" | {{pcolor|{{{name|Unown}}}|{{{{#switch:{{{1}}}|I=Kanto|II=Johto|III=Hoenn|IV=Sinnoh|V=Unova|VI=Kalos|VII=Alola|VIII=Galar|IX=Paldea|#default=Unknown}} color light}}|{{{name|Unknown}}}}}{{#if:{{{form|}}}|<br><small>{{color|{{{{#switch:{{{1}}}|I=Kanto|II=Johto|III=Hoenn|IV=Sinnoh|V=Unova|VI=Kalos|VII=Alola|VIII=Galar|IX=Paldea|#default=Unknown}} color light}}|{{{form|Normal Form}}}}}}}</small>
|}<noinclude>[[Category:Table templates]]</noinclude>
Unknown
Unown

That way, we'll never have to worry about broken links. What do you think of this possibility? SaturnMario, his talk and his contributions 22:13, 16 November 2024 (UTC)Reply

Hmm, I see where you're coming from and I appreciate your concern about broken links. However, this template is used many times on a single page (List of cross-generational evolutionary lines), so putting lots of switch statements (which cost a lot of processing time) in the template is likely to have a significant negative impact on load times for that page. That cost doesn't seem worth the benefit. As long as the template is being used properly (like it is now), broken links shouldn't be an issue. You mentioned that you're interesting in broadening the scope of the template, though—does that mean you want to use it on other pages? Storm Aurora (talk) 23:33, 18 November 2024 (UTC)Reply