Welcome the channel on the development of Cro, a set of libraries for building reactive distributed systems, lovingly crafted to take advantage of all the Raku Programming Language has to offer (cro.services). This channel is being logged for historical purposes. Set by lizmat on 24 May 2021. |
|||
05:16
Xliff left
09:29
sena_kun joined
11:18
AlexDaniel left,
CIAvash left
11:24
AlexDaniel joined
11:35
CIAvash joined
11:42
Xliff joined
|
|||
Xliff | sena_kun: I think you misunderstand. I need to do this inside a template. Mainly because the loop construct is there, so it's impossible to break out of raku to get it. | 12:43 | |
Is there a way to pass a Raku callable into a template? | |||
sena_kun | aaaaah | ||
I think it should be possible, no? | 12:45 | ||
you certainly can call callables in a template | |||
Xliff | Yeah, but how can you use it inside the template? | 12:46 | |
sena_kun | say you have a template like this: github.com/croservices/cro-webapp/....crotmp#L1 | ||
then call like this: github.com/croservices/cro-webapp/...st#L60-L68 | |||
so you interpolate results of the call into a template? | |||
sorry, I already forgot your question, so it might be not exactly what you want | 12:47 | ||
Xliff | Again, you are calling from raku. I need to call from inside the template itself. | ||
sena_kun | "<.m('pos', :y('named'))>" <- isn't it a call from the template? | 12:48 | |
12:51
Altai-man joined
12:55
sena_kun left
|
|||
Xliff | sena_kun - I'm trying that way, now./ | 12:55 | |
sena_kun: This results in a template parsing error: <td class="<.mergespaces( &cellClass($day, $d, $_) )>"> | 13:04 | ||
.mergespaces is a raku sub. | |||
&cellClass is a template sub | |||
I doubt I can run a method call on the result of &cellClass, could I? | 13:05 | ||
13:11
Altai-man left
13:12
Altai-man joined
|
|||
jnthn | There's not a way to pass the output of a template sub into another template sub, you'd get double escaping even if you did manage to make it work. | 13:44 | |
You can however use a template macro, like <:macro foo><blah><:body></blah></:> and then <|foo><&the_template></|> | 13:45 | ||
14:01
Altai-man left,
Xliff left,
ecocode left,
ecocode joined
14:02
Xliff joined,
Altai-man joined
|
|||
Xliff | jnthn: Are there any filter equivalents in Cro::Webapp::Template? | 14:21 | |
jnthn: Or Can you apply a function on <:body> | 14:24 | ||
jnthn | No; I've been considering ways to pass multiple "parts" into the macro and it can use them, but nothing done on that yet. | 14:29 | |
Xliff | *sign* -- OK. I will have to think about how I can work this application. I might need to use another templating engine for this specific part. | 14:32 | |
Thanks for the help. | |||
15:27
japhb left
15:34
japhb joined
16:43
Altai-man left
18:06
sena_kun joined
20:17
sena_kun left
20:18
sena_kun joined
22:01
sena_kun left
|