diff options
author | dakkar <dakkar@luxion> | 2007-09-08 11:51:05 +0000 |
---|---|---|
committer | dakkar <dakkar@luxion> | 2007-09-08 11:51:05 +0000 |
commit | ca459459e37d29ff76a90cc457fb85f7d524b441 (patch) | |
tree | 7eeeaf65421c2564b77bff73d40adaa854678bd3 /stest.pl | |
parent | cache is now updated on 'put' (diff) | |
download | WebCoso-ca459459e37d29ff76a90cc457fb85f7d524b441.tar.gz WebCoso-ca459459e37d29ff76a90cc457fb85f7d524b441.tar.bz2 WebCoso-ca459459e37d29ff76a90cc457fb85f7d524b441.zip |
symlink following, and most parsers for the test
git-svn-id: svn://luxion/repos/WebCoso/trunk@284 fcb26f47-9200-0410-b104-b98ab5b095f3
Diffstat (limited to 'stest.pl')
-rw-r--r-- | stest.pl | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -9,29 +9,33 @@ use File::Cache::Parsed; use Cwd 'abs_path'; use Text::Restructured; use Text::Restructured::Writer::LibXML; +use XML::LibXML; +use XML::LibXSLT; my $stash={}; my $template=Template->new(); my $rest=Text::Restructured->new({},'WebCoso'); +my $xml_parser=XML::LibXML->new(); +my $xslt_proc=XML::LibXSLT->new(); my $fc=File::Cache::Parsed->new(); -$fc->add_parser(qr{\.rest\.tt2?$} => +$fc->add_parser(qr{\.tt2?$} => sub { - my ($name,$content)=@_; - my $real_name=abs_path($name); - my $output; - $template->process($real_name, - {%$stash,name=>$name}, - \$output); - return $output; + $template->context->template($_[0]); }); $fc->add_parser(qr{\.rest\.txt$} => sub { - my ($name,$content)=@_; - my $dudom=$rest->Parse($content,$name); + my $dudom=$rest->Parse($_[1],$_[0]); return Text::Restructured::Writer::LibXML ->new->ProcessDOM($dudom); }); +$fc->add_parser(qr{\.xml$} => + sub { $xml_parser->parse_string($_[1],$_[0]) }); +$fc->add_parser(qr{\.xslt?$} => + sub { $xslt_proc->parse_stylesheet + ($xml_parser->parse_string($_[1],$_[0])) }); +$fc->add_writer(qr{\.xml$} => + sub { $_[1]->toFile($_[0]) }); sub expandTT { my ($maker,$target,$deps,$matches)=@_; |