Caffeinated_Markup_Language
view release on metacpan or search on metacpan
t/html_formatter.t view on Meta::CPAN
subtest "Row in paragraphs" => sub {
is $parser->format("para1\n==\n||Col\n==\npara2"),
qq|<p>para1</p>\n<div class="clearfix col-1">\n<div class="column">\n<p>Col</p>\n</div>\n</div>\n<p>para2</p>|,
'correct in and out of paragraphs'
};
subtest "Error states" => sub {
throws_ok {$parser->format(qq!==\nOops!)}
qr/Unexpected char at start of row data/,
'parse error thrown with bad column start';
throws_ok {$parser->format(qq!==\n|Almost!)}
qr/Unexpected char in first column tag/,
'parse error thrown with bad column start (bad sequence)';
throws_ok {$parser->format(qq!==\n||abc\n|!)}
qr/Unexpected end of data in column tag/,
'parse error thrown with bad column start (unexpected eof)';
throws_ok {$parser->format(qq!==\n||abc\n||end early!)}
qr/Unexpected end of data in column data/,
'parse error thrown with unexpected eof';
};
subtest "Incomplete sequence" => sub {
is $parser->format(qq!==Not a row!),
'<p>==Not a row</p>',
'plain char sequence';
};
};
}
# ------------------------------------------------------------------------------
sub test_blockquotes {
subtest "Test blockquotes" => sub {
my $parser = Text::CaffeinatedMarkup::HTMLFormatter->new;
is $parser->format('""Very wise quote""'),
qq|<blockquote>Very wise quote</blockquote>|,
'quote marked up as expected (no cite)';
is $parser->format('""Very wise quote|A N Other""'),
qq|<blockquote>Very wise quote<cite>A N Other</cite></blockquote>|,
'quote marked up as expected (no cite)';
};
}
# ------------------------------------------------------------------------------
sub test_full_doc_1 {
subtest "Full doc #1" => sub {
my $input_pml = <<EOT
Yup, we're here! **Caffeinated Panda Creations** has launched the first phase of our new website.
Right now as you can see the blog is up and running and we'll be using it to keep you up to date with projects, events we're involved with, and new features coming to the site. Of course we'll still be streaming updates and content on [[http://facebo...
As time goes on we'll be adding new sections to the website so stay tuned for updates. Upcoming soon will be more details on our creations and services, so here's some things to whet your appetite!
==
||
## Custom Cyberfalls
{{cyberfalls.jpg|<<,H100,W130}}Cyberfalls for all your cybergoth and dance needs, at Caffeinated Panda Creations we specialise in custom designs and sets with [[https://www.google.co.uk/search?q=el+wire&safe=off&tbm=isch|EL-wire]] installations.
Whether you're looking for a themed set for a special occassion or straight forward cyber-chic, get in touch and we'll be happy to work with you!
||
## 3D Printing
{{makerbot.jpg|<<,H100,W130}}We here at Caffeinated Panda Creations are the proud owners of a [[http://store.makerbot.com/replicator2.html|Makerbot Replicator 2]] 3D printer.
As well as using it for our creations we can also offer a bespoke printing service. Design your own objects or let us work with you to create and realise your vision in high quality PLA plastic.
==
==
||
## Emporia
{{etsy.jpg|<<,H100,W130}}Over the next few months we'll be opening our online stores where we'll be selling some of our premade and customisable pieces along with t-shirts and other apparel.
||
## Costuming
{{mask.jpg|<<,H100,W130}}The panda team are keen costumers and going forward will be working on several exciting cosplaying projects for ourselves and others.
We'll also be keeping you up to date on where we'll be appearing and giving details on how we can work with you on your own costuming projects.
==
EOT
;
my $expected_html =<<EOT
<p>Yup, we're here! <strong>Caffeinated Panda Creations</strong> has launched the first phase of our new website.</p>
<p>Right now as you can see the blog is up and running and we'll be using it to keep you up to date with projects, events we're involved with, and new features coming to the site. Of course we'll still be streaming updates and content on ...
<p>As time goes on we'll be adding new sections to the website so stay tuned for updates. Upcoming soon will be more details on our creations and services, so here's some things to whet your appetite!</p>
<div class="clearfix col-2">
<div class="column">
<h2>Custom Cyberfalls</h2>
<img src="cyberfalls.jpg" class="pulled-left" width="130px" height="100px"><p>Cyberfalls for all your cybergoth and dance needs, at Caffeinated Panda Creations we specialise in custom designs and sets with <a href="https://www.google.co.uk/search?q=e...
<p>Whether you're looking for a themed set for a special occassion or straight forward cyber-chic, get in touch and we'll be happy to work with you!</p>
</div>
<div class="column">
<h2>3D Printing</h2>
<img src="makerbot.jpg" class="pulled-left" width="130px" height="100px"><p>We here at Caffeinated Panda Creations are the proud owners of a <a href="http://store.makerbot.com/replicator2.html" target="_new">Makerbot Replicator 2</a> 3D printer.</p>
<p>As well as using it for our creations we can also offer a bespoke printing service. Design your own objects or let us work with you to create and realise your vision in high quality PLA plastic.</p>
</div>
</div>
<div class="clearfix col-2">
<div class="column">
<h2>Emporia</h2>
<img src="etsy.jpg" class="pulled-left" width="130px" height="100px"><p>Over the next few months we'll be opening our online stores where we'll be selling some of our premade and customisable pieces along with t-shirts and other apparel.</p>
</div>
<div class="column">
<h2>Costuming</h2>
<img src="mask.jpg" class="pulled-left" width="130px" height="100px"><p>The panda team are keen costumers and going forward will be working on several exciting cosplaying projects for ourselves and others.</p>
<p>We'll also be keeping you up to date on where we'll be appearing and giving details on how we can work with you on your own costuming projects.</p>
</div>
</div>
EOT
;
my $formatter = Text::CaffeinatedMarkup::HTMLFormatter->new();
my $html = $formatter->format( $input_pml );
is( $html, $expected_html, 'HTML as expected' );
};
return;
}
( run in 0.532 second using v1.01-cache-2.11-cpan-39bf76dae61 )