sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Radu Cotescu (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SLING-7688) [HTL] Add support for the in relational operator
Date Tue, 29 May 2018 13:14:00 GMT

     [ 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], both {{data-sly-list}} and {{data-sly-repeat}} should provide support for
iteration control.
{code:html}
<!--/* Iterate the collections starting from the element at index 5 (6th element), jumping
every 5 elements, until index 100 */-->
<ul data-sly-list="${collection @ begin = 5, step = 5, end = 100}">
    <li>${item}</li>
</ul>
<section data-sly-repeat="${collection @ begin = 5, step = 5, end = 100}">${item}</section>
{code}

[0] - https://github.com/Adobe-Marketing-Cloud/htl-spec/issues/55


> [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)

Mime
View raw message