Template:Section: Difference between revisions

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

Latest revision as of 11:59, 2 May 2022