aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2019-10-05 18:31:11 +0100
committerdakkar <dakkar@thenautilus.net>2019-10-05 18:31:11 +0100
commitbb2863e22eab94a70e2e317c649d980c53bbaaa7 (patch)
tree7ba1e32c0c96a372ebbc1f1c7e6109568027f03f
parentfix duplicate key in rst config (diff)
downloadWebCoso-bb2863e22eab94a70e2e317c649d980c53bbaaa7.tar.gz
WebCoso-bb2863e22eab94a70e2e317c649d980c53bbaaa7.tar.bz2
WebCoso-bb2863e22eab94a70e2e317c649d980c53bbaaa7.zip
add `video` directive
-rw-r--r--lib/WebCoso/ReST.pm18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/WebCoso/ReST.pm b/lib/WebCoso/ReST.pm
index 9cc4242..5f7f922 100644
--- a/lib/WebCoso/ReST.pm
+++ b/lib/WebCoso/ReST.pm
@@ -8,6 +8,8 @@ use Text::Restructured::Writer::LibXML;
use Log::Log4perl ':easy';
use Encode;
+Text::Restructured::Directive::handle_directive( video => \&rst_video);
+
sub new {
my ($class,%opts)=@_;
@@ -37,4 +39,20 @@ sub new {
bless $self,$class;
}
+sub rst_video {
+ my($parser, $name, $parent, $source, $lineno, $dtext, $lit) = @_;
+ my $dhash = Text::Restructured::Directive::parse_directive($parser, $dtext, $lit, $source, $lineno);
+ my $options = $dhash->{options};
+ my @extra_attrs = (qw(loop type));
+ # a video is like an image
+ my $dom = Text::Restructured::Directive::image(@_,@extra_attrs);
+ $dom->tag('video');
+ for my $attr (@extra_attrs) {
+ if ($options->{$attr}) {
+ $dom->{attr}{$attr} = $options->{$attr};
+ }
+ }
+ return $dom;
+}
+
1;