You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Chris Lewis (JIRA)" <de...@tapestry.apache.org> on 2008/01/14 16:37:35 UTC

[jira] Created: (TAPESTRY-2043) Loop component could provide a parameter for delimiting its body for each iteration

Loop component could provide a parameter for delimiting its body for each iteration
-----------------------------------------------------------------------------------

                 Key: TAPESTRY-2043
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2043
             Project: Tapestry
          Issue Type: Improvement
          Components: Core Components, tapestry-core
            Reporter: Chris Lewis
             Fix For: 5.0, 5.0.8


There are cases where one needs to output a list of data and delimit the items. In a simple situations, and in a world with perfect browsers, we could use CSS2 pseudo selectors to tack on trailng characters. In reality this is not an option, at least not now. Say a page has a list of strings like so:

{ "one", "two", "three" }

The desired output is:

one, two, three

Currently this is not possible using the loop component. There are at least 2 solutions that could be implemented, each of which was suggested on the mailing list. The first is to improve the 'language' used by T5 to support more tests:

<t:loop source="strings" value="var:string" index="var:index">
  <a href="#" t:type="pagelink" page="nada" context="var:string">${var:string}</a>
  <t:if test="var:index < strings.size()">,</t:if>
</t:loop>

I'm under the impression that the language will be improved to do such things, but in my opinion this delimiting function is a common enough need to recognized it by a parameter in the Loop component proper:

<t:loop source="strings" value="var:string" delimiter=", ">
  <a href="#" t:type="pagelink" page="nada" context="var:string">${var:string}</a>
</t:loop>

The logic would ensure that the output is only delimited and not create leading or trailing characters (if need they can be inserted outside of the component).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2043) Loop component could provide a parameter for delimiting its body for each iteration

Posted by "Chris Lewis (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2043?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12560855#action_12560855 ] 

Chris Lewis commented on TAPESTRY-2043:
---------------------------------------

Using that method a list would end up with a trailing comma, which would be wrong. As far as my thoughts on knowledge needed in a looping context, I've got nothing to add that I haven't said in the mailing list thread. I'd happily implement and extended loop, but extention isn't possible and I certainly don't want to reimplement all of the workings in the existing loop. The suggestion of compositing might be an option, but no matter how a look at it I can't see why the loop shouldn't naturally provide at least access to know this kind of information.

> Loop component could provide a parameter for delimiting its body for each iteration
> -----------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2043
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2043
>             Project: Tapestry
>          Issue Type: Improvement
>          Components: Core Components, tapestry-core
>    Affects Versions: 5.0, 5.0.8
>            Reporter: Chris Lewis
>
> There are cases where one needs to output a list of data and delimit the items. In a simple situations, and in a world with perfect browsers, we could use CSS2 pseudo selectors to tack on trailng characters. In reality this is not an option, at least not now. Say a page has a list of strings like so:
> { "one", "two", "three" }
> The desired output is:
> one, two, three
> Currently this is not possible using the loop component. There are at least 2 solutions that could be implemented, each of which was suggested on the mailing list. The first is to improve the 'language' used by T5 to support more tests:
> <t:loop source="strings" value="var:string" index="var:index">
>   <a href="#" t:type="pagelink" page="nada" context="var:string">${var:string}</a>
>   <t:if test="var:index < strings.size()">,</t:if>
> </t:loop>
> I'm under the impression that the language will be improved to do such things, but in my opinion this delimiting function is a common enough need to recognized it by a parameter in the Loop component proper:
> <t:loop source="strings" value="var:string" delimiter=", ">
>   <a href="#" t:type="pagelink" page="nada" context="var:string">${var:string}</a>
> </t:loop>
> The logic would ensure that the output is only delimited and not create leading or trailing characters (if need they can be inserted outside of the component).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2043) Loop component could provide a parameter for delimiting its body for each iteration

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2043?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12560837#action_12560837 ] 

Howard M. Lewis Ship commented on TAPESTRY-2043:
------------------------------------------------

Given the basic rule "zero false, anything else is true", you could accomplish this today as:

<t:loop source="strings" value="var:string" index="var:index">
  <t:if test="var:index ">,</t:if>
  <a href="#" t:type="pagelink" page="nada" context="var:string">${var:string}</a>
</t:loop>

This is a useful bit of functionality, but is it really universal and fundamental enough to be incorporated directly into the Loop component, or is it really something that should be encapsulated in your own DelimitedLoop component?



> Loop component could provide a parameter for delimiting its body for each iteration
> -----------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2043
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2043
>             Project: Tapestry
>          Issue Type: Improvement
>          Components: Core Components, tapestry-core
>    Affects Versions: 5.0, 5.0.8
>            Reporter: Chris Lewis
>
> There are cases where one needs to output a list of data and delimit the items. In a simple situations, and in a world with perfect browsers, we could use CSS2 pseudo selectors to tack on trailng characters. In reality this is not an option, at least not now. Say a page has a list of strings like so:
> { "one", "two", "three" }
> The desired output is:
> one, two, three
> Currently this is not possible using the loop component. There are at least 2 solutions that could be implemented, each of which was suggested on the mailing list. The first is to improve the 'language' used by T5 to support more tests:
> <t:loop source="strings" value="var:string" index="var:index">
>   <a href="#" t:type="pagelink" page="nada" context="var:string">${var:string}</a>
>   <t:if test="var:index < strings.size()">,</t:if>
> </t:loop>
> I'm under the impression that the language will be improved to do such things, but in my opinion this delimiting function is a common enough need to recognized it by a parameter in the Loop component proper:
> <t:loop source="strings" value="var:string" delimiter=", ">
>   <a href="#" t:type="pagelink" page="nada" context="var:string">${var:string}</a>
> </t:loop>
> The logic would ensure that the output is only delimited and not create leading or trailing characters (if need they can be inserted outside of the component).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Updated: (TAPESTRY-2043) Loop component could provide a parameter for delimiting its body for each iteration

Posted by "Chris Lewis (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2043?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chris Lewis updated TAPESTRY-2043:
----------------------------------

        Fix Version/s:     (was: 5.0)
                           (was: 5.0.8)
    Affects Version/s: 5.0.8
                       5.0

> Loop component could provide a parameter for delimiting its body for each iteration
> -----------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2043
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2043
>             Project: Tapestry
>          Issue Type: Improvement
>          Components: Core Components, tapestry-core
>    Affects Versions: 5.0, 5.0.8
>            Reporter: Chris Lewis
>
> There are cases where one needs to output a list of data and delimit the items. In a simple situations, and in a world with perfect browsers, we could use CSS2 pseudo selectors to tack on trailng characters. In reality this is not an option, at least not now. Say a page has a list of strings like so:
> { "one", "two", "three" }
> The desired output is:
> one, two, three
> Currently this is not possible using the loop component. There are at least 2 solutions that could be implemented, each of which was suggested on the mailing list. The first is to improve the 'language' used by T5 to support more tests:
> <t:loop source="strings" value="var:string" index="var:index">
>   <a href="#" t:type="pagelink" page="nada" context="var:string">${var:string}</a>
>   <t:if test="var:index < strings.size()">,</t:if>
> </t:loop>
> I'm under the impression that the language will be improved to do such things, but in my opinion this delimiting function is a common enough need to recognized it by a parameter in the Loop component proper:
> <t:loop source="strings" value="var:string" delimiter=", ">
>   <a href="#" t:type="pagelink" page="nada" context="var:string">${var:string}</a>
> </t:loop>
> The logic would ensure that the output is only delimited and not create leading or trailing characters (if need they can be inserted outside of the component).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2043) Loop component could provide a parameter for delimiting its body for each iteration

Posted by "Filip S. Adamsen (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2043?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562524#action_12562524 ] 

Filip S. Adamsen commented on TAPESTRY-2043:
--------------------------------------------

I don't see why you would end up with a trailing comma using that code. Are you sure you placed the <t:if test="var:index">, </t:if> bit BEFORE the content you wanted to delimit?

> Loop component could provide a parameter for delimiting its body for each iteration
> -----------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2043
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2043
>             Project: Tapestry
>          Issue Type: Improvement
>          Components: Core Components, tapestry-core
>    Affects Versions: 5.0, 5.0.8
>            Reporter: Chris Lewis
>
> There are cases where one needs to output a list of data and delimit the items. In a simple situations, and in a world with perfect browsers, we could use CSS2 pseudo selectors to tack on trailng characters. In reality this is not an option, at least not now. Say a page has a list of strings like so:
> { "one", "two", "three" }
> The desired output is:
> one, two, three
> Currently this is not possible using the loop component. There are at least 2 solutions that could be implemented, each of which was suggested on the mailing list. The first is to improve the 'language' used by T5 to support more tests:
> <t:loop source="strings" value="var:string" index="var:index">
>   <a href="#" t:type="pagelink" page="nada" context="var:string">${var:string}</a>
>   <t:if test="var:index < strings.size()">,</t:if>
> </t:loop>
> I'm under the impression that the language will be improved to do such things, but in my opinion this delimiting function is a common enough need to recognized it by a parameter in the Loop component proper:
> <t:loop source="strings" value="var:string" delimiter=", ">
>   <a href="#" t:type="pagelink" page="nada" context="var:string">${var:string}</a>
> </t:loop>
> The logic would ensure that the output is only delimited and not create leading or trailing characters (if need they can be inserted outside of the component).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Closed: (TAPESTRY-2043) Loop component could provide a parameter for delimiting its body for each iteration

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-2043?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship closed TAPESTRY-2043.
------------------------------------------

    Resolution: Won't Fix
      Assignee: Howard M. Lewis Ship

If you need this, write your own component. It way too specialized behavior for an off-the shelf component.

> Loop component could provide a parameter for delimiting its body for each iteration
> -----------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-2043
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2043
>             Project: Tapestry
>          Issue Type: Improvement
>          Components: Core Components, tapestry-core
>    Affects Versions: 5.0, 5.0.8
>            Reporter: Chris Lewis
>            Assignee: Howard M. Lewis Ship
>
> There are cases where one needs to output a list of data and delimit the items. In a simple situations, and in a world with perfect browsers, we could use CSS2 pseudo selectors to tack on trailng characters. In reality this is not an option, at least not now. Say a page has a list of strings like so:
> { "one", "two", "three" }
> The desired output is:
> one, two, three
> Currently this is not possible using the loop component. There are at least 2 solutions that could be implemented, each of which was suggested on the mailing list. The first is to improve the 'language' used by T5 to support more tests:
> <t:loop source="strings" value="var:string" index="var:index">
>   <a href="#" t:type="pagelink" page="nada" context="var:string">${var:string}</a>
>   <t:if test="var:index < strings.size()">,</t:if>
> </t:loop>
> I'm under the impression that the language will be improved to do such things, but in my opinion this delimiting function is a common enough need to recognized it by a parameter in the Loop component proper:
> <t:loop source="strings" value="var:string" delimiter=", ">
>   <a href="#" t:type="pagelink" page="nada" context="var:string">${var:string}</a>
> </t:loop>
> The logic would ensure that the output is only delimited and not create leading or trailing characters (if need they can be inserted outside of the component).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org