1#!/usr/bin/perl -w 2 3# t/xhtml05.t - check block output from Pod::Simple::XHTML 4 5BEGIN { 6 chdir 't' if -d 't'; 7} 8 9use strict; 10use warnings; 11use lib '../lib'; 12use Test::More tests => 6; 13 14use_ok('Pod::Simple::XHTML') or exit; 15 16my $parser = Pod::Simple::XHTML->new (); 17isa_ok ($parser, 'Pod::Simple::XHTML'); 18 19my $results; 20initialize($parser, $results); 21$parser->accept_targets_as_text( 'comment' ); 22$parser->parse_string_document(<<'EOPOD'); 23=for comment 24This is an ordinary for block. 25 26EOPOD 27 28is($results, <<'EOHTML', "a for block"); 29<div class="comment"> 30 31<p>This is an ordinary for block.</p> 32 33</div> 34 35EOHTML 36 37foreach my $target (qw(note tip warning)) { 38 initialize($parser, $results); 39 $parser->accept_targets_as_text( $target ); 40 $parser->parse_string_document(<<"EOPOD"); 41=begin $target 42 43This is a $target. 44 45=end $target 46EOPOD 47 48 is($results, <<"EOHTML", "allow $target blocks"); 49<div class="$target"> 50 51<p>This is a $target.</p> 52 53</div> 54 55EOHTML 56 57} 58 59###################################### 60 61sub initialize { 62 $_[0] = Pod::Simple::XHTML->new (); 63 $_[0]->html_header(""); 64 $_[0]->html_footer(""); 65 $_[0]->output_string( \$results ); # Send the resulting output to a string 66 $_[1] = ''; 67 return; 68} 69