App-Dapper
view release on metacpan or search on metacpan
Github: http://github.com/markdbenson
fruits:
- Apple
- Orange
- Banana
---
<h2>Name</h2>
[% page.name %]<br />
<h2>Menu</h2>
<ul>
[% for link in page.menu %]
<li><a href="[% link.value %]">[% link.key %]</a></li>
[% end %]
</ul>
<h2>Fruits</h2>
<ul>
[% for fruit in page.fruits %]
<li>[% fruit %]</li>
t/64-import-wordpress.t view on Meta::CPAN
item(title => 'Private', slug => 'private', status => 'private', type => 'post', link => 'https://x.com/private/', content => 'x'),
item(title => 'Future', slug => 'future', status => 'future', type => 'post', link => 'https://x.com/future/', content => 'x', date => '2999-01-01 00:00:00'),
item(title => 'Trash', slug => 'trash', status => 'trash', type => 'post', content => 'x'),
item(title => 'Auto', slug => 'auto', status => 'auto-draft', type => 'post', content => 'x'),
item(title => 'Inherit', slug => 'inherit', status => 'inherit', type => 'post', content => 'x'),
item(title => 'No status', slug => 'no-status', type => 'post', content => 'x'),
item(title => 'No type', slug => 'no-type', status => 'publish', content => 'x'),
item(title => 'A page', slug => 'a-page', status => 'publish', type => 'page', link => 'https://x.com/parent/a-page/', content => 'x'),
item(title => 'Draft page', slug => 'draft-page', status => 'draft', type => 'page', content => 'x'),
item(title => 'Photo', slug => 'photo', status => 'inherit', type => 'attachment'),
item(title => 'Menu', slug => 'menu', status => 'publish', type => 'nav_menu_item'),
item(title => 'Product', slug => 'product', status => 'publish', type => 'product', content => 'x'),
item(title => 'Block', slug => 'block', status => 'publish', type => 'wp_block', content => 'x'),
);
my ($state, $out) = run_import('wordpress', $file, loud => 1);
is_deeply([ map { "$_->{file} $_->{kind} $_->{draft}" } @{$state->{pages}} ], [
'_source/blog/published.html post 0', '_source/blog/draft.html post 1', '_source/blog/pending.html post 1',
'_source/blog/private.html post 1', '_source/blog/future.html post 0', '_source/blog/no-status.html post 0',
'_source/blog/no-type.html post 0', '_source/a-page.html page 0', '_source/draft-page.html page 1',
], 'what was imported, in order');
my $front = sub { (App::Dapper::Utils::split_frontmatter(slurp($_[0]), $_[0]))[0] };
( run in 2.254 seconds using v1.01-cache-2.11-cpan-60884a8df76 )