In Text::Xslate is great way to cascade
(or wrap, in some other templating engine) specific template into main template. There is also possible to include
common chunks into template.
I'd like to include
chunks into specific template which cascade
s into main template, but in a way that include
d template has parts which replace (around
keyword) some named-parts in main.
Simplified test case
main.pl
use strict;
use warnings;
use FindBin qw($Bin);
use Text::Xslate;
my $tx = Text::Xslate->new(
path => [ "$Bin/template" ],
);
print $tx->render( 'some.tx' );
template/some.tx
: cascade main
: around some -> {
some text 1
: include included;
some text 2
: }
template/main.tx
MAIN template
: block main -> {
main DEFAULT text, should replaced with included.tx one
: } #
: block some -> {
: } #
template/included.tx
: around main -> {
this should come from included but does not
: }
included successfully into some.tx
Desired output
MAIN template
this should come from included but does not
some text 1
included successfully into some.tx
some text 2
So the third line in the output is not right, if I use it in some.tx
: around main -> {
this should come from included but does not
: }
it works.
But how to include chunks, which should cascade into main-template?