aboutsummaryrefslogtreecommitdiff
path: root/lib/WebCoso/ReST.pm
diff options
context:
space:
mode:
authordakkar <dakkar@luxion>2008-01-03 20:35:26 +0000
committerdakkar <dakkar@luxion>2008-01-03 20:35:26 +0000
commit2969fd3ef2ac1004ff4594198e84b31c60adb0c5 (patch)
treeef168964514cf84eca489683cbd00e4f58888fcb /lib/WebCoso/ReST.pm
parentrefactoring: xslt (diff)
downloadWebCoso-2969fd3ef2ac1004ff4594198e84b31c60adb0c5.tar.gz
WebCoso-2969fd3ef2ac1004ff4594198e84b31c60adb0c5.tar.bz2
WebCoso-2969fd3ef2ac1004ff4594198e84b31c60adb0c5.zip
refactoring: ReST
git-svn-id: svn://luxion/repos/WebCoso/trunk@328 fcb26f47-9200-0410-b104-b98ab5b095f3
Diffstat (limited to 'lib/WebCoso/ReST.pm')
-rw-r--r--lib/WebCoso/ReST.pm37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/WebCoso/ReST.pm b/lib/WebCoso/ReST.pm
new file mode 100644
index 0000000..bd43528
--- /dev/null
+++ b/lib/WebCoso/ReST.pm
@@ -0,0 +1,37 @@
+package WebCoso::ReST;
+use strict;
+use warnings;
+use WebCoso::Common;
+use Path::Class;
+use Text::Restructured;
+use Text::Restructured::Writer::LibXML;
+
+sub new {
+ my ($class,%opts)=@_;
+
+ my $self={%opts};
+
+ $self->{rest}=Text::Restructured->new(
+ {
+ D=>{
+ 'file-insertion-enabled'=>0, # we use TT
+ generator=>0,
+ date=>0,
+ 'time'=>0,
+ 'source-link'=>0,
+ 'section-subtitles'=>1,
+ },
+ },
+ 'WebCoso');
+
+ $self->{fc}->add_parser(qr{\.rest\.txt$} =>
+ sub {
+ my $dudom=$self->{rest}->Parse($_[1],$_[0]);
+ return Text::Restructured::Writer::LibXML
+ ->new->ProcessDOM($dudom);
+ });
+
+ bless $self,$class;
+}
+
+1;