Tip for splitting renderOn: on multiple messages

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Tip for splitting renderOn: on multiple messages

Vicnet-2
Hello,

My renderOn: message become fat with times.
I try to cut in multiple parts.

Digging into sources, I found that following code is fine:
renderOn: html
    html div with: [ self renderPartOn: html ] 
    ...
renderPartOn: html
    html ...


As renderPartOn: doesn't return anything, so return self, I don't understand in first approach how resulting tag could be inside parent tag (inner tag).
In fact, rendering a block, change the root tag to current tag, so html build new tag inside pseudo-root ! (and then restore root to original of course)

Is there a site/book/blog where I can find such tips or recipes ?

a+
Vicnet

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Tip for splitting renderOn: on multiple messages

jtuchel
Vicnet,

not sure if I understand your comments correctly. But I think your thinking way too complicated. Look into the method with: it doesn't pass anything into tho block, nor does it use the result of the block's evaluation. It simply puts an opening div tag onto the html, evaluates the block and afterwards adds the closing tag onto the output stream. No magic there, no unwinding or tag hierarchy or anything.


Joachim

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Tip for splitting renderOn: on multiple messages

Vicnet-2
You are right: with: just add tag and don't evaluate block

But I wonder how with: deals with inner tags.

html div with: ( self renderPartOn: html ) doesn't add inner tags inside div because () is evaluated before 'html div'.
html div with: [ self renderPartOn: html ] does the job (inner tags) because block is evaluated specifically (see *Web protocol for block) inside div tagbrush.

a+
Vicnet

Le jeudi 27 mars 2014 10:25:18 UTC+1, Joachim Tuchel a écrit :
Vicnet,

not sure if I understand your comments correctly. But I think your thinking way too complicated. Look into the method with: it doesn't pass anything into tho block, nor does it use the result of the block's evaluation. It simply puts an opening div tag onto the html, evaluates the block and afterwards adds the closing tag onto the output stream. No magic there, no unwinding or tag hierarchy or anything.


Joachim

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Tip for splitting renderOn: on multiple messages

Herby Vojčík


Vicnet wrote:
> You are right: with: just add tag and don't evaluate block
>
> But I wonder how with: deals with inner tags.
>
> html div with: ( self renderPartOn: html ) doesn't add inner tags
> inside div because () is evaluated before 'html div'.
> html div with: [ self renderPartOn: html ] does the job (inner tags)
> because block is evaluated specifically (see *Web protocol for block)
> inside div tagbrush.

Didn't you just explain? ;-)

> a+
> Vicnet

Herby

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.