File: tag-override-use-as.t

package info (click to toggle)
libtext-mediawikiformat-perl 1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 236 kB
  • ctags: 46
  • sloc: perl: 1,848; makefile: 2
file content (44 lines) | stat: -rw-r--r-- 922 bytes parent folder | download
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
39
40
41
42
43
44
#!perl

BEGIN { chdir 't' if -d 't' }

use strict;
use warnings;

use Test::More tests => 3;
use Test::NoWarnings;

use Text::MediawikiFormat as => 'wf', process_html => 0;

my $wikitext =<<WIKI;

* This should be a list.

# This should be an ordered list.

** This is like the default unordered list
** But not indented

! This is like the default unordered list
! But marked differently

WIKI

my %format_tags = (blocks => {unordered => qr/^!\s*/});
 
my $htmltext = wf ($wikitext, \%format_tags);
like ($htmltext, qr!<li>But marked differently</li>!m,
      'redefining a list type works with use as');

%format_tags = (
	indent => qr//,
	blocks => { 
		ordered         => qr/^#\s*/, 
		unordered       => qr/^\*\s*/
	},
	indented => {unordered => 0},
); 

$htmltext = wf ($wikitext, \%format_tags);
like ($htmltext, qr!<li>\* But not indented!m,
      'redefining a list type to require no indent works with use as');