use strictures 1;
use Test::More qw(no_plan);
use HTML::Zoom;
my $template = <
Hello people
Placeholder
HTML
my $output = HTML::Zoom
->from_html($template)
->select('title, #greeting')->replace_content('Hello world & dog!')
->select('#list')->repeat_content(
[
sub {
$_->select('.name')->replace_content('Matt')
->select('.age')->replace_content('26')
},
sub {
$_->select('.name')->replace_content('Mark')
->select('.age')->replace_content('0x29')
},
sub {
$_->select('.name')->replace_content('Epitaph')
->select('.age')->replace_content('')
},
],
{ repeat_between => '.between' }
)
->to_html;
my $expect = <
Hello world & dog!
Hello world & dog!
Name: Matt
Age: 26
Name: Mark
Age: 0x29
Name: Epitaph
Age: <redacted>
HTML
is($output, $expect, 'Synopsis code works ok');