Pandoc-Elements
view release on metacpan or search on metacpan
t/link-image-attributes.t view on Meta::CPAN
use strict;
use Test::More;
use Pandoc::Elements;
use JSON;
my $oldjson = do {
local (@ARGV, $/) = ('t/documents/link-image-oldstyle.json');
<>;
};
my $newjson = do {
local (@ARGV, $/) = ('t/documents/link-image-attributes.json');
<>;
};
my $olddoc = pandoc_json($oldjson);
my $newdoc = pandoc_json($newjson);
is_deeply $olddoc, $newdoc, 'parse old and new (Pandoc >= 1.16) format';
$Pandoc::Elements::PANDOC_VERSION = '1.16';
is_deeply decode_json($newjson), decode_json($newdoc->to_json), 'encode new format';
t/meta-blessing.t view on Meta::CPAN
use strict;
use Test::More 0.96;
use Pandoc::Elements;
use Scalar::Util qw[ blessed reftype ];
my $document = do {
local (@ARGV, $/) = ('t/documents/meta.json');
pandoc_json(<>);
};
isa_ok $document, 'Pandoc::Document', "it's a document" or note ref $document;
my $unblessed_counts = bless_check_loop($document->meta);
ok !keys(%$unblessed_counts), 'no unblessed metadata objects'
or note "There were some unblessed metadata objects:\n", explain $unblessed_counts;
t/metadata.t view on Meta::CPAN
$doc->meta->{blocks}->content, 'value("blocks", elements => keep)';
is_deeply $doc->value('/blocks', element => 'keep'),
$doc->meta->{blocks}->content, 'value("/blocks", elements => keep)';
foreach (qw(x map/x true/x blocks/x map/list/x map/list/3)) {
is $doc->value($_), undef, "value('$_')";
is $doc->value($_), undef, "value('/$_')";
}
my $doc = do {
local (@ARGV, $/) = ('t/documents/meta.json');
pandoc_json(<>);
};
is_deeply { map { $_ => $doc->metavalue($_) } keys %{$doc->meta} },
$doc->metavalue, 'Document->metavalue';
done_testing;
use strict;
use Test::More;
use Pandoc::Walker;
use Pandoc::Filter;
use Pandoc::Elements qw(Str Space pandoc_json);
sub load {
local (@ARGV, $/) = ('t/documents/example.json');
pandoc_json(<>);
}
my $doc = load();
my $LINKS = [qw(
http://example.org/
image.png
http://example.com/
)];
( run in 0.516 second using v1.01-cache-2.11-cpan-49f99fa48dc )