diff options
author | dakkar <dakkar@thenautilus.net> | 2019-10-05 18:31:11 +0100 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2019-10-05 18:31:11 +0100 |
commit | bb2863e22eab94a70e2e317c649d980c53bbaaa7 (patch) | |
tree | 7ba1e32c0c96a372ebbc1f1c7e6109568027f03f /lib/WebCoso/ReST.pm | |
parent | fix duplicate key in rst config (diff) | |
download | WebCoso-bb2863e22eab94a70e2e317c649d980c53bbaaa7.tar.gz WebCoso-bb2863e22eab94a70e2e317c649d980c53bbaaa7.tar.bz2 WebCoso-bb2863e22eab94a70e2e317c649d980c53bbaaa7.zip |
add `video` directive
Diffstat (limited to 'lib/WebCoso/ReST.pm')
-rw-r--r-- | lib/WebCoso/ReST.pm | 18 |
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; |