Permanently protected template

Difference between revisions of "Template:Card table"

From Yugipedia
Jump to: navigation, search
(fix parser function)
(document the image validation stuff in a comment; support up to 20 rows instead of just 15 (needed for {{Anime card}} and I think it'll be needed for CT2 as well))
Line 1: Line 1:
{{ #if: {{{header16|}}}{{{headerstyle16|}}}{{{label16|}}}{{{labelstyle16|}}}{{{data16|}}}{{{datastyle16|}}}{{{class16|}}}{{{rowclass16|}}}
+
{{ #if: {{{header21|}}}{{{headerstyle21|}}}{{{label21|}}}{{{labelstyle21|}}}{{{data21|}}}{{{datastyle21|}}}{{{class21|}}}{{{rowclass21|}}}
 
   | <div class="error">Error: too many rows!</div>[[Category:Card table transclusions with too many rows]]
 
   | <div class="error">Error: too many rows!</div>[[Category:Card table transclusions with too many rows]]
}}{{ #if: {{{image_raw|}}} || {{ #vardefine: $ct_img | {{PAGENAME:{{{image|}}}}}
+
}}<!--
 +
 
 +
image validation code
 +
 
 +
the width validation especially is pretty convoluted, so here's what it's trying to do (ignoring most error checking):
 +
* <max width> is 200px
 +
* this can be overwritten with {{{max_width(_right)}}}, but this has a hardcoded maximum of 400px
 +
* check if an image's <native width> is less than <max width>
 +
* if there's a <specified width>, check that it's smaller than <max width> and larger than 0px
 +
* if there's a valid <specified width>, use it; otherwise, use the smaller of <native width> or <max width>
 +
 
 +
the image itself is also confirmed to exist, by checking if its <native width> is 0px; if so, a default backing image (File:Back-EN.png) is used instead, with a link to the upload form for the specified image
 +
 
 +
-->{{ #if: {{{image_raw|}}} || {{ #vardefine: $ct_img | {{PAGENAME:{{{image|}}}}}
 
   }}{{ #if: {{ #var: $ct_img }} | {{ #ifeq: {{ #imgw: {{ #var: $ct_img }} }} | 0 | {{ #vardefine: $ct_img_name | {{ #var: $ct_img }} }}{{ #vardefine: $ct_img | Back-EN.png }} }}
 
   }}{{ #if: {{ #var: $ct_img }} | {{ #ifeq: {{ #imgw: {{ #var: $ct_img }} }} | 0 | {{ #vardefine: $ct_img_name | {{ #var: $ct_img }} }}{{ #vardefine: $ct_img | Back-EN.png }} }}
 
   }}{{ #vardefine: $ct_max_width | {{px|{{{max_width}}}}}
 
   }}{{ #vardefine: $ct_max_width | {{px|{{{max_width}}}}}
Line 112: Line 125:
 
     |data={{{data15|}}}    |datastyle={{{datastyle|}}}    {{{datastyle15|}}}
 
     |data={{{data15|}}}    |datastyle={{{datastyle|}}}    {{{datastyle15|}}}
 
     |class={{{class15|}}}  |rowclass={{{rowclass15|}}}
 
     |class={{{class15|}}}  |rowclass={{{rowclass15|}}}
 +
    }}{{Infobox/row
 +
    |header={{{header16|}}} |headerstyle={{{headerstyle|}}}{{{headerstyle16|}}}
 +
    |label={{{label16|}}}  |labelstyle={{{labelstyle|}}}  {{{labelstyle16|}}}
 +
    |data={{{data16|}}}    |datastyle={{{datastyle|}}}    {{{datastyle16|}}}
 +
    |class={{{class16|}}}  |rowclass={{{rowclass16|}}}
 +
    }}{{Infobox/row
 +
    |header={{{header17|}}} |headerstyle={{{headerstyle|}}}{{{headerstyle17|}}}
 +
    |label={{{label17|}}}  |labelstyle={{{labelstyle|}}}  {{{labelstyle17|}}}
 +
    |data={{{data17|}}}    |datastyle={{{datastyle|}}}    {{{datastyle17|}}}
 +
    |class={{{class17|}}}  |rowclass={{{rowclass17|}}}
 +
    }}{{Infobox/row
 +
    |header={{{header18|}}} |headerstyle={{{headerstyle|}}}{{{headerstyle18|}}}
 +
    |label={{{label18|}}}  |labelstyle={{{labelstyle|}}}  {{{labelstyle18|}}}
 +
    |data={{{data18|}}}    |datastyle={{{datastyle|}}}    {{{datastyle18|}}}
 +
    |class={{{class18|}}}  |rowclass={{{rowclass18|}}}
 +
    }}{{Infobox/row
 +
    |header={{{header19|}}} |headerstyle={{{headerstyle|}}}{{{headerstyle19|}}}
 +
    |label={{{label19|}}}  |labelstyle={{{labelstyle|}}}  {{{labelstyle19|}}}
 +
    |data={{{data19|}}}    |datastyle={{{datastyle|}}}    {{{datastyle19|}}}
 +
    |class={{{class19|}}}  |rowclass={{{rowclass19|}}}
 +
    }}{{Infobox/row
 +
    |header={{{header20|}}} |headerstyle={{{headerstyle|}}}{{{headerstyle20|}}}
 +
    |label={{{label20|}}}  |labelstyle={{{labelstyle|}}}  {{{labelstyle20|}}}
 +
    |data={{{data20|}}}    |datastyle={{{datastyle|}}}    {{{datastyle20|}}}
 +
    |class={{{class20|}}}  |rowclass={{{rowclass20|}}}
 
     }}
 
     }}
 
   </table>
 
   </table>

Revision as of 15:52, 27 May 2018

{{{title}}}
{{{above}}}
{{{above_image}}}
[[File:|0px|link=File:]]
{{{below_image}}}
{{{below}}}