diff options
-rw-r--r-- | stest.pl | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -4,6 +4,34 @@ use warnings; use Slay::Maker; use File::Next; use Path::Class; +use Template; +use File::Cache::Parsed; +use Cwd 'abs_path'; +use Text::Restructured; +use Text::Restructured::Writer::LibXML; + +my $stash={}; +my $template=Template->new(); +my $rest=Text::Restructured->new({},'WebCoso'); + +my $fc=File::Cache::Parsed->new(); +$fc->add_parser(qr{\.rest\.tt2?$} => + sub { + my ($name,$content)=@_; + my $real_name=abs_path($name); + my $output; + $template->process($real_name, + {%$stash,name=>$name}, + \$output); + return $output; + }); +$fc->add_parser(qr{\.rest\.txt$} => + sub { + my ($name,$content)=@_; + my $dudom=$rest->Parse($content,$name); + return Text::Restructured::Writer::LibXML + ->new->ProcessDOM($dudom); + }); sub expandTT { my ($maker,$target,$deps,$matches)=@_; |