Template:Section: Difference between revisions

From Elwiki
mNo edit summary
m (Reverted edits by Ritsu (talk) to last revision by Boxsnake)
Tag: Rollback
 
(38 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly>__NOTOC__<table cellspacing="0" cellpadding="0" style="width:{{{Widths|100%}}}; padding: 0; margin: 0; font-size: 1em; line-height: 1.5em; border: 1px #000 solid; border-bottom: none; border-sapcing: 0;{{{SectionSty|}}}" {{{Attr|}}}>
__NOTOC__<includeonly><table
   <tr style="width: 100%; text-align: center; vertical-align: middle; height: 2em;{{{TitleStys|}}}">{{#forargs:Title
  style="
| key
    {{#if:{{{Widths|}}}|width:{{{Widths|}}};}}
| value
    {{{SectionSty|}}}
| {{#ifexpr:{{#if:{{#var:value|}}|1|0}} and {{Isnumeric|{{#var:key|}}}}|<th style="width:{{{Width{{#var:key|}}|{{{Width|}}}}}}; {{#ifeq:{{#var:key|}}|0||border-left: 1px #000 solid;}}border-bottom: 1px #000 solid; background-color:{{{Color{{#var:key|}}|{{{Color|}}}}}}; background-image: linear-gradient(to bottom, #eee, {{{Color{{#var:key|}}|{{{Color|}}}}}});{{{TitleSty|}}};{{{TitleSty{{#var:key|}}|}}}" {{{Attr{{#var:key|}}|}}}><h2 id="{{anchorencode:{{#var:value|}}}}" style="border-bottom: none; display: inline; font-size: 1em; font-weight: bold; color: #fff; text-shadow: 1px 1px 1px black;">{{#var:value|}}</h2></th>}}}}</tr>
  "
   <tr style="width: 100%; vertical-align: top;{{{Styles|}}}">{{#forargs:Title
  class="
| key
    section
| value
    {{{SectionCls|}}}
| {{#ifexpr:{{#if:{{#var:value|}}|1|0}} and {{Isnumeric|{{#var:key|}}}}|<td id="{{#var:key}}" style="padding: 0.5em;{{{Style|}}};{{{Style{{#var:key|}}|}}}">{{{Content{{#var:key|}}|}}}</td>}}}}</tr>
  "
</table></includeonly><noinclude>__TOC__{{DISPLAYTITLE:Section}}
  {{{Attr|}}}
{{Section
>
| Color0=lightgreen
   <tr
| Title0=Section Template
    style="{{{hStyles|}}}"
| Content0=Section is an UI template developed by '''[[User:boxsnake|boxsnake]]''', in order to enhance the UI design. Also, this is an example of ''Section''.
    class="
}}
      textfloat
{{Section
      {{{hClses|}}}
| Color0=purple
      {{#ifeq:{{{Color|}}}|Rainbow|rainbow}}
| Title0=Parameters
    ">
| Content0=<span>
    {{#forargs:Title
# ''Section'' only have one row, but can have as many columns as you want. More columns takes more time.
      | key
#* If you want more than one rows, more than one ''Section'' will help.
      | value
# If parameter(s) starting with '''Title''' and following by numbers (e.g. '''Title0''') is/are specified, the corresponding column(s) will be added.
      | {{#if:{{#var:value|}}
#* Note every column except '''Title0''' has left border, in order to be extended from the left column.
          |<th
# Parameters for '''<u>Table</u>''' (Whole ''Section''):
            style="
## '''SectionSty''' - CSS syntax style for ''Section''.
              {{#if:{{{Width|}}}|width:{{{Width}}};}}
## '''Attr''' - HTML syntax for ''Section''.
              {{#if:{{{Width{{#var:key|}}|}}}|width:{{{Width{{#var:key|}}}}};}}
## '''Widths''' - CSS syntax width for ''Section''. Default: '''100%'''.
              {{#if:{{{Color|}}}|background-color:{{{Color}}};}}
# Parameters for '''<u>Headlines</u>''' (where '''Title''' goes):
              {{#if:{{{Color{{#var:key|}}|}}}|background-color:{{{Color{{#var:key|}}}}};}}
## '''TitleStys''' - CSS syntax style for whole headline.
              {{{hStyle|}}};
## '''TitleSty''' - CSS syntax style for every header cell.
              {{{hStyle{{#var:key|}}|}}}
## '''TitleSty###''' - CSS syntax style for header of '''Title###'''.
            "
## '''Color''' - CSS syntax color for all headers.
            class="
## '''Color###''' - CSS syntax color for header of '''Title###'''.
              {{{hCls{{#var:key|}}|{{{hCls|}}}}}}
## '''Attr###''' - HTML syntax for header of '''Title###'''.
              {{#ifeq:{{{Color{{#var:key|}}|}}}|Rainbow|rainbow}}
## '''Title###''' - Content in header of '''Title###'''.
            "
# Parameters for '''<u>Contents</u>''':
            {{{hAttr{{#var:key|}}|{{{hAttr|}}}}}}
## '''Styles''' - CSS syntax style for whole content.
          ><!--
## '''Style''' - CSS syntax style for every cell of content.
            -->{{#if:{{{header|}}}
## '''Style###''' - CSS syntax style for content corresponding to '''Title###'''.
              |<h{{{header|}}} id="{{anchorencode:{{#var:value|}}}}">{{#var:value|}}</h{{{header|}}}>
## '''Content###''' - Content in cell of '''Title###'''.
              |{{#var:value|}}
# Parameters for '''<u>Columns</u>''':
            }}<!--
## '''Width''' - CSS syntax width of every column.
          --></th>
## '''Width###''' - CSS syntax width of column of '''Title###'''.
        }}
# Generally, styles will override ancestor styles. For example, '''''TitleStys''''' overrides '''''SectionSty''''', and '''''TitleSty''''' overrides both '''''TitleStys''''' and '''''SectionSty''''', and '''''TitleSty###''''' overrides all the three.
    }}
# If you want table and (un)ordered lists in contents, use '''<span<nowiki/>>''' tag or '''<nowiki><span style="display:none">{{</span>...<span style="display:none">}}</span></nowiki>''' to escape (wrap) the code.
  </tr>
# To be extended from other ''Section'' templates upwards, this template has no bottom border originally, use ''SectionSty'' to specify it if needed.
   <tr
# The lines under each header are stated in '''''TitleSty''''' or '''''TitleSty###''''' rather than '''''TitleStys'''''.
    style="{{{Styles|}}}"
# Default padding in headlines and contents is 0.5em.
    class="{{{Clses|}}}"
# Link anchor can link to ''Section'' headers. (e.g. <nowiki>[[7-4#Mobs:|'''Mobs''']]</nowiki> can link to 7-4's Mobs section.)
  >
# You need __<nowiki/>TOC__ to show TOC of the Sections.
    {{#forargs:Title
</span>
      | key
}}
      | value
{{Section
      | {{#if:{{#var:value|}}
| SectionSty=border-bottom: 1px #000 solid;
          |<td
| Color0=green
            style="
| Title0=Other Samples
              {{#if:{{{Width|}}}|width:{{{Width}}};}}
| Content0=
              {{#if:{{{Width{{#var:key|}}|}}}|width:{{{Width{{#var:key|}}}}};}}
  {{Section
              {{{Style|}}};
  | SectionSty=border: 2px #ccc solid; border-radius: 5px;
              {{{Style{{#var:key|}}|}}}
  | Color0=lightblue
            "
  | Title0=Sample 1
            class="{{{Cls{{#var:key|}}|{{{Cls|}}}}}}"
  | Content0=Sample 1
            {{{Attr{{#var:key|}}|{{{Attr|}}}}}}
  }}<pre>
          ><!--
{{Section
            -->{{{Content{{#var:key|}}|}}}<!--
| SectionSty=border: 2px #ccc solid; border-radius: 5px;
          --></td>
| Color0=lightblue
        }}
| Title0=Sample 1
    }}
| Content0=Sample 1
  </tr>
}}</pre>
</table><includeonly><noinclude>{{Doc}}</noinclude>
}}</noinclude>

Latest revision as of 11:59, 2 May 2022