Difference between revisions of "Template:Featured picture index"

From QBWiki
Jump to navigation Jump to search
(Created page with "{{#vardefine:index|{{{1|1}}}}}{{#if:{{QBWiki:Featured picture/{{#var:index}}}} |{{QBWiki:Featured picture/{{#var:index}}}} |{{#vardefine:minindex|{{#var:index}}}}{{#vardefine:...")
 
m
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#vardefine:index|{{{1|1}}}}}{{#if:{{QBWiki:Featured picture/{{#var:index}}}}
+
<includeonly>{{#vardefine:index{{{1|1}}}}}{{Add|index|1}}{{#ifexist:QBWiki:Featured picture/{{#var:index}}
|{{QBWiki:Featured picture/{{#var:index}}}}
+
|{{#if:{{{indexonly|}}}|{{#var:index}}|{{QBWiki:Featured picture/{{#var:index}}}}}}
 
|{{#vardefine:minindex|{{#var:index}}}}{{#vardefine:maxindex|1}}<!--
 
|{{#vardefine:minindex|{{#var:index}}}}{{#vardefine:maxindex|1}}<!--
 
just for fun, binary search for last list entry if out of bounds
 
just for fun, binary search for last list entry if out of bounds
 
-->{{#dowhile:
 
-->{{#dowhile:
 
|{{#ifexpr:{{#var:maxindex}}+1<{{#var:minindex}}|continue}}
 
|{{#ifexpr:{{#var:maxindex}}+1<{{#var:minindex}}|continue}}
|{{#if:{{QBWiki:Featured picture/{{#var:index}}}}
+
|{{#ifexist:QBWiki:Featured picture/{{#var:index}}
 
<!--undershoot-->|{{#ifexpr:{{#var:index}}>{{#var:maxindex}}|{{#vardefine:maxindex|{{#var:index}}}}}}
 
<!--undershoot-->|{{#ifexpr:{{#var:index}}>{{#var:maxindex}}|{{#vardefine:maxindex|{{#var:index}}}}}}
 
<!-- overshoot-->|{{#ifexpr:{{#var:index}}<{{#var:minindex}}|{{#vardefine:minindex|{{#var:index}}}}}}
 
<!-- overshoot-->|{{#ifexpr:{{#var:index}}<{{#var:minindex}}|{{#vardefine:minindex|{{#var:index}}}}}}
 
}}
 
}}
 
{{#vardefine:index|{{#expr:floor(({{#var:maxindex}}+{{#var:minindex}})/2)}}}}
 
{{#vardefine:index|{{#expr:floor(({{#var:maxindex}}+{{#var:minindex}})/2)}}}}
}}{{#vardefine:adjusted_index|{{#expr:({{{1|1}}} mod {{#var:index}})}}}}{{#ifexpr:{{#var:adjusted_index}}=0|{{#vardefine:adjusted_index|{{#var:index}}}}}}{{QBWiki:Featured picture/{{#var:adjusted_index}}}}
+
}}{{#vardefine:adjusted_index|{{#expr:({{{1|1}}} mod {{#var:index}})}}}}{{#ifexpr:{{#var:adjusted_index}}=0|{{#vardefine:adjusted_index|{{#var:index}}}}}}{{#if:{{{indexonly|}}}|{{#var:adjusted_index}}|{{QBWiki:Featured picture/{{#var:adjusted_index}}}}}}
}}<noinclude>
+
}}</includeonly><noinclude>
 
Retrieve specific featured pictures from the list of featured pictures to be used in [[QBWiki:Featured picture]].
 
Retrieve specific featured pictures from the list of featured pictures to be used in [[QBWiki:Featured picture]].
 +
 +
When index i <= # of lingo quips, return quip straight away. If i > #, it'll wrap around (mod #).
 +
 +
Providing a value for the optional parameter "indexonly" specifies that, rather than transcluding the page, the index is provided instead. This is intended to be used to construct links.
  
 
{| class="wikitable"
 
{| class="wikitable"
 
! Index
 
! Index
 
! Featured picture
 
! Featured picture
 +
! "indexonly"
 
|-
 
|-
 
|1
 
|1
 
|{{Featured picture index|1}}
 
|{{Featured picture index|1}}
 +
|{{Featured picture index|1|indexonly=true}}
 
|-
 
|-
 
|2
 
|2
 
|{{Featured picture index|2}}
 
|{{Featured picture index|2}}
 +
|{{Featured picture index|2|indexonly=true}}
 
|-
 
|-
 
|3
 
|3
 
|{{Featured picture index|3}}
 
|{{Featured picture index|3}}
 +
|{{Featured picture index|3|indexonly=true}}
 
|}
 
|}
 
etc.
 
etc.
 
</noinclude>
 
</noinclude>

Latest revision as of 16:00, 1 January 2023

Retrieve specific featured pictures from the list of featured pictures to be used in QBWiki:Featured picture.

When index i <= # of lingo quips, return quip straight away. If i > #, it'll wrap around (mod #).

Providing a value for the optional parameter "indexonly" specifies that, rather than transcluding the page, the index is provided instead. This is intended to be used to construct links.

Index Featured picture "indexonly"
1

Solon.jpg

The Solon High School quizbowl team competes at the 2018 PACE National Scholastic Championship.

Photo credit: David Reinstein

2
2

UCF ACF Fall 2014.jpeg

The University of Central Florida team after winning the 2014 ACF Fall, hosted at the University of Florida.

Pictured from left to right: Sean Chagani, Michael Tichy, Zach Foster, Mickey Sizemore. Person entering from left is unidentified.

Photo credit: Cody Johansen

4
3

Imperial 2023 Nats.png

The moderator snaps a photo of the Imperial College London team during their final game at 2023 ACF Nationals, held at MIT.

Pictured: Enoch Yuen, Rahim Dina, Michael Mays, and Carlos Doebeli

Photo credit: undetermined

3

etc.