Skip to content

Commit

Permalink
investigate TT3 overridden block/scoping issue
Browse files Browse the repository at this point in the history
more minimal example - merge a module package to the script .

Note: to reproduce run "perl bin/tt-render.pl"
  • Loading branch information
shlomif committed Aug 20, 2024
1 parent 9f5e681 commit 2be4e05
Showing 1 changed file with 43 additions and 2 deletions.
45 changes: 43 additions & 2 deletions fc-solve/site/wml/bin/tt-render.pl
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,50 @@
use warnings;
use 5.014;

use lib './lib';
package FreecellSolver::Site::TTRender;

use FreecellSolver::Site::TTRender ();
use strict;
use warnings;
use utf8;

use Moo;
use Path::Tiny qw/ path /;
use Template ();

my $LATEMP_SERVER = "fc-solve";

my $template = Template->new(
{
COMPILE_DIR => ( $ENV{TMPDIR} // "/tmp" ) . "/shlomif-hp-tt2-cache",
COMPILE_EXT => ".ttc",
INCLUDE_PATH => [ ".", "./lib", ],
PRE_PROCESS => ["lib/blocks.tt2"],
POST_CHOMP => 1,
RELATIVE => 1,
ENCODING => 'utf8',
}
);

sub proc
{
my ( $self, $input_tt2_page_path ) = @_;
my @fn = split m#/#, $input_tt2_page_path;

my $vars = { host => $LATEMP_SERVER, };
$vars->{load_javascript_srcs} = sub { return ''; };
$vars->{enable_jquery_ui} =
( $input_tt2_page_path ne 'js-fc-solve/text/gui-tests.xhtml' );

$vars->{production} = 1;
my $html = '';
$template->process( "src/$input_tt2_page_path.tt2",
$vars, \$html, binmode => ':utf8', )
or die $template->error();

path( ".", "dest-prod/", @fn, )->touchpath()->spew_utf8($html);
}

package main;

my $obj = FreecellSolver::Site::TTRender->new( {} );
$obj->proc("js-fc-solve/text/gui-tests.xhtml");

0 comments on commit 2be4e05

Please sign in to comment.