[DEV-12990] Add gt, gte, lt, lte operators to if/unless
This includes updating Tamer's parser to account for the new operator possibilities.main
parent
25babde084
commit
00f46b0032
|
@ -823,6 +823,61 @@
|
|||
</if>
|
||||
</template>
|
||||
|
||||
<template match="lv:*[@gt]" mode="preproc:apply-template-cmp" priority="5">
|
||||
<param name="negate" select="false()" />
|
||||
<param name="param-value" />
|
||||
<param name="cmp-value" />
|
||||
|
||||
<if test="
|
||||
( ( $negate = 'true' ) and not( $param-value > $cmp-value ) )
|
||||
or ( ( $negate = 'false' ) and ( $param-value > $cmp-value ) )
|
||||
">
|
||||
|
||||
<apply-templates select="*" mode="preproc:apply-template" />
|
||||
</if>
|
||||
</template>
|
||||
|
||||
<template match="lv:*[@gte]" mode="preproc:apply-template-cmp" priority="5">
|
||||
<param name="negate" select="false()" />
|
||||
<param name="param-value" />
|
||||
<param name="cmp-value" />
|
||||
|
||||
<if test="
|
||||
( ( $negate = 'true' ) and not( $param-value >= $cmp-value ) )
|
||||
or ( ( $negate = 'false' ) and ( $param-value >= $cmp-value ) )
|
||||
">
|
||||
|
||||
<apply-templates select="*" mode="preproc:apply-template" />
|
||||
</if>
|
||||
</template>
|
||||
|
||||
<template match="lv:*[@lt]" mode="preproc:apply-template-cmp" priority="5">
|
||||
<param name="negate" select="false()" />
|
||||
<param name="param-value" />
|
||||
<param name="cmp-value" />
|
||||
|
||||
<if test="
|
||||
( ( $negate = 'true' ) and not( $param-value < $cmp-value ) )
|
||||
or ( ( $negate = 'false' ) and ( $param-value < $cmp-value ) )
|
||||
">
|
||||
|
||||
<apply-templates select="*" mode="preproc:apply-template" />
|
||||
</if>
|
||||
</template>
|
||||
|
||||
<template match="lv:*[@lte]" mode="preproc:apply-template-cmp" priority="5">
|
||||
<param name="negate" select="false()" />
|
||||
<param name="param-value" />
|
||||
<param name="cmp-value" />
|
||||
|
||||
<if test="
|
||||
( ( $negate = 'true' ) and not( $param-value <= $cmp-value ) )
|
||||
or ( ( $negate = 'false' ) and ( $param-value <= $cmp-value ) )
|
||||
">
|
||||
|
||||
<apply-templates select="*" mode="preproc:apply-template" />
|
||||
</if>
|
||||
</template>
|
||||
|
||||
<template mode="preproc:apply-template-cmp" priority="5"
|
||||
match="lv:*[ @prefix ]">
|
||||
|
|
|
@ -1837,6 +1837,10 @@ ele_parse! {
|
|||
@ {
|
||||
_name: (QN_NAME) => TplParamIdent,
|
||||
_eq: (QN_EQ?) => Option<StringLiteral>,
|
||||
_gt: (QN_GT?) => Option<NumLiteral>,
|
||||
_gte: (QN_GTE?) => Option<NumLiteral>,
|
||||
_lt: (QN_LT?) => Option<NumLiteral>,
|
||||
_lte: (QN_LTE?) => Option<NumLiteral>,
|
||||
_prefix: (QN_PREFIX?) => Option<StringLiteral>,
|
||||
_suffix: (QN_SUFFIX?) => Option<StringLiteral>,
|
||||
} => Nir::Todo,
|
||||
|
@ -1853,6 +1857,10 @@ ele_parse! {
|
|||
@ {
|
||||
_name: (QN_NAME) => TplParamIdent,
|
||||
_eq: (QN_EQ?) => Option<StringLiteral>,
|
||||
_gt: (QN_GT?) => Option<NumLiteral>,
|
||||
_gte: (QN_GTE?) => Option<NumLiteral>,
|
||||
_lt: (QN_LT?) => Option<NumLiteral>,
|
||||
_lte: (QN_LTE?) => Option<NumLiteral>,
|
||||
_prefix: (QN_PREFIX?) => Option<StringLiteral>,
|
||||
_suffix: (QN_SUFFIX?) => Option<StringLiteral>,
|
||||
} => Nir::Todo,
|
||||
|
|
|
@ -139,6 +139,8 @@ pub mod qname {
|
|||
QN_GENERATES: :L_GENERATES,
|
||||
QN_GENSYM: :L_GENSYM,
|
||||
QN_GENTLE_NO: :L_GENTLE_NO,
|
||||
QN_GT: :L_GT,
|
||||
QN_GTE: :L_GTE,
|
||||
QN_ID: :L_ID,
|
||||
QN_IDENTIFIER: :L_IDENTIFIER,
|
||||
QN_IF: :L_IF,
|
||||
|
@ -152,6 +154,8 @@ pub mod qname {
|
|||
QN_LABEL: :L_LABEL,
|
||||
QN_LOCAL: :L_LOCAL,
|
||||
QN_LOWER: :L_LOWER,
|
||||
QN_LT: :L_LT,
|
||||
QN_LTE: :L_LTE,
|
||||
QN_LV_IMPORT: L_LV:L_IMPORT,
|
||||
QN_LV_PACKAGE: L_LV:L_PACKAGE,
|
||||
QN_L_DEP: L_L:L_DEP,
|
||||
|
|
Loading…
Reference in New Issue