blob: 4e2738ee7fffaf12a6c2fae04b9dda1ffde6efa6 (
plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#!/usr/bin/perl -w
# t/xhtml05.t - check block output from Pod::Simple::XHTML
BEGIN {
chdir 't' if -d 't';
}
use strict;
use lib '../lib';
use Test::More tests => 6;
use_ok('Pod::Simple::XHTML') or exit;
my $parser = Pod::Simple::XHTML->new ();
isa_ok ($parser, 'Pod::Simple::XHTML');
my $results;
initialize($parser, $results);
$parser->accept_targets_as_text( 'comment' );
$parser->parse_string_document(<<'EOPOD');
=for comment
This is an ordinary for block.
EOPOD
is($results, <<'EOHTML', "a for block");
<div class="comment">
<p>This is an ordinary for block.</p>
</div>
EOHTML
foreach my $target qw(note tip warning) {
initialize($parser, $results);
$parser->accept_targets_as_text( $target );
$parser->parse_string_document(<<"EOPOD");
=begin $target
This is a $target.
=end $target
EOPOD
is($results, <<"EOHTML", "allow $target blocks");
<div class="$target">
<p>This is a $target.</p>
</div>
EOHTML
}
######################################
sub initialize {
$_[0] = Pod::Simple::XHTML->new ();
$_[0]->html_header("");
$_[0]->html_footer("");
$_[0]->output_string( \$results ); # Send the resulting output to a string
$_[1] = '';
return;
}
|