Template:Checked time unit: Difference between revisions

From Guild of Archivists
(Create 'Checked time unit' template. This template is intended as a backend for other templates implementing range-checked time units.)
 
(Remove unintended trailing newline.)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#if: {{{1|{{{ordinal|}}}}}} || {{error|Parameters 1 or ordinal must be provided with a valid argument.}}}}<!--
<includeonly>{{#if: {{{1|{{{ordinal|}}}}}} || {{error|Parameters 1 or ordinal must be provided with a valid argument.}}}}<!--
-->{{#if: {{{1|{{{ordinal|}}}}}} || {{#if: {{{2|{{{minimum|}}}}}} ||&nbsp;}}}}<!--
-->{{#if: {{{1|{{{ordinal|}}}}}} || {{#if: {{{2|{{{minimum|}}}}}} ||&nbsp;}}}}<!--
-->{{#if: {{{2|{{{minimum|}}}}}} || {{error|Parameters 2 or minimum must be provided with a valid argument.}}}}<!--
-->{{#if: {{{2|{{{minimum|}}}}}} || {{error|Parameters 2 or minimum must be provided with a valid argument.}}}}<!--
Line 8: Line 8:
{{#if: {{{1|{{{ordinal|}}}}}} |
{{#if: {{{1|{{{ordinal|}}}}}} |
{{#ifexpr: (({{{1|{{{ordinal|0}}}}}} >= {{{2|{{{minimum|0}}}}}}) and ({{{1|{{{ordinal|0}}}}}} <= {{{3|{{{maximum|0}}}}}}))
{{#ifexpr: (({{{1|{{{ordinal|0}}}}}} >= {{{2|{{{minimum|0}}}}}}) and ({{{1|{{{ordinal|0}}}}}} <= {{{3|{{{maximum|0}}}}}}))
| {{{1}}}
| {{{1|{{{ordinal|0}}}}}}
| {{error|Provided argument must be an integer between {{{2|{{{minimum|0}}}}}} and {{{3|{{{maximum|0}}}}}} inclusive.}}
| {{error|Provided argument must be an integer between {{{2|{{{minimum|0}}}}}} and {{{3|{{{maximum|0}}}}}} inclusive.}}
}}
}}
}}
}}
}}
}}
}}
}}</includeonly><!--
--><noinclude>{{Documentation}}</noinclude>

Latest revision as of 01:52, 2 December 2024

Template documentation[view] [edit] [history] [purge]

A template that produces an error message if a value is beyond a specified range. It is intended to be used for implementing various range-checked time unit templates, and its error messages reflect this through the use of 'ordinal' as a named parameter in the error messages.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Ordinal1 ordinal

The value to be kept in range.

Numberrequired
Minimum2 minimum

The minimum of the inclusive range.

Numberrequired
Maximum3 maximum

The maximum of the inclusive range.

Numberrequired