[
https://issues.apache.org/jira/browse/SLING-7688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Radu Cotescu updated SLING-7688:
--------------------------------
Description:
According to [0], a new relational operator ({{in}}) has to be supported to
comply with version 1.4 of the specification.
{code:xml}
${'a' in 'abc'} <!--/* returns true */-->
${'ab' in 'abc'} <!--/* returns true */-->
${'bc' in 'abc'} <!--/* returns true */-->
${'abc' in 'abc'} <!--/* returns true */-->
${'d' in 'abc'} <!--/* returns false */-->
<!--/*
Assuming myArray would be in scope and would have the following content:
[100, 200, 300, 400, 500]
*/-->
${100 in myArray} <!--/* returns true */-->
${300 in myArray} <!--/* returns true */-->
${1 in myArray} <!--/* returns false */-->
<!--/*
Assuming the following use object (more details in the Use-API section)
provided by a `logic.js` file:
use(function () {
return {
a: true,
b: 'two',
c: 3
};
});
*/-->
<sly data-sly-use.logic="logic.js" />
${'a' in logic} <!--/* returns true */-->
${'b' in logic} <!--/* returns true */-->
${'c' in logic} <!--/* returns true */-->
${'two' in logic} <!--/* returns false */-->
{code}
[0] - [https://github.com/Adobe-Marketing-Cloud/htl-spec/issues/56]
was:
According to [0], a new relational operator ({{in}}) has to be supported to
comply with version 1.4 of the specification.
{code:xml}
${'a' in 'abc'} <!--/* returns true */-->
${'ab' in 'abc'} <!--/* returns true */-->
${'bc' in 'abc'} <!--/* returns true */-->
${'abc' in 'abc'} <!--/* returns true */-->
${'d' in 'abc'} <!--/* returns false */-->
<!--/*
Assuming myArray would be in scope and would have the following content:
[100, 200, 300, 400, 500]
*/-->
${100 in myArray} <!--/* returns true */-->
${300 in myArray} <!--/* returns true */-->
${1 in myArray} <!--/* returns false */-->
<!--/*
Assuming the following use object (more details in the Use-API section)
provided by a `logic.js` file:
use(function () {
return {
a: true,
b: 'two',
c: 3
};
});
*/-->
<sly data-sly-use.logic="logic.js" />
${'a' in logic} <!--/* returns true */-->
${'b' in logic} <!--/* returns true */-->
${'c' in logic} <!--/* returns true */-->
${'two' in logic} <!--/* returns false */-->
{code}
[0] - [https://github.com/Adobe-Marketing-Cloud/htl-spec/issues/56]
> [HTL] Add support for the in relational operator
> ------------------------------------------------
>
> Key: SLING-7688
> URL: https://issues.apache.org/jira/browse/SLING-7688
> Project: Sling
> Issue Type: Sub-task
> Components: Scripting
> Reporter: Radu Cotescu
> Assignee: Radu Cotescu
> Priority: Major
>
> According to [0], a new relational operator ({{in}}) has to be supported to
> comply with version 1.4 of the specification.
> {code:xml}
> ${'a' in 'abc'} <!--/* returns true */-->
> ${'ab' in 'abc'} <!--/* returns true */-->
> ${'bc' in 'abc'} <!--/* returns true */-->
> ${'abc' in 'abc'} <!--/* returns true */-->
> ${'d' in 'abc'} <!--/* returns false */-->
> <!--/*
> Assuming myArray would be in scope and would have the following content:
> [100, 200, 300, 400, 500]
> */-->
> ${100 in myArray} <!--/* returns true */-->
> ${300 in myArray} <!--/* returns true */-->
> ${1 in myArray} <!--/* returns false */-->
> <!--/*
> Assuming the following use object (more details in the Use-API section)
> provided by a `logic.js` file:
> use(function () {
> return {
> a: true,
> b: 'two',
> c: 3
> };
> });
> */-->
> <sly data-sly-use.logic="logic.js" />
> ${'a' in logic} <!--/* returns true */-->
> ${'b' in logic} <!--/* returns true */-->
> ${'c' in logic} <!--/* returns true */-->
> ${'two' in logic} <!--/* returns false */-->
> {code}
> [0] - [https://github.com/Adobe-Marketing-Cloud/htl-spec/issues/56]
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)