Difference between revisions of "Template:Gliders"

From LifeWiki
Jump to: navigation, 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>

Latest 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 101 gliders, the template will instead link to the "101 or more gliders" category:

A {{gliders|601}} [[synthesis]] for the [[spider]] was discovered by [[Martin Grant]].

becomes

A 601-glider synthesis for the spider was discovered by Martin Grant.