Template:VersionRevision: Difference between revisions

Jump to navigation Jump to search
(enable parameter input such as "v2.0")
(Overhaul for the git versioning changes, see Template talk:VersionRevision for more info.)
Line 1: Line 1:
<includeonly>{{#switch:{{{use|}}}
<includeonly>{{#switch:{{{use|}}}
|title={{#switch:{{{1}}}
|title={{#switch:{{{1}}}<!--pretty title format-->
  |2.0|v2.0=2.0 (RC)
|2.0|v2.0=2.0
  |3.0|v3.0=3.0
|3.0|v3.0=3.0
  |#default=r{{{1}}}
|5350|r5350=2.0
}}
|7617|r7617=3.0
|link|#default={{#switch:{{{1}}}
<!--switch cannot handle regex, so anything more complicated than straight match goes into default-->
  |2.0|v2.0=5350
|#default=
  |3.0|v3.0=7617
{{#if:{{#regex:{{{1}}}|/^[0-9]\.[0-9]\-[0-9]+$/}}<!--found a new-format git release-->
  |#default={{{1}}}
|{{#regex:{{{1}}}|/^[0-9]\.[0-9]\-[0-9]+$/}}<!--input is git; output in the format we received it in-->
}}
|{{#if:{{#regex:{{{1}}}|/^r[0-9]{1,4}$/}}<!--input is not git; detect whether we have a leading 'r'-->
|{{{1}}}<!--we do, output as-is-->
|r{{{1}}}<!--we do not, add a leading 'r'-->
}}
}}
}}
|link|#default={{#switch:{{{1}}}<!--link format, mostly for calculations and other templates use-->
|2.0|v2.0=5350
|3.0|v3.0=7617
<!--switch cannot handle regex, so anything more complicated than straight match goes into default-->
|#default=
{{#if:{{#regex:{{{1}}}|/^[0-9]\.[0-9]\-[0-9]+$/}}<!--found a new-format git release-->
|{{#expr:<!--basically, we're doing... (rev value of the base revision) + (build number)-->
{{#switch:{{#regex:{{{1}}}|/^[0-9\.[0-9]/}}<!--switching on the first part of the rev (3.0, 4.0, etc)-->
|3.0=7617
}}
+{{#regex:{{{1}}}|/^[0-9]\.[0-9]\-([0-9]+$)/|$1}}}}
|{{#if:{{#regex:{{{1}}}|/^[r,R][0-9]{1,4}/}}
|{{#switch:{{#regex:{{{1}}}|/^[r,R]/|}}
|2.0|v2.0=5350
|3.0|v3.0=7617
|#default={{#regex:{{{1}}}|/^[r,R]/|}}}}
|{{{1}}}
}}
}}
}}
}}</includeonly><noinclude>
}}</includeonly><noinclude>
{{documentation}}
{{documentation}}
</noinclude>
</noinclude>