You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Lewis <ch...@bellsouth.net> on 2008/01/12 23:04:57 UTC

T5: 5.0.8 whitespace

So this ticket has been implemented in svn: 
https://issues.apache.org/jira/browse/TAPESTRY-2028

And now I need whitespace... so how can I get it back? Is there or isn't 
there a way to disable this? Im using loop to output links (pagelinks), 
and i have whitespace behind in the body so there is separation. 
Unfortunately, it's getting stripped. Is there a workaround?

On a related note, is there a way to know if im on the last iteration of 
the loop, so i could for example, follow all but the last with a ","? 
This may be outside the scope of loop as currently implemented, but i 
can see it being useful.

chris

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


Re: T5: 5.0.8 whitespace

Posted by Christian Edward Gruber <ch...@gmail.com>.
I think that isEven or isOdd probably has enough common usage to be  
worth exposing to child components too.

Christian.

On 14-Jan-08, at 13:10 , Robert Zeigler wrote:

> Insert css class attributes for first/last. :)
>
> Incidentally, regarding my earlier suggestion of making your own  
> component, you're absolutely right that loop would be difficult to  
> duplicate. But you don't need to duplicate it, per se. Just  
> composite it.  Make your own component with the same parameters as  
> loop, plus your "delimiter" parameter.  Then define a loop  
> component, and just use the "inherit" binding prefix for all of the  
> parameters.
> Then you can throw together a template with your loop, the if  
> component, the delimiter, and a <t:body/>, and you're set.  In fact,  
> I just did this... took less than ten minutes to do.  I suppose  
> since I already wrote it, I could package it up and throw it onto  
> tassel or something, if you want.
>
> Robert
>
> On Jan 14, 2008, at 1/1411:03 AM , Chris Lewis wrote:
>
>> Out of curiosity and within the scope of markup rendering in a  
>> looping context, what would one do with with isFirst/isLast  
>> knowledge, apart from using it to insert a delimiter?
>>
>> Josh Canfield wrote:
>>> Adding delimiter to the loop component sounds like a poor design  
>>> choice to me. It seems like the right thing to do would be to make  
>>> isFirst/isLast type attributes available from the loop.
>>>
>>>
>>>
>>> Sent from my iPhone
>>>
>>> On Jan 14, 2008, at 7:41 AM, Chris Lewis  
>>> <ch...@bellsouth.net> wrote:
>>>
>>>> Thanks for the reminder. As a note to others interested in this  
>>>> thread, I created a JIRA suggesting the addition of a delimiter  
>>>> parameter in the Loop.
>>>>
>>>> https://issues.apache.org/jira/browse/TAPESTRY-2043
>>>>
>>>> chris
>>>>
>>>> Howard Lewis Ship wrote:
>>>>> I have been keeping the nightly documentation up to date with  
>>>>> these changes.
>>>>>
>>>>> Please look at http://tapestry.formos.com/nightly/tapestry5 and  
>>>>> dig
>>>>> down from there.
>>>>>
>>>>> The main site will only be updated when a new release is  
>>>>> generated,
>>>>> the nightly is ... well, nightly.
>>>>>
>>>>> On Jan 12, 2008 2:04 PM, Chris Lewis <ch...@bellsouth.net>  
>>>>> wrote:
>>>>>
>>>>>> So this ticket has been implemented in svn:
>>>>>> https://issues.apache.org/jira/browse/TAPESTRY-2028
>>>>>>
>>>>>> And now I need whitespace... so how can I get it back? Is there  
>>>>>> or isn't
>>>>>> there a way to disable this? Im using loop to output links  
>>>>>> (pagelinks),
>>>>>> and i have whitespace behind in the body so there is separation.
>>>>>> Unfortunately, it's getting stripped. Is there a workaround?
>>>>>>
>>>>>> On a related note, is there a way to know if im on the last  
>>>>>> iteration of
>>>>>> the loop, so i could for example, follow all but the last with  
>>>>>> a ","?
>>>>>> This may be outside the scope of loop as currently implemented,  
>>>>>> but i
>>>>>> can see it being useful.
>>>>>>
>>>>>> chris
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


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


Re: T5: 5.0.8 whitespace

Posted by Robert Zeigler <ro...@scazdl.org>.
Insert css class attributes for first/last. :)

Incidentally, regarding my earlier suggestion of making your own  
component, you're absolutely right that loop would be difficult to  
duplicate. But you don't need to duplicate it, per se. Just composite  
it.  Make your own component with the same parameters as loop, plus  
your "delimiter" parameter.  Then define a loop component, and just  
use the "inherit" binding prefix for all of the parameters.
Then you can throw together a template with your loop, the if  
component, the delimiter, and a <t:body/>, and you're set.  In fact, I  
just did this... took less than ten minutes to do.  I suppose since I  
already wrote it, I could package it up and throw it onto tassel or  
something, if you want.

Robert

On Jan 14, 2008, at 1/1411:03 AM , Chris Lewis wrote:

> Out of curiosity and within the scope of markup rendering in a  
> looping context, what would one do with with isFirst/isLast  
> knowledge, apart from using it to insert a delimiter?
>
> Josh Canfield wrote:
>> Adding delimiter to the loop component sounds like a poor design  
>> choice to me. It seems like the right thing to do would be to make  
>> isFirst/isLast type attributes available from the loop.
>>
>>
>>
>> Sent from my iPhone
>>
>> On Jan 14, 2008, at 7:41 AM, Chris Lewis  
>> <ch...@bellsouth.net> wrote:
>>
>>> Thanks for the reminder. As a note to others interested in this  
>>> thread, I created a JIRA suggesting the addition of a delimiter  
>>> parameter in the Loop.
>>>
>>> https://issues.apache.org/jira/browse/TAPESTRY-2043
>>>
>>> chris
>>>
>>> Howard Lewis Ship wrote:
>>>> I have been keeping the nightly documentation up to date with  
>>>> these changes.
>>>>
>>>> Please look at http://tapestry.formos.com/nightly/tapestry5 and dig
>>>> down from there.
>>>>
>>>> The main site will only be updated when a new release is generated,
>>>> the nightly is ... well, nightly.
>>>>
>>>> On Jan 12, 2008 2:04 PM, Chris Lewis <ch...@bellsouth.net>  
>>>> wrote:
>>>>
>>>>> So this ticket has been implemented in svn:
>>>>> https://issues.apache.org/jira/browse/TAPESTRY-2028
>>>>>
>>>>> And now I need whitespace... so how can I get it back? Is there  
>>>>> or isn't
>>>>> there a way to disable this? Im using loop to output links  
>>>>> (pagelinks),
>>>>> and i have whitespace behind in the body so there is separation.
>>>>> Unfortunately, it's getting stripped. Is there a workaround?
>>>>>
>>>>> On a related note, is there a way to know if im on the last  
>>>>> iteration of
>>>>> the loop, so i could for example, follow all but the last with a  
>>>>> ","?
>>>>> This may be outside the scope of loop as currently implemented,  
>>>>> but i
>>>>> can see it being useful.
>>>>>
>>>>> chris
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


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


Re: T5: 5.0.8 whitespace

Posted by Howard Lewis Ship <hl...@gmail.com>.
<t:loop source="items" value="item" first="var:first">
  <t:unless test="var:first" xml:space="preserve">, </t:unless>
  ${item}
</t:loop>




On Jan 14, 2008 9:03 AM, Chris Lewis <ch...@bellsouth.net> wrote:
> Out of curiosity and within the scope of markup rendering in a looping
> context, what would one do with with isFirst/isLast knowledge, apart
> from using it to insert a delimiter?
>
>
> Josh Canfield wrote:
> > Adding delimiter to the loop component sounds like a poor design
> > choice to me. It seems like the right thing to do would be to make
> > isFirst/isLast type attributes available from the loop.
> >
> >
> >
> > Sent from my iPhone
> >
> > On Jan 14, 2008, at 7:41 AM, Chris Lewis <ch...@bellsouth.net>
> > wrote:
> >
> >> Thanks for the reminder. As a note to others interested in this
> >> thread, I created a JIRA suggesting the addition of a delimiter
> >> parameter in the Loop.
> >>
> >> https://issues.apache.org/jira/browse/TAPESTRY-2043
> >>
> >> chris
> >>
> >> Howard Lewis Ship wrote:
> >>> I have been keeping the nightly documentation up to date with these
> >>> changes.
> >>>
> >>> Please look at http://tapestry.formos.com/nightly/tapestry5 and dig
> >>> down from there.
> >>>
> >>> The main site will only be updated when a new release is generated,
> >>> the nightly is ... well, nightly.
> >>>
> >>> On Jan 12, 2008 2:04 PM, Chris Lewis <ch...@bellsouth.net> wrote:
> >>>
> >>>> So this ticket has been implemented in svn:
> >>>> https://issues.apache.org/jira/browse/TAPESTRY-2028
> >>>>
> >>>> And now I need whitespace... so how can I get it back? Is there or
> >>>> isn't
> >>>> there a way to disable this? Im using loop to output links
> >>>> (pagelinks),
> >>>> and i have whitespace behind in the body so there is separation.
> >>>> Unfortunately, it's getting stripped. Is there a workaround?
> >>>>
> >>>> On a related note, is there a way to know if im on the last
> >>>> iteration of
> >>>> the loop, so i could for example, follow all but the last with a ","?
> >>>> This may be outside the scope of loop as currently implemented, but i
> >>>> can see it being useful.
> >>>>
> >>>> chris
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
>
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: T5: 5.0.8 whitespace

Posted by Josh Canfield <jo...@thedailytube.com>.
Hmm... output optional content or an entirely different rendering for the
first object or last object? In my case (www.thedailytube.com) the first
object rendered is highlighted with a bigger image and more text of the
description displayed. In an email application your thread page you might
only want to show the full contents of the last entry and minimized entries
for the rest.

Currently I'm just testing _index == 0 from within my component, but it'd be
handy if I didn't have to define the _index and could just call
_loop.getIsFirst() when picking CSS, or <t:if test="loop.isFirst"> when
selecting the components to render.

I think that creating a simple delimited string is something that should be
easy to do, but I don't think it makes sense to tack it on to the loop
component. It'd be better to make it trivial to write your own component, or
use the features of the component to get that effect.

Josh

On Jan 14, 2008 9:03 AM, Chris Lewis <ch...@bellsouth.net> wrote:

> Out of curiosity and within the scope of markup rendering in a looping
> context, what would one do with with isFirst/isLast knowledge, apart
> from using it to insert a delimiter?
>
> Josh Canfield wrote:
> > Adding delimiter to the loop component sounds like a poor design
> > choice to me. It seems like the right thing to do would be to make
> > isFirst/isLast type attributes available from the loop.
> >
> >
> >
> > Sent from my iPhone
> >
> > On Jan 14, 2008, at 7:41 AM, Chris Lewis <ch...@bellsouth.net>
> > wrote:
> >
> >> Thanks for the reminder. As a note to others interested in this
> >> thread, I created a JIRA suggesting the addition of a delimiter
> >> parameter in the Loop.
> >>
> >> https://issues.apache.org/jira/browse/TAPESTRY-2043
> >>
> >> chris
> >>
> >> Howard Lewis Ship wrote:
> >>> I have been keeping the nightly documentation up to date with these
> >>> changes.
> >>>
> >>> Please look at http://tapestry.formos.com/nightly/tapestry5 and dig
> >>> down from there.
> >>>
> >>> The main site will only be updated when a new release is generated,
> >>> the nightly is ... well, nightly.
> >>>
> >>> On Jan 12, 2008 2:04 PM, Chris Lewis <ch...@bellsouth.net>
> wrote:
> >>>
> >>>> So this ticket has been implemented in svn:
> >>>> https://issues.apache.org/jira/browse/TAPESTRY-2028
> >>>>
> >>>> And now I need whitespace... so how can I get it back? Is there or
> >>>> isn't
> >>>> there a way to disable this? Im using loop to output links
> >>>> (pagelinks),
> >>>> and i have whitespace behind in the body so there is separation.
> >>>> Unfortunately, it's getting stripped. Is there a workaround?
> >>>>
> >>>> On a related note, is there a way to know if im on the last
> >>>> iteration of
> >>>> the loop, so i could for example, follow all but the last with a ","?
> >>>> This may be outside the scope of loop as currently implemented, but i
> >>>> can see it being useful.
> >>>>
> >>>> chris
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

Re: T5: 5.0.8 whitespace

Posted by Chris Lewis <ch...@bellsouth.net>.
Out of curiosity and within the scope of markup rendering in a looping 
context, what would one do with with isFirst/isLast knowledge, apart 
from using it to insert a delimiter?

Josh Canfield wrote:
> Adding delimiter to the loop component sounds like a poor design 
> choice to me. It seems like the right thing to do would be to make 
> isFirst/isLast type attributes available from the loop.
>
>
>
> Sent from my iPhone
>
> On Jan 14, 2008, at 7:41 AM, Chris Lewis <ch...@bellsouth.net> 
> wrote:
>
>> Thanks for the reminder. As a note to others interested in this 
>> thread, I created a JIRA suggesting the addition of a delimiter 
>> parameter in the Loop.
>>
>> https://issues.apache.org/jira/browse/TAPESTRY-2043
>>
>> chris
>>
>> Howard Lewis Ship wrote:
>>> I have been keeping the nightly documentation up to date with these 
>>> changes.
>>>
>>> Please look at http://tapestry.formos.com/nightly/tapestry5 and dig
>>> down from there.
>>>
>>> The main site will only be updated when a new release is generated,
>>> the nightly is ... well, nightly.
>>>
>>> On Jan 12, 2008 2:04 PM, Chris Lewis <ch...@bellsouth.net> wrote:
>>>
>>>> So this ticket has been implemented in svn:
>>>> https://issues.apache.org/jira/browse/TAPESTRY-2028
>>>>
>>>> And now I need whitespace... so how can I get it back? Is there or 
>>>> isn't
>>>> there a way to disable this? Im using loop to output links 
>>>> (pagelinks),
>>>> and i have whitespace behind in the body so there is separation.
>>>> Unfortunately, it's getting stripped. Is there a workaround?
>>>>
>>>> On a related note, is there a way to know if im on the last 
>>>> iteration of
>>>> the loop, so i could for example, follow all but the last with a ","?
>>>> This may be outside the scope of loop as currently implemented, but i
>>>> can see it being useful.
>>>>
>>>> chris
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


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


Re: T5: 5.0.8 whitespace

Posted by Josh Canfield <jo...@gmail.com>.
Adding delimiter to the loop component sounds like a poor design  
choice to me. It seems like the right thing to do would be to make  
isFirst/isLast type attributes available from the loop.



Sent from my iPhone

On Jan 14, 2008, at 7:41 AM, Chris Lewis <ch...@bellsouth.net>  
wrote:

> Thanks for the reminder. As a note to others interested in this  
> thread, I created a JIRA suggesting the addition of a delimiter  
> parameter in the Loop.
>
> https://issues.apache.org/jira/browse/TAPESTRY-2043
>
> chris
>
> Howard Lewis Ship wrote:
>> I have been keeping the nightly documentation up to date with these  
>> changes.
>>
>> Please look at http://tapestry.formos.com/nightly/tapestry5 and dig
>> down from there.
>>
>> The main site will only be updated when a new release is generated,
>> the nightly is ... well, nightly.
>>
>> On Jan 12, 2008 2:04 PM, Chris Lewis <ch...@bellsouth.net>  
>> wrote:
>>
>>> So this ticket has been implemented in svn:
>>> https://issues.apache.org/jira/browse/TAPESTRY-2028
>>>
>>> And now I need whitespace... so how can I get it back? Is there or  
>>> isn't
>>> there a way to disable this? Im using loop to output links  
>>> (pagelinks),
>>> and i have whitespace behind in the body so there is separation.
>>> Unfortunately, it's getting stripped. Is there a workaround?
>>>
>>> On a related note, is there a way to know if im on the last  
>>> iteration of
>>> the loop, so i could for example, follow all but the last with a  
>>> ","?
>>> This may be outside the scope of loop as currently implemented,  
>>> but i
>>> can see it being useful.
>>>
>>> chris
>>>
>>> --- 
>>> ------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>
>>
>>
>>
>

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


Re: T5: 5.0.8 whitespace

Posted by Chris Lewis <ch...@bellsouth.net>.
Thanks for the reminder. As a note to others interested in this thread, 
I created a JIRA suggesting the addition of a delimiter parameter in the 
Loop.

https://issues.apache.org/jira/browse/TAPESTRY-2043

chris

Howard Lewis Ship wrote:
> I have been keeping the nightly documentation up to date with these changes.
>
> Please look at http://tapestry.formos.com/nightly/tapestry5 and dig
> down from there.
>
> The main site will only be updated when a new release is generated,
> the nightly is ... well, nightly.
>
> On Jan 12, 2008 2:04 PM, Chris Lewis <ch...@bellsouth.net> wrote:
>   
>> So this ticket has been implemented in svn:
>> https://issues.apache.org/jira/browse/TAPESTRY-2028
>>
>> And now I need whitespace... so how can I get it back? Is there or isn't
>> there a way to disable this? Im using loop to output links (pagelinks),
>> and i have whitespace behind in the body so there is separation.
>> Unfortunately, it's getting stripped. Is there a workaround?
>>
>> On a related note, is there a way to know if im on the last iteration of
>> the loop, so i could for example, follow all but the last with a ","?
>> This may be outside the scope of loop as currently implemented, but i
>> can see it being useful.
>>
>> chris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>     
>
>
>
>   


Re: T5: 5.0.8 whitespace

Posted by Howard Lewis Ship <hl...@gmail.com>.
I have been keeping the nightly documentation up to date with these changes.

Please look at http://tapestry.formos.com/nightly/tapestry5 and dig
down from there.

The main site will only be updated when a new release is generated,
the nightly is ... well, nightly.

On Jan 12, 2008 2:04 PM, Chris Lewis <ch...@bellsouth.net> wrote:
> So this ticket has been implemented in svn:
> https://issues.apache.org/jira/browse/TAPESTRY-2028
>
> And now I need whitespace... so how can I get it back? Is there or isn't
> there a way to disable this? Im using loop to output links (pagelinks),
> and i have whitespace behind in the body so there is separation.
> Unfortunately, it's getting stripped. Is there a workaround?
>
> On a related note, is there a way to know if im on the last iteration of
> the loop, so i could for example, follow all but the last with a ","?
> This may be outside the scope of loop as currently implemented, but i
> can see it being useful.
>
> chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: T5: 5.0.8 whitespace

Posted by Chris Lewis <ch...@bellsouth.net>.
Perhaps idealistic CSS, but not realistic - at least for my browser 
support matrix. If I'm not mistaken not even IE 6 supports these pseudo 
selectors, and I can't see how one can hope to fare well without 
supporting it. Of course I see this as annoying and unfortunate, as I 
agree with you in theory.

chris

Jonathan Barker wrote:
> Chris,
>
> This is a job for CSS.
>
> You are creating a list, so render your links in an unordered list, and set
> the class attribute for the last item to "last" and then use a CSS recipe
> for creating inline lists:
>
> ul,li {
>    display:inline;
>    margin: 0;
>    padding 0;
> }
>    li:after {
>    content: ", ";
> }
> li.last:after {
>    content: ".";
> }
>
> You may need to set any surrounding paragraphs to display inline as well if
> you want the list included in the text flow.
>
> Jonathan
>
>
>   
>> -----Original Message-----
>> From: Chris Lewis [mailto:chris_lewis@bellsouth.net]
>> Sent: Saturday, January 12, 2008 5:05 PM
>> To: users@tapestry.apache.org
>> Subject: T5: 5.0.8 whitespace
>>
>> So this ticket has been implemented in svn:
>> https://issues.apache.org/jira/browse/TAPESTRY-2028
>>
>> And now I need whitespace... so how can I get it back? Is there or isn't
>> there a way to disable this? Im using loop to output links (pagelinks),
>> and i have whitespace behind in the body so there is separation.
>> Unfortunately, it's getting stripped. Is there a workaround?
>>
>> On a related note, is there a way to know if im on the last iteration of
>> the loop, so i could for example, follow all but the last with a ","?
>> This may be outside the scope of loop as currently implemented, but i
>> can see it being useful.
>>
>> chris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>   


Re: T5: 5.0.8 whitespace

Posted by Kevin Menard <km...@servprise.com>.
I'm not sure this would gain him much.  He'd still need to know how to
figure out if the list item is the last one in the iteration.  Of course, it
would address his whitespace problem.

I think what Chris wants is something that I've been advocating for for a
little while now.  That's something quite similar to the for "component" of
Django:

http://www.djangoproject.com/documentation/templates/#for

With the introduction of the "var" prefix, the above could be approximated
by the addition of two new component parameters: {first, last}.  Each could
be bound to a boolean and with the "var" prefix that could be accomplished
without any additional Java code.  The value could then be used in an If
component in order to perform the proper rendering.

-- 
Kevin


On 1/13/08 8:47 PM, in article 002601c8564f$69a3d990$6502a8c0@DrJLaptop,
"Jonathan Barker" <jo...@gmail.com> wrote:

> Chris,
> 
> This is a job for CSS.
> 
> You are creating a list, so render your links in an unordered list, and set
> the class attribute for the last item to "last" and then use a CSS recipe
> for creating inline lists:
> 
> ul,li {
>    display:inline;
>    margin: 0;
>    padding 0;
> }
>    li:after {
>    content: ", ";
> }
> li.last:after {
>    content: ".";
> }
> 
> You may need to set any surrounding paragraphs to display inline as well if
> you want the list included in the text flow.
> 
> Jonathan
> 
> 
>> -----Original Message-----
>> From: Chris Lewis [mailto:chris_lewis@bellsouth.net]
>> Sent: Saturday, January 12, 2008 5:05 PM
>> To: users@tapestry.apache.org
>> Subject: T5: 5.0.8 whitespace
>> 
>> So this ticket has been implemented in svn:
>> https://issues.apache.org/jira/browse/TAPESTRY-2028
>> 
>> And now I need whitespace... so how can I get it back? Is there or isn't
>> there a way to disable this? Im using loop to output links (pagelinks),
>> and i have whitespace behind in the body so there is separation.
>> Unfortunately, it's getting stripped. Is there a workaround?
>> 
>> On a related note, is there a way to know if im on the last iteration of
>> the loop, so i could for example, follow all but the last with a ","?
>> This may be outside the scope of loop as currently implemented, but i
>> can see it being useful.
>> 
>> chris
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 



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


RE: T5: 5.0.8 whitespace

Posted by Jonathan Barker <jo...@gmail.com>.
Chris,

This is a job for CSS.

You are creating a list, so render your links in an unordered list, and set
the class attribute for the last item to "last" and then use a CSS recipe
for creating inline lists:

ul,li {
   display:inline;
   margin: 0;
   padding 0;
}
   li:after {
   content: ", ";
}
li.last:after {
   content: ".";
}

You may need to set any surrounding paragraphs to display inline as well if
you want the list included in the text flow.

Jonathan


> -----Original Message-----
> From: Chris Lewis [mailto:chris_lewis@bellsouth.net]
> Sent: Saturday, January 12, 2008 5:05 PM
> To: users@tapestry.apache.org
> Subject: T5: 5.0.8 whitespace
> 
> So this ticket has been implemented in svn:
> https://issues.apache.org/jira/browse/TAPESTRY-2028
> 
> And now I need whitespace... so how can I get it back? Is there or isn't
> there a way to disable this? Im using loop to output links (pagelinks),
> and i have whitespace behind in the body so there is separation.
> Unfortunately, it's getting stripped. Is there a workaround?
> 
> On a related note, is there a way to know if im on the last iteration of
> the loop, so i could for example, follow all but the last with a ","?
> This may be outside the scope of loop as currently implemented, but i
> can see it being useful.
> 
> chris
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


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


Re: T5: 5.0.8 whitespace

Posted by Howard Lewis Ship <hl...@gmail.com>.
The var: binding prefix is much more limited than prop:, and prop: is
more limited than T4's use of OGNL.  But it's all part of the grand
plan :-)

Building a more complex expression language is something that will
wait for a later release, as you can write code in your component to
perform these types of operations (and still get instant reloading).

On Jan 13, 2008 1:33 PM, Chris Lewis <ch...@bellsouth.net> wrote:
> This almost works. Using the way you suggested as is oddly emits a comma
> only after the last element. Unfortunately I can't, at least not that I
> know of, express a "less than" clause like so:
>
> <t:if test="var:index < ${post.tags.size()}">,</t:if>
>
> T5 doesnt allow '<' here. As far as creating my own goes, I'm wondering
> if you've looked at the source of the core Loop component. If not, take
> my word for it, it's scary. If I could just subclass it and override a
> render method to honor a new parameter, it would probably be easy. Alas
> the T5 black magic prohibits this. At this point I see 2 options:
>
> 1) Do as you suggested and create my own loop, which will take a good
> bit of focused time to first understand why the internal loop does
> things the way it does.
> 2) Create a component that loops through a list and outputs a delimited
> list of pagelinks. The nasty part of this is that's its done in rigid
> java code - but it works.
>
> Has no one else done this yet?
>
>
> Robert Zeigler wrote:
> > What you /might/ be able to do (to avoid the java code), is to use var
> > here... I haven't played with the var prefix yet, so this is a "try
> > and see" idea. :) But. Something like:
> > <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>
> >
> > If that works, you could even write your own DelimittedLoop component
> > and not have to duplicate the logic elsewhere.
> >
> > Robert
> >
> > On Jan 12, 2008, at 1/125:06 PM , Chris Lewis wrote:
> >
> >> That would work of course, but I'd like to do something like this:
> >>
> >> <t:loop source="strings" value="var:string" index="prop:index"
> >> delimit=", ">
> >> <a href="#" t:type="pagelink" page="nada"
> >> context="var:string">${var:string}</a>
> >> </t:loop>
> >>
> >> And then each element would be separated by my delimiter without any
> >> extra java code.
> >>
> >> Robert Zeigler wrote:
> >>> How about testing the value of index?
> >>> Something like:
> >>>
> >>> .java:
> >>>
> >>> private int index;
> >>> public int getIndex() { return index; }
> >>> public void setIndex(int i) index = i; }
> >>> public boolean isFirst() { return index==0; }
> >>>
> >>> .tml:
> >>>
> >>> <t:loop source="strings" value="var:string" index="prop:index">
> >>>  <t:if test="prop:first" negate="true">
> >>>    ,
> >>>  </t:if>
> >>>  <a href="#" t:type="pagelink" page="nada"
> >>> context="var:string">${var:string}</a>
> >>> </t:loop>
> >>>
> >>> Robert
> >>>
> >>> On Jan 12, 2008, at 1/124:41 PM , Chris Lewis wrote:
> >>>
> >>>> Sorry, I missed the "check if first" part. How can you do such a
> >>>> check in Loop? The "If" can test, but what can you test in a Loop?
> >>>> nothing that I know of will tell you where in the iteration you are.
> >>>>
> >>>> chris
> >>>>
> >>>> Davor Hrg wrote:
> >>>>> just reverse where you write the ","
> >>>>> instead of checking if last and putting comma behind
> >>>>>
> >>>>> check if first and put comma in front
> >>>>>
> >>>>> Davor Hrg
> >>>>>
> >>>>> On Jan 12, 2008 11:04 PM, Chris Lewis <ch...@bellsouth.net>
> >>>>> wrote:
> >>>>>
> >>>>>> So this ticket has been implemented in svn:
> >>>>>> https://issues.apache.org/jira/browse/TAPESTRY-2028
> >>>>>>
> >>>>>> And now I need whitespace... so how can I get it back? Is there
> >>>>>> or isn't
> >>>>>> there a way to disable this? Im using loop to output links
> >>>>>> (pagelinks),
> >>>>>> and i have whitespace behind in the body so there is separation.
> >>>>>> Unfortunately, it's getting stripped. Is there a workaround?
> >>>>>>
> >>>>>> On a related note, is there a way to know if im on the last
> >>>>>> iteration of
> >>>>>> the loop, so i could for example, follow all but the last with a
> >>>>>> ","?
> >>>>>> This may be outside the scope of loop as currently implemented,
> >>>>>> but i
> >>>>>> can see it being useful.
> >>>>>>
> >>>>>> chris
> >>>>>>
> >>>>>> ---------------------------------------------------------------------
> >>>>>>
> >>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>
> >>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: T5: 5.0.8 whitespace

Posted by Chris Lewis <ch...@bellsouth.net>.
This almost works. Using the way you suggested as is oddly emits a comma 
only after the last element. Unfortunately I can't, at least not that I 
know of, express a "less than" clause like so:

<t:if test="var:index < ${post.tags.size()}">,</t:if>

T5 doesnt allow '<' here. As far as creating my own goes, I'm wondering 
if you've looked at the source of the core Loop component. If not, take 
my word for it, it's scary. If I could just subclass it and override a 
render method to honor a new parameter, it would probably be easy. Alas 
the T5 black magic prohibits this. At this point I see 2 options:

1) Do as you suggested and create my own loop, which will take a good 
bit of focused time to first understand why the internal loop does 
things the way it does.
2) Create a component that loops through a list and outputs a delimited 
list of pagelinks. The nasty part of this is that's its done in rigid 
java code - but it works.

Has no one else done this yet?

Robert Zeigler wrote:
> What you /might/ be able to do (to avoid the java code), is to use var 
> here... I haven't played with the var prefix yet, so this is a "try 
> and see" idea. :) But. Something like:
> <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>
>
> If that works, you could even write your own DelimittedLoop component 
> and not have to duplicate the logic elsewhere.
>
> Robert
>
> On Jan 12, 2008, at 1/125:06 PM , Chris Lewis wrote:
>
>> That would work of course, but I'd like to do something like this:
>>
>> <t:loop source="strings" value="var:string" index="prop:index" 
>> delimit=", ">
>> <a href="#" t:type="pagelink" page="nada" 
>> context="var:string">${var:string}</a>
>> </t:loop>
>>
>> And then each element would be separated by my delimiter without any 
>> extra java code.
>>
>> Robert Zeigler wrote:
>>> How about testing the value of index?
>>> Something like:
>>>
>>> .java:
>>>
>>> private int index;
>>> public int getIndex() { return index; }
>>> public void setIndex(int i) index = i; }
>>> public boolean isFirst() { return index==0; }
>>>
>>> .tml:
>>>
>>> <t:loop source="strings" value="var:string" index="prop:index">
>>>  <t:if test="prop:first" negate="true">
>>>    ,
>>>  </t:if>
>>>  <a href="#" t:type="pagelink" page="nada" 
>>> context="var:string">${var:string}</a>
>>> </t:loop>
>>>
>>> Robert
>>>
>>> On Jan 12, 2008, at 1/124:41 PM , Chris Lewis wrote:
>>>
>>>> Sorry, I missed the "check if first" part. How can you do such a 
>>>> check in Loop? The "If" can test, but what can you test in a Loop? 
>>>> nothing that I know of will tell you where in the iteration you are.
>>>>
>>>> chris
>>>>
>>>> Davor Hrg wrote:
>>>>> just reverse where you write the ","
>>>>> instead of checking if last and putting comma behind
>>>>>
>>>>> check if first and put comma in front
>>>>>
>>>>> Davor Hrg
>>>>>
>>>>> On Jan 12, 2008 11:04 PM, Chris Lewis <ch...@bellsouth.net> 
>>>>> wrote:
>>>>>
>>>>>> So this ticket has been implemented in svn:
>>>>>> https://issues.apache.org/jira/browse/TAPESTRY-2028
>>>>>>
>>>>>> And now I need whitespace... so how can I get it back? Is there 
>>>>>> or isn't
>>>>>> there a way to disable this? Im using loop to output links 
>>>>>> (pagelinks),
>>>>>> and i have whitespace behind in the body so there is separation.
>>>>>> Unfortunately, it's getting stripped. Is there a workaround?
>>>>>>
>>>>>> On a related note, is there a way to know if im on the last 
>>>>>> iteration of
>>>>>> the loop, so i could for example, follow all but the last with a 
>>>>>> ","?
>>>>>> This may be outside the scope of loop as currently implemented, 
>>>>>> but i
>>>>>> can see it being useful.
>>>>>>
>>>>>> chris
>>>>>>
>>>>>> --------------------------------------------------------------------- 
>>>>>>
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


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


Re: T5: 5.0.8 whitespace

Posted by Robert Zeigler <ro...@scazdl.org>.
What you /might/ be able to do (to avoid the java code), is to use var  
here... I haven't played with the var prefix yet, so this is a "try  
and see" idea. :) But. Something like:
<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>

If that works, you could even write your own DelimittedLoop component  
and not have to duplicate the logic elsewhere.

Robert

On Jan 12, 2008, at 1/125:06 PM , Chris Lewis wrote:

> That would work of course, but I'd like to do something like this:
>
> <t:loop source="strings" value="var:string" index="prop:index"  
> delimit=", ">
> <a href="#" t:type="pagelink" page="nada" context="var:string">$ 
> {var:string}</a>
> </t:loop>
>
> And then each element would be separated by my delimiter without any  
> extra java code.
>
> Robert Zeigler wrote:
>> How about testing the value of index?
>> Something like:
>>
>> .java:
>>
>> private int index;
>> public int getIndex() { return index; }
>> public void setIndex(int i) index = i; }
>> public boolean isFirst() { return index==0; }
>>
>> .tml:
>>
>> <t:loop source="strings" value="var:string" index="prop:index">
>>  <t:if test="prop:first" negate="true">
>>    ,
>>  </t:if>
>>  <a href="#" t:type="pagelink" page="nada" context="var:string">$ 
>> {var:string}</a>
>> </t:loop>
>>
>> Robert
>>
>> On Jan 12, 2008, at 1/124:41 PM , Chris Lewis wrote:
>>
>>> Sorry, I missed the "check if first" part. How can you do such a  
>>> check in Loop? The "If" can test, but what can you test in a Loop?  
>>> nothing that I know of will tell you where in the iteration you are.
>>>
>>> chris
>>>
>>> Davor Hrg wrote:
>>>> just reverse where you write the ","
>>>> instead of checking if last and putting comma behind
>>>>
>>>> check if first and put comma in front
>>>>
>>>> Davor Hrg
>>>>
>>>> On Jan 12, 2008 11:04 PM, Chris Lewis <ch...@bellsouth.net>  
>>>> wrote:
>>>>
>>>>> So this ticket has been implemented in svn:
>>>>> https://issues.apache.org/jira/browse/TAPESTRY-2028
>>>>>
>>>>> And now I need whitespace... so how can I get it back? Is there  
>>>>> or isn't
>>>>> there a way to disable this? Im using loop to output links  
>>>>> (pagelinks),
>>>>> and i have whitespace behind in the body so there is separation.
>>>>> Unfortunately, it's getting stripped. Is there a workaround?
>>>>>
>>>>> On a related note, is there a way to know if im on the last  
>>>>> iteration of
>>>>> the loop, so i could for example, follow all but the last with a  
>>>>> ","?
>>>>> This may be outside the scope of loop as currently implemented,  
>>>>> but i
>>>>> can see it being useful.
>>>>>
>>>>> chris
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


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


Re: T5: 5.0.8 whitespace

Posted by Chris Lewis <ch...@bellsouth.net>.
Sure, but I don't think it addresses my problem. My problem isn't 
creating a list, my problem is delimiting values on each iteration of 
Loop, without having a trailing or leading delimiter.

Sven Homburg wrote:
> Hi Chris,
>
> may i advise you the listbinding from t5components ?
>
> <ul>
>     <li t:type="Loop" source="list:\"value 1\", \"value 2\", \"value
> 3\"" value="element">
>         ${element}
>     </li>
> </ul>
>
>
>
> 2008/1/13, Chris Lewis <ch...@bellsouth.net>:
>   
>> That would work of course, but I'd like to do something like this:
>>
>> <t:loop source="strings" value="var:string" index="prop:index"
>> delimit=", ">
>>   <a href="#" t:type="pagelink" page="nada"
>> context="var:string">${var:string}</a>
>> </t:loop>
>>
>> And then each element would be separated by my delimiter without any
>> extra java code.
>>
>> Robert Zeigler wrote:
>>     
>>> How about testing the value of index?
>>> Something like:
>>>
>>> .java:
>>>
>>> private int index;
>>> public int getIndex() { return index; }
>>> public void setIndex(int i) index = i; }
>>> public boolean isFirst() { return index==0; }
>>>
>>> .tml:
>>>
>>> <t:loop source="strings" value="var:string" index="prop:index">
>>>   <t:if test="prop:first" negate="true">
>>>     ,
>>>   </t:if>
>>>   <a href="#" t:type="pagelink" page="nada"
>>> context="var:string">${var:string}</a>
>>> </t:loop>
>>>
>>> Robert
>>>
>>> On Jan 12, 2008, at 1/124:41 PM , Chris Lewis wrote:
>>>
>>>       
>>>> Sorry, I missed the "check if first" part. How can you do such a
>>>> check in Loop? The "If" can test, but what can you test in a Loop?
>>>> nothing that I know of will tell you where in the iteration you are.
>>>>
>>>> chris
>>>>
>>>> Davor Hrg wrote:
>>>>         
>>>>> just reverse where you write the ","
>>>>> instead of checking if last and putting comma behind
>>>>>
>>>>> check if first and put comma in front
>>>>>
>>>>> Davor Hrg
>>>>>
>>>>> On Jan 12, 2008 11:04 PM, Chris Lewis <ch...@bellsouth.net>
>>>>> wrote:
>>>>>
>>>>>           
>>>>>> So this ticket has been implemented in svn:
>>>>>> https://issues.apache.org/jira/browse/TAPESTRY-2028
>>>>>>
>>>>>> And now I need whitespace... so how can I get it back? Is there or
>>>>>> isn't
>>>>>> there a way to disable this? Im using loop to output links
>>>>>> (pagelinks),
>>>>>> and i have whitespace behind in the body so there is separation.
>>>>>> Unfortunately, it's getting stripped. Is there a workaround?
>>>>>>
>>>>>> On a related note, is there a way to know if im on the last
>>>>>> iteration of
>>>>>> the loop, so i could for example, follow all but the last with a ","?
>>>>>> This may be outside the scope of loop as currently implemented, but i
>>>>>> can see it being useful.
>>>>>>
>>>>>> chris
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>>
>>>>>
>>>>>           
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>     
>
>
>   


Re: T5: 5.0.8 whitespace

Posted by Sven Homburg <ho...@googlemail.com>.
Hi Chris,

may i advise you the listbinding from t5components ?

<ul>
    <li t:type="Loop" source="list:\"value 1\", \"value 2\", \"value
3\"" value="element">
        ${element}
    </li>
</ul>



2008/1/13, Chris Lewis <ch...@bellsouth.net>:
>
> That would work of course, but I'd like to do something like this:
>
> <t:loop source="strings" value="var:string" index="prop:index"
> delimit=", ">
>   <a href="#" t:type="pagelink" page="nada"
> context="var:string">${var:string}</a>
> </t:loop>
>
> And then each element would be separated by my delimiter without any
> extra java code.
>
> Robert Zeigler wrote:
> > How about testing the value of index?
> > Something like:
> >
> > .java:
> >
> > private int index;
> > public int getIndex() { return index; }
> > public void setIndex(int i) index = i; }
> > public boolean isFirst() { return index==0; }
> >
> > .tml:
> >
> > <t:loop source="strings" value="var:string" index="prop:index">
> >   <t:if test="prop:first" negate="true">
> >     ,
> >   </t:if>
> >   <a href="#" t:type="pagelink" page="nada"
> > context="var:string">${var:string}</a>
> > </t:loop>
> >
> > Robert
> >
> > On Jan 12, 2008, at 1/124:41 PM , Chris Lewis wrote:
> >
> >> Sorry, I missed the "check if first" part. How can you do such a
> >> check in Loop? The "If" can test, but what can you test in a Loop?
> >> nothing that I know of will tell you where in the iteration you are.
> >>
> >> chris
> >>
> >> Davor Hrg wrote:
> >>> just reverse where you write the ","
> >>> instead of checking if last and putting comma behind
> >>>
> >>> check if first and put comma in front
> >>>
> >>> Davor Hrg
> >>>
> >>> On Jan 12, 2008 11:04 PM, Chris Lewis <ch...@bellsouth.net>
> >>> wrote:
> >>>
> >>>> So this ticket has been implemented in svn:
> >>>> https://issues.apache.org/jira/browse/TAPESTRY-2028
> >>>>
> >>>> And now I need whitespace... so how can I get it back? Is there or
> >>>> isn't
> >>>> there a way to disable this? Im using loop to output links
> >>>> (pagelinks),
> >>>> and i have whitespace behind in the body so there is separation.
> >>>> Unfortunately, it's getting stripped. Is there a workaround?
> >>>>
> >>>> On a related note, is there a way to know if im on the last
> >>>> iteration of
> >>>> the loop, so i could for example, follow all but the last with a ","?
> >>>> This may be outside the scope of loop as currently implemented, but i
> >>>> can see it being useful.
> >>>>
> >>>> chris
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>>
> >>>>
> >>>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>
> >>>
> >>>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
with regards
Sven Homburg

Re: T5: 5.0.8 whitespace

Posted by Chris Lewis <ch...@bellsouth.net>.
That would work of course, but I'd like to do something like this:

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

And then each element would be separated by my delimiter without any 
extra java code.

Robert Zeigler wrote:
> How about testing the value of index?
> Something like:
>
> .java:
>
> private int index;
> public int getIndex() { return index; }
> public void setIndex(int i) index = i; }
> public boolean isFirst() { return index==0; }
>
> .tml:
>
> <t:loop source="strings" value="var:string" index="prop:index">
>   <t:if test="prop:first" negate="true">
>     ,
>   </t:if>
>   <a href="#" t:type="pagelink" page="nada" 
> context="var:string">${var:string}</a>
> </t:loop>
>
> Robert
>
> On Jan 12, 2008, at 1/124:41 PM , Chris Lewis wrote:
>
>> Sorry, I missed the "check if first" part. How can you do such a 
>> check in Loop? The "If" can test, but what can you test in a Loop? 
>> nothing that I know of will tell you where in the iteration you are.
>>
>> chris
>>
>> Davor Hrg wrote:
>>> just reverse where you write the ","
>>> instead of checking if last and putting comma behind
>>>
>>> check if first and put comma in front
>>>
>>> Davor Hrg
>>>
>>> On Jan 12, 2008 11:04 PM, Chris Lewis <ch...@bellsouth.net> 
>>> wrote:
>>>
>>>> So this ticket has been implemented in svn:
>>>> https://issues.apache.org/jira/browse/TAPESTRY-2028
>>>>
>>>> And now I need whitespace... so how can I get it back? Is there or 
>>>> isn't
>>>> there a way to disable this? Im using loop to output links 
>>>> (pagelinks),
>>>> and i have whitespace behind in the body so there is separation.
>>>> Unfortunately, it's getting stripped. Is there a workaround?
>>>>
>>>> On a related note, is there a way to know if im on the last 
>>>> iteration of
>>>> the loop, so i could for example, follow all but the last with a ","?
>>>> This may be outside the scope of loop as currently implemented, but i
>>>> can see it being useful.
>>>>
>>>> chris
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


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


Re: T5: 5.0.8 whitespace

Posted by Robert Zeigler <ro...@scazdl.org>.
How about testing the value of index?
Something like:

.java:

private int index;
public int getIndex() { return index; }
public void setIndex(int i) index = i; }
public boolean isFirst() { return index==0; }

.tml:

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

Robert

On Jan 12, 2008, at 1/124:41 PM , Chris Lewis wrote:

> Sorry, I missed the "check if first" part. How can you do such a  
> check in Loop? The "If" can test, but what can you test in a Loop?  
> nothing that I know of will tell you where in the iteration you are.
>
> chris
>
> Davor Hrg wrote:
>> just reverse where you write the ","
>> instead of checking if last and putting comma behind
>>
>> check if first and put comma in front
>>
>> Davor Hrg
>>
>> On Jan 12, 2008 11:04 PM, Chris Lewis <ch...@bellsouth.net>  
>> wrote:
>>
>>> So this ticket has been implemented in svn:
>>> https://issues.apache.org/jira/browse/TAPESTRY-2028
>>>
>>> And now I need whitespace... so how can I get it back? Is there or  
>>> isn't
>>> there a way to disable this? Im using loop to output links  
>>> (pagelinks),
>>> and i have whitespace behind in the body so there is separation.
>>> Unfortunately, it's getting stripped. Is there a workaround?
>>>
>>> On a related note, is there a way to know if im on the last  
>>> iteration of
>>> the loop, so i could for example, follow all but the last with a  
>>> ","?
>>> This may be outside the scope of loop as currently implemented,  
>>> but i
>>> can see it being useful.
>>>
>>> chris
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>


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


Re: T5: 5.0.8 whitespace

Posted by Chris Lewis <ch...@bellsouth.net>.
Sorry, I missed the "check if first" part. How can you do such a check 
in Loop? The "If" can test, but what can you test in a Loop? nothing 
that I know of will tell you where in the iteration you are.

chris

Davor Hrg wrote:
> just reverse where you write the ","
> instead of checking if last and putting comma behind
>
> check if first and put comma in front
>
> Davor Hrg
>
> On Jan 12, 2008 11:04 PM, Chris Lewis <ch...@bellsouth.net> wrote:
>   
>> So this ticket has been implemented in svn:
>> https://issues.apache.org/jira/browse/TAPESTRY-2028
>>
>> And now I need whitespace... so how can I get it back? Is there or isn't
>> there a way to disable this? Im using loop to output links (pagelinks),
>> and i have whitespace behind in the body so there is separation.
>> Unfortunately, it's getting stripped. Is there a workaround?
>>
>> On a related note, is there a way to know if im on the last iteration of
>> the loop, so i could for example, follow all but the last with a ","?
>> This may be outside the scope of loop as currently implemented, but i
>> can see it being useful.
>>
>> chris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>   


Re: T5: 5.0.8 whitespace

Posted by Chris Lewis <ch...@bellsouth.net>.
That will just 'reverse' the problem (a leading comma instead of a 
trailing one). Suppose I have a list of strings like:

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

And a Loop to display:

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

This renders: one,two,three

If do as you suggest:

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

This would render: ,one,two,three

Davor Hrg wrote:
> just reverse where you write the ","
> instead of checking if last and putting comma behind
>
> check if first and put comma in front
>
> Davor Hrg
>
> On Jan 12, 2008 11:04 PM, Chris Lewis <ch...@bellsouth.net> wrote:
>   
>> So this ticket has been implemented in svn:
>> https://issues.apache.org/jira/browse/TAPESTRY-2028
>>
>> And now I need whitespace... so how can I get it back? Is there or isn't
>> there a way to disable this? Im using loop to output links (pagelinks),
>> and i have whitespace behind in the body so there is separation.
>> Unfortunately, it's getting stripped. Is there a workaround?
>>
>> On a related note, is there a way to know if im on the last iteration of
>> the loop, so i could for example, follow all but the last with a ","?
>> This may be outside the scope of loop as currently implemented, but i
>> can see it being useful.
>>
>> chris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>   


Re: T5: 5.0.8 whitespace

Posted by Davor Hrg <hr...@gmail.com>.
just reverse where you write the ","
instead of checking if last and putting comma behind

check if first and put comma in front

Davor Hrg

On Jan 12, 2008 11:04 PM, Chris Lewis <ch...@bellsouth.net> wrote:
> So this ticket has been implemented in svn:
> https://issues.apache.org/jira/browse/TAPESTRY-2028
>
> And now I need whitespace... so how can I get it back? Is there or isn't
> there a way to disable this? Im using loop to output links (pagelinks),
> and i have whitespace behind in the body so there is separation.
> Unfortunately, it's getting stripped. Is there a workaround?
>
> On a related note, is there a way to know if im on the last iteration of
> the loop, so i could for example, follow all but the last with a ","?
> This may be outside the scope of loop as currently implemented, but i
> can see it being useful.
>
> chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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