Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Gallery Section: Difference between revisions

Template page
mNo edit summary
m (escape extra " in captions that could break the html)
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly><!--
<includeonly><!--
{{ #vardefine: THREE | {{{2}}} {{{3}}} }} doesn't exist no matter what, so
note that: {{ #vardefine: THREE | {{{2}}} {{{3}}} }} doesn't exist no matter what, so we use a work-around with variables ONE and TWO instead.  
use a work around with variables.  
-->{{#vardefine:ONE | {{{2}}} }}{{#vardefine:TWO | {{{3}}} }}{{#vardefine:THREE | {{#var:ONE}} {{#var:TWO}} }}<!--
-->{{#vardefine:ONE
-->{{#if:{{{count_all|}}}
|{{{2}}} }}{{#vardefine:TWO
| {{#vardefine:COUNT| {{{count_all|0}}} }}
|{{{3}}} }}{{#vardefine:THREE
| {{#vardefine:COUNT|{{#var:{{#var:THREE}}}}}}
|{{#var:ONE}} {{#var:TWO}}
}}<!--
}}{{#ifeq: 0 | {{#var:{{#var:THREE}} }}
-->{{#ifeq: 0 | {{#var:COUNT}}
  |<!-- do nothing if no images -->
  |<!-- do nothing if no images -->
  |{{#switch:{{#var:TWO}
  |{{#switch:{{{4}}}
  | Main Artwork=<!-- if this section is a Main Artwork section,
        |h2=<h2>{{#if:{{{5|}}}|{{{5}}}|{{{2}}}}}</h2>
        then we sort first by Date and second by
        |h3=<h3>{{#if:{{{5|}}}|{{{5}}}|{{{2}}}}}</h3>
        alphabetical order
    -->{{#switch:{{{4}}}
  |h2=<h2>{{#if:{{{5|}}}|{{{5}}}|{{{2}}}}}</h2>
  |h3=<h3>{{#if:{{{5|}}}|{{{5}}}|{{{2}}}}}</h3>
   }}
   }}
   {{#ask:
   {{#ask:
     [[Category:{{{1}}}]]
     [[Category:{{{1}}}]]
     [[Category:{{{2}}}]]
     [[Category:{{{2|}}}]]
     [[Category:{{{3|}}}]]
     [[Category:{{{3|}}}]]
     |?caption
     |?Caption
     |?Date
     |?Date
     |format=gallery
     |format=gallery
     |autocaptions=no
     |autocaptions=no
     |captionproperty=?caption
     |captionproperty={{#replace:?Caption|"|\"}}
     |sort=?Date
     |widths={{{widths|250}}}
     |order=ascending, ascending
     |limit={{{limit|10000}}}
     |perrow=7
     |sort=Date
     |limit=10000
     |order=asc, asc
   }}
   }}
  |default=<!-- else don't sort by date
    -->{{#switch:{{{4}}}
  |h2=<h2>{{#if:{{{5|}}}|{{{5}}}|{{{2}}}}}</h2>
  |h3=<h3>{{#if:{{{5|}}}|{{{5}}}|{{{2}}}}}</h3>
  }}
  {{#ask:
    [[Category:{{{1}}}]]
    [[Category:{{{2}}}]]
    [[Category:{{{3|}}}]]
    |?caption
    |format=gallery
    |autocaptions=no
    |captionproperty=?caption
    |perrow=7
    |limit=10000
  }}
}}
}}</includeonly><noinclude>
}}</includeonly><noinclude>
== Description ==
{{Documentation}}
A helper/sub-template of [[Template:Master Gallery]].
 
Creates a section header with the specified depth (h2, h3, h4, h5), and a gallery of all images that contain the two specified tags. If there are no images in the specified gallery, this code will not do anything. (That is, it is safe to call even when "Kagura Mutsuki" does not have images in the category "XBlaze" -- an extraneous "XBlaze" header will not appear on Kagura's gallery page.)
 
== Template Usage ==
<pre><nowiki>
{{ Gallery Section
  | Kagura Mutsuki  <-- {{{1}}} Image category 1 (this must be the CHARACTER'S NAME)
  | Main Artwork    <-- {{{2}}} Image category 2
  |                <-- {{{3}}} Image Category 3 (optional)
  | h2              <-- {{{4}}} Header depth (h2, h3, h4, h5)
  | Main Artwork    <-- {{{5}}} Section header (optional, will default to {{{2}}} )
}}
 
ie. {{ Gallery Section | Kagura Mutsuki | Main Artwork | | h2 }}
ie. {{ Gallery Section | Kagura Mutsuki | Chrono Phantasma | Story | h3 | Chrono Phantasma }}
</nowiki></pre>
[[Category:Graphic templates]]
</noinclude>
</noinclude>

Latest revision as of 00:37, 10 March 2021

Documentation icon Template documentation[view] [edit] [history] [purge]

Description

A helper/sub-template of Template:Master Gallery.

Creates a section header with the specified depth (h2, h3, h4, h5), and a gallery of all images that contain the two specified tags. If there are no images in the specified gallery, this code will not do anything. (That is, it is safe to call even when "Kagura Mutsuki" does not have images in the category "XBlaze" -- an extraneous "XBlaze" header will not appear on Kagura's gallery page.)

Template Usage

{{ Gallery Section
  | Kagura Mutsuki  <-- {{{1}}} Image category 1 (this must be the CHARACTER'S NAME)
  | Main Artwork    <-- {{{2}}} Image category 2
  |                 <-- {{{3}}} Image Category 3 (optional)
  | h2              <-- {{{4}}} Header depth (h2, h3, h4, h5)
  | Main Artwork    <-- {{{5}}} Section header (optional, will default to {{{2}}} )

  | widths = optional gallery widths (defaults to 250) 
  | limit = optional number of items returned from the #ask query (defaults to 10000)
}}

ie. {{ Gallery Section | Kagura Mutsuki | Main Artwork | | h2 }}
ie. {{ Gallery Section | Kagura Mutsuki | Chrono Phantasma | Story | h3 | Chrono Phantasma }}

Named parameters (widths, limit) need to come after unnamed ones (positional ones) like the categories and header depth.