Difference between revisions of "Template:Gliders"

From LifeWiki
Jump to navigation Jump to search
m (Replaced space with hyphen)
(If cost > 100, link to 101 or more category)
Line 1: Line 1:
<includeonly>{{#if: {{{cost|{{{1|}}}}}} | [[:Category:Patterns that can be constructed with {{{cost|{{{1|}}}}}} gliders|{{{cost|{{{1|}}}}}}]] | '''no glider cost specified!''' }}{{#if: {{{2|}}} | | -[[glider]] }}</includeonly><noinclude>{{Template:Gliders/Doc}} [[Category:Templates]]</noinclude>
<includeonly>{{#if: {{{cost|{{{1|}}}}}} | {{#ifexpr: {{{cost|{{{1|}}}}}} > 100 | [[:Category:Patterns that can be constructed with 101 or more gliders|{{{cost|{{{1|}}}}}}]] | [[:Category:Patterns that can be constructed with {{{cost|{{{1|}}}}}} gliders|{{{cost|{{{1|}}}}}}]] }} | '''no glider cost specified!''' }}{{#if: {{{2|}}} | | -[[glider]] }}</includeonly><noinclude>{{Template:Gliders/Doc}} [[Category:Templates]]</noinclude>

Revision as of 03:08, 29 June 2019

This template can be used to quickly and easily embed a link to the category of patterns with a given glider cost. For example,

The frobnozzle has a {{gliders|15}} [[synthesis]] discovered by [[Jason Summers]].

becomes

The frobnozzle has a 15-glider synthesis discovered by Jason Summers.

(This is much more convenient than having to type the equivalent of

The frobnozzle has a [[:Category:Patterns that can be constructed with 15 gliders|15-glider]] [[synthesis]] discovered by Jason Summers.

everytime you want to link to a glider synthesis category.)

The template takes two parameters, the first of which is the cost and can be passed without a name or as cost=. The second one is passed without a name and removes the "glider" from the resulting text:

Infinite growth patterns can be constructed with as few as {{gliders|3|brief}} [[glider]]s.

becomes

Infinite growth patterns can be constructed with as few as 3 gliders.

If the specified cost is at least 50 gliders, the template will link to the relevant category thanks to the use of {{GlidersCategoryName}}:

A {{gliders|256}} [[synthesis]] for the frobnozzle gun was discovered by [[Martin Grant]].

becomes

A 256-glider synthesis for the frobnozzle gun was discovered by Martin Grant. (links to Category:Patterns that can be constructed with between 200 and 299 gliders)

It is also possible to specify an arbitrary link text in an optional parameter text=. For example,

Infinite growth patterns can be constructed with as few as {{gliders|3|text=3 gliders}}.

becomes

Infinite growth patterns can be constructed with as few as 3-glider.