Difference between revisions of "Template:Quick links smart in-jokes"
Jump to navigation
Jump to search
Kevin Wang (talk | contribs) (Created page with "{{#vardefine:quip|{{#explode:{{:QBWiki:Quick links/in-jokes}}|*|{{{1|1}}}|1000}}}}{{#if:{{#var:quip}}|{{#var:quip}}}}<noinclude> Extract individual quips from the list at Q...") |
Kevin Wang (talk | contribs) |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | {{#vardefine: | + | {{#vardefine:index|{{{1|1}}}}}{{Add|index|1}}{{#if:{{Quick links in-jokes|{{#var:index}}}} |
| + | |{{Quick links in-jokes|{{#var:index}}}} | ||
| + | |{{#vardefine:minindex|{{#var:index}}}}{{#vardefine:maxindex|1}}<!-- | ||
| + | just for fun, binary search for last list entry if out of bounds | ||
| + | -->{{#dowhile: | ||
| + | |{{#ifexpr:{{#var:maxindex}}+1<{{#var:minindex}}|continue}} | ||
| + | |{{#if:{{Quick links in-jokes|{{#var:index}}}} | ||
| + | <!--undershoot-->|{{#ifexpr:{{#var:index}}>{{#var:maxindex}}|{{#vardefine:maxindex|{{#var:index}}}}}} | ||
| + | <!-- overshoot-->|{{#ifexpr:{{#var:index}}<{{#var:minindex}}|{{#vardefine:minindex|{{#var:index}}}}}} | ||
| + | }} | ||
| + | {{#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}}}}}}{{Quick links in-jokes|{{#var:adjusted_index}}}} | ||
| + | }}<noinclude> | ||
| − | + | Incremental improvement on [[Template:Quick links in-jokes]] | |
| − | # | + | When index i <= # of in-jokes quips, return quip straight away. If i > #, it'll wrap around (mod #). |
| − | # | ||
| − | + | {| class="wikitable" | |
| + | ! Index | ||
| + | ! Quip | ||
| + | |- | ||
| + | |1||{{Quick links smart in-jokes|1}} Test sentence | ||
| + | |- | ||
| + | |2||{{Quick links smart in-jokes|2}} Test sentence | ||
| + | |- | ||
| + | |3||{{Quick links smart in-jokes|3}} Test sentence | ||
| + | |} | ||
</noinclude> | </noinclude> | ||
Latest revision as of 15:59, 1 January 2023
Interested in the significance of capybaras?
Incremental improvement on Template:Quick links in-jokes
When index i <= # of in-jokes quips, return quip straight away. If i > #, it'll wrap around (mod #).
| Index | Quip |
|---|---|
| 1 | Interested in the significance of capybaras? Test sentence |
| 2 | Ever notice how frequently quizbowlers use the verb "barge"? Test sentence |
| 3 | Ever notice how frequently quizbowlers use the verb "barge"? Test sentence |