SYNOPSIS
my $filter = Pandoc::Filter::Lazy->new(
'Header => sub { Header $_->level, [ Str $_->string ] }'
);
if ( $filter->error ) {
say STDERR $lazy->error;
say STDERR $lazy->code;
} else {
$filter->apply(...)
}
DESCRIPTION
This module helps creation of Pandoc::Filter with arguments given as string. The following should result in equivalent filters:
Pandoc::Walker::action( ... ); # ... as code Pandoc::Filter::Lazy->new( '...' ) # '...' as string
The script passed as only argument is tried to convert to valid Perl by escaping selectors and adding a missing "sub { ... }"", for instance
Code|CodeBlock => say $_->class
Is converted to
'Code|CodeBlock' => sub { say $_->class }