| 1 |
#!perl |
| 2 |
|
| 3 |
BEGIN { chdir 't' if -d 't' } |
| 4 |
|
| 5 |
use strict; |
| 6 |
use warnings; |
| 7 |
|
| 8 |
use Test::More tests => 3; |
| 9 |
use Test::NoWarnings; |
| 10 |
|
| 11 |
use Text::MediawikiFormat as => 'wf', process_html => 0; |
| 12 |
|
| 13 |
my $wikitext = <<WIKI; |
| 14 |
|
| 15 |
* This should be a list. |
| 16 |
|
| 17 |
# This should be an ordered list. |
| 18 |
|
| 19 |
** This is like the default unordered list |
| 20 |
** But not indented |
| 21 |
|
| 22 |
! This is like the default unordered list |
| 23 |
! But marked differently |
| 24 |
|
| 25 |
WIKI |
| 26 |
|
| 27 |
my %format_tags = ( blocks => { unordered => qr/^!\s*/ } ); |
| 28 |
|
| 29 |
my $htmltext = wf( $wikitext, \%format_tags ); |
| 30 |
like( $htmltext, qr!<li>But marked differently</li>!m, 'redefining a list type works with use as' ); |
| 31 |
|
| 32 |
%format_tags = ( |
| 33 |
indent => qr//, |
| 34 |
blocks => { |
| 35 |
ordered => qr/^#\s*/, |
| 36 |
unordered => qr/^\*\s*/ |
| 37 |
}, |
| 38 |
indented => { unordered => 0 }, |
| 39 |
); |
| 40 |
|
| 41 |
$htmltext = wf( $wikitext, \%format_tags ); |
| 42 |
like( $htmltext, qr!<li>\* But not indented!m, 'redefining a list type to require no indent works with use as' ); |