You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.0 KiB
32 lines
1.0 KiB
10 years ago
|
#!/usr/bin/env perl
|
||
|
|
||
|
use strict;
|
||
|
use warnings;
|
||
|
use utf8;
|
||
|
|
||
|
use Test::More tests => 8;
|
||
|
use Text::Dokuwiki;
|
||
|
|
||
|
my $dw = Text::Dokuwiki->new;
|
||
|
isa_ok($dw, 'Text::Dokuwiki');
|
||
|
|
||
|
my $elem = $dw->_parse_include('{{image.png}}');
|
||
|
is(ref $elem, 'ARRAY');
|
||
|
is_deeply($elem, [img => {align => 'left', src => 'image.png'}]);
|
||
|
|
||
|
$elem = $dw->_parse_include('{{image.png?100}}');
|
||
|
is_deeply($elem, [img => {align => 'left', src => 'image.png', width => '100'}]);
|
||
|
|
||
|
$elem = $dw->_parse_include('{{ image.png?100x200 }}');
|
||
|
is_deeply($elem, [img => {align => 'center', src => 'image.png', width => '100', height => 200}]);
|
||
|
|
||
|
$elem = $dw->_parse_include('{{ :image.png|image}}');
|
||
|
is_deeply($elem, [img => {align => 'right', src => '/image.png', title => 'image'}]);
|
||
|
|
||
|
$elem = $dw->_parse_include('{{namespace:image.png|}}');
|
||
|
is_deeply($elem, [img => {align => 'left', src => 'namespace/image.png', title => ''}]);
|
||
|
|
||
|
$elem = $dw->_parse_include('{{namespace:image.png|text | 1}}');
|
||
|
is_deeply($elem, [img => {align => 'left', src => 'namespace/image.png', title => 'text | 1'}]);
|
||
|
|