# Testing HTML paragraphs BEGIN { if($ENV{PERL_CORE}) { chdir 't'; @INC = '../lib'; } } use strict; use Test; BEGIN { plan tests => 12 }; #use Pod::Simple::Debug (10); use Pod::Simple::HTML; sub x ($;&) { my $code = $_[1]; Pod::Simple::HTML->_out( sub{ $_[0]->bare_output(1); $code->($_[0]) if $code }, "=pod\n\n$_[0]", ) } ok( x( q{ =pod This is a paragraph =cut }), qq{\n

This is a paragraph

\n}, "paragraph building" ); ok( x(qq{=pod\n\nThis is a paragraph}), qq{\n

This is a paragraph

\n}, "paragraph building" ); ok( x(qq{This is a paragraph}), qq{\n

This is a paragraph

\n}, "paragraph building" ); ok(x( '=head1 This is a heading') => q{/\s*

]+>This\s+is\s+a\s+heading

\s*$/}, "heading building" ); ok(x('=head1 This is a heading', sub { $_[0]->html_h_level(2) }) => q{/\s*

]+>This\s+is\s+a\s+heading

\s*$/}, "heading building" ); ok(x( '=head2 This is a heading too') => q{/\s*

]+>This\s+is\s+a\s+heading\s+too

\s*$/}, "heading building" ); ok(x( '=head3 Also, this is a heading') => q{/\s*

]+>Also,\s+this\s+is\s+a\s+heading

\s*$/}, "heading building" ); ok(x( '=head4 This, too, is a heading') => q{/\s*

]+>This,\s+too,\s+is\s+a\s+heading

\s*$/}, "heading building" ); ok(x( '=head2 Yada Yada Operator X<...> X<... operator> X') => q{/name="Yada_Yada_Operator"/}, "heading anchor name" ); ok( x("=over 4\n\n=item one\n\n=item two\n\nHello\n\n=back\n"), q{
one
two

Hello

} ); # Check subclass. SUBCLASS: { package My::Pod::HTML; use vars '@ISA', '$VERSION'; @ISA = ('Pod::Simple::HTML'); $VERSION = '0.01'; sub do_section { 'howdy' } } ok( My::Pod::HTML->_out( sub{ $_[0]->bare_output(1) }, "=pod\n\n=over\n\n=item Foo\n\n=back\n", ), "\n
\n
Foo
\n
\n", ); print "# And one for the road...\n"; ok 1;