1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
use strict;
use Test::More;
use Pandoc::Elements;
use JSON;
# internal representation
my $lineblock = LineBlock [ [ Str " foo"], [ Str "bar"], [ Str " baz"], ];
ok $lineblock->is_block, 'is_block';
{
local $Pandoc::Elements::PANDOC_VERSION = '1.16';
my $expect = {
t => 'Para',
c => [
{ 'c' => "\x{a0}\x{a0}foo", 't' => 'Str' },
{ 'c' => [], 't' => 'LineBreak' },
{ 'c' => "bar", 't' => 'Str' },
{ 'c' => [], 't' => 'LineBreak' },
{ 'c' => "\x{a0}baz", 't' => 'Str' }
]
};
is_deeply $expect, decode_json($lineblock->to_json), 'PANDOC_VERSION < 1.18';
}
{
local $Pandoc::Elements::PANDOC_VERSION = '1.18';
my $expect = {
t => 'LineBlock',
c => [
[ { 'c' => "\x{a0}\x{a0}foo", 't' => 'Str' } ],
[ { 'c' => "bar", 't' => 'Str' } ],
[ { 'c' => "\x{a0}baz", 't' => 'Str' } ]
]
};
is_deeply $expect, decode_json($lineblock->to_json), 'PANDOC_VERSION >= 1.18';
}
done_testing;
|