Re: Dynamic templates vs > (and other special characters)

2013-09-27 Thread Martin Kersten
The answer is quite easy if you are up for a bit hacking. Just define a
block around the part you want to write raw. Then provide a special render
method for the block you want to write differently. And when tapestry wants
to render the block, just open the template file yourself and read
everything inside the block tags by hand. Once you optained it just use a
raw write instead writing the given block. This way you can mark something
transparently and include it in raw output. Check out the user guide for
that.

The fun part is that tapestry cuts out the part inside the block for you so
you really only have to take care about the block writing.


Cheers,

Martin (Kersten),
Germany


2013/9/27 Barry Books 

> OutputRaw does not do the same thing because it does not support parameter
> expansion, but you are correct there are potential issues with this
> approach.
>
> I can't use the outputRaw component here because the data is the template.
>
> It does let you do things like this
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
>
> Which allows the page to contain any content and place the order form
> anywhere on the page.
>
>
>
>
>
>
> On Fri, Sep 27, 2013 at 10:36 AM, Thiago H de Paula Figueiredo <
> thiag...@gmail.com> wrote:
>
> > On Fri, 27 Sep 2013 12:31:01 -0300, Barry Books 
> wrote:
> >
> >  The long story is I have a CKEditor component that allows site admins to
> >> select content on a page and edit it. I do this with the Dynamic
> >> component.
> >>
> >
> > I'm not sure Dynamic, which is basically Tapestry templates loaded from
> > any place, is a good choice for including stuff written by non-developers
> > in a WYSIWYG editor. I'd use OutputRaw instead of dynamic templates, not
> > inside them. By the way, you said OutputRaw doesn't work inside dynamic
> > templates, but didn't really explain what you meant by that.
> >
> > Of course, I don't know well your scenario, so my suggestion here may not
> > the best for it.
> >
> > --
> > Thiago H. de Paula Figueiredo
> >
> > --**--**-
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<
> users-unsubscr...@tapestry.apache.org>
> >
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>


Re: Dynamic templates vs > (and other special characters)

2013-09-27 Thread Barry Books
OutputRaw does not do the same thing because it does not support parameter
expansion, but you are correct there are potential issues with this
approach.

I can't use the outputRaw component here because the data is the template.

It does let you do things like this


















Which allows the page to contain any content and place the order form
anywhere on the page.






On Fri, Sep 27, 2013 at 10:36 AM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Fri, 27 Sep 2013 12:31:01 -0300, Barry Books  wrote:
>
>  The long story is I have a CKEditor component that allows site admins to
>> select content on a page and edit it. I do this with the Dynamic
>> component.
>>
>
> I'm not sure Dynamic, which is basically Tapestry templates loaded from
> any place, is a good choice for including stuff written by non-developers
> in a WYSIWYG editor. I'd use OutputRaw instead of dynamic templates, not
> inside them. By the way, you said OutputRaw doesn't work inside dynamic
> templates, but didn't really explain what you meant by that.
>
> Of course, I don't know well your scenario, so my suggestion here may not
> the best for it.
>
> --
> Thiago H. de Paula Figueiredo
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org
>
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Dynamic templates vs > (and other special characters)

2013-09-27 Thread Thiago H de Paula Figueiredo

On Fri, 27 Sep 2013 12:31:01 -0300, Barry Books  wrote:


The long story is I have a CKEditor component that allows site admins to
select content on a page and edit it. I do this with the Dynamic  
component.


I'm not sure Dynamic, which is basically Tapestry templates loaded from  
any place, is a good choice for including stuff written by non-developers  
in a WYSIWYG editor. I'd use OutputRaw instead of dynamic templates, not  
inside them. By the way, you said OutputRaw doesn't work inside dynamic  
templates, but didn't really explain what you meant by that.


Of course, I don't know well your scenario, so my suggestion here may not  
the best for it.


--
Thiago H. de Paula Figueiredo

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



Re: Dynamic templates vs > (and other special characters)

2013-09-27 Thread Barry Books
The long story is I have a CKEditor component that allows site admins to
select content on a page and edit it. I do this with the Dynamic component.
Occasionally I need to put a style tag in the template to override the
default styling for the page. In this case I have a template like:







*html,body*{height:100%;}

*body* {padding: 0px;}

.container{height: 100%; padding: 0px; margin: 0px; max-width: 100%;}

.carousel*,*.item*,*.active{height:100%;}

.carousel-inner{height:100%;}

.fill{width:100%;height:100%;background-position:center;background-size:
cover;}



.carousel-inner > .item {

-webkit-transition: 0.3s ease-in-out left;

-moz-transition: 0.3s ease-in-out left;

-o-transition: 0.3s ease-in-out left;

transition: 0.3s ease-in-out left;

}







*...*

**

**


so I can make the Bootstrap carousel component full screen and control the
transition time. The problem is


.carousel-inner > .item turns into .carousel > .item


and does not work. I know I can fix this by making a different way to add
css to the page but that's a lot of work to solve this problem.


Re: Dynamic templates vs > (and other special characters)

2013-09-27 Thread Dmitry Gusev
I know this isn't solution, just a thought.
But if that is inline styles, probably you can use external *.css files and
embed them using 

Re: Dynamic templates vs > (and other special characters)

2013-09-27 Thread Barry Books
Unfortunately this is plain text coming from a database that's used  as the
template for the Dynamic component. It's in a style tag so it really needs
to be > and since it is user input I can't just move it into another file.


On Fri, Sep 27, 2013 at 9:38 AM, Dmitry Gusev wrote:

> I'm always having issues with these characters when I try to put JavaScript
> logic, like for (var i = 0; i < 10; i++) or if (a>b) {}.
> I haven't found better approach than moving this code out of template to
> external *.js files.
>
>
> On Fri, Sep 27, 2013 at 6:08 PM, Barry Books  wrote:
>
> > Is there any way to but a > sign in a dynamic template and have it
> rendered
> > as '>'. I end up with '>' which is not what I want. I know the
> > suggestion for tml files is to use outputRaw but that does not work in a
> > dynamic template.
> >
> > Thanks
> > Barry
> >
>
>
>
> --
> Dmitry Gusev
>
> AnjLab Team
> http://anjlab.com
>


Re: Dynamic templates vs > (and other special characters)

2013-09-27 Thread Dmitry Gusev
Michael, that won't work, because in this case CDATA is just a handy tool
to allow XML parser to encode special characters as entities himself
without you to manually converting > to >

You can test it yourself:



//= 1'); }


//]]>



This will result in:


//

var a = 0;
if (a < 1) { alert('a < 1'); } else { alert('a >= 1'); }

//

But I actually like this side effect with JavaScript, because it forces me
to separate presentation (TML) and logic (JS), which I believe is good.


On Fri, Sep 27, 2013 at 6:44 PM, Michael  wrote:

> 
> //
> 
>
> 
> //
> //Any code, any characters
>
> //]]>
> 
>
> But you won't be able to use ${vars} in this sections.
>
>
> 27.09.2013 18:38, Dmitry Gusev пишет:
>
>  I'm always having issues with these characters when I try to put
>> JavaScript
>> logic, like for (var i = 0; i<  10; i++) or if (a>b) {}.
>> I haven't found better approach than moving this code out of template to
>> external *.js files.
>>
>>
>> On Fri, Sep 27, 2013 at 6:08 PM, Barry Books  wrote:
>>
>>  Is there any way to but a>  sign in a dynamic template and have it
>>> rendered
>>> as '>'. I end up with'>' which is not what I want. I know the
>>> suggestion for tml files is to use outputRaw but that does not work in a
>>> dynamic template.
>>>
>>> Thanks
>>> Barry
>>>
>>>
>>
>>
> --
> Best regards,
> Michael Gagauz
>
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com


Re: Dynamic templates vs > (and other special characters)

2013-09-27 Thread Michael


//



//


But you won't be able to use ${vars} in this sections.


27.09.2013 18:38, Dmitry Gusev пишет:

I'm always having issues with these characters when I try to put JavaScript
logic, like for (var i = 0; i<  10; i++) or if (a>b) {}.
I haven't found better approach than moving this code out of template to
external *.js files.


On Fri, Sep 27, 2013 at 6:08 PM, Barry Books  wrote:


Is there any way to but a>  sign in a dynamic template and have it rendered
as '>'. I end up with'>' which is not what I want. I know the
suggestion for tml files is to use outputRaw but that does not work in a
dynamic template.

Thanks
Barry






--
Best regards,
Michael Gagauz


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



Re: Dynamic templates vs > (and other special characters)

2013-09-27 Thread Dmitry Gusev
I'm always having issues with these characters when I try to put JavaScript
logic, like for (var i = 0; i < 10; i++) or if (a>b) {}.
I haven't found better approach than moving this code out of template to
external *.js files.


On Fri, Sep 27, 2013 at 6:08 PM, Barry Books  wrote:

> Is there any way to but a > sign in a dynamic template and have it rendered
> as '>'. I end up with '>' which is not what I want. I know the
> suggestion for tml files is to use outputRaw but that does not work in a
> dynamic template.
>
> Thanks
> Barry
>



-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com


Dynamic templates vs > (and other special characters)

2013-09-27 Thread Barry Books
Is there any way to but a > sign in a dynamic template and have it rendered
as '>'. I end up with '>' which is not what I want. I know the
suggestion for tml files is to use outputRaw but that does not work in a
dynamic template.

Thanks
Barry