Foo
Bar
Baz
Drink
Sip
Ouch
Drip EOF
is $results, <<'EOF', 'And it should work!'; <ul id="index"> <li> <ul> <li><a href="#Foo">Foo</a> <ul> <li><a href="#Bar">Bar</a></li> </ul> </li> </ul> </li> <li><a href="#Baz">Baz</a> <ul> <li> <ul> <li> <ul> <li><a href="#Drink">Drink</a></li> </ul> </li> <li><a href="#Sip">Sip</a> <ul> <li><a href="#Ouch">Ouch</a></li> </ul> </li> </ul> </li> </ul> </li> <li><a href="#Drip">Drip</a></li> </ul>
<h2 id="Foo">Foo</h2>
<h3 id="Bar">Bar</h3>
<h1 id="Baz">Baz</h1>
<h4 id="Drink">Drink</h4>
<h3 id="Sip">Sip</h3>
<h4 id="Ouch">Ouch</h4>
<h1 id="Drip">Drip</h1>
EOF
initialize($parser, $results); $parser->html_header($header); $parser->html_footer($footer); $parser->backlink(1); ok $parser->parse_string_document( '=head1 Foo' ), 'Parse a header'; is $results, <<'EOF', 'Should have the index and a backlink';
<html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> </head> <body id="_podtop_">
<ul id="index"> <li><a href="#Foo">Foo</a></li> </ul>
<a href="#_podtop_"><h1 id="Foo">Foo</h1></a>
</body> </html>
EOF
initialize($parser, $results); $parser->html_header($header); $parser->html_footer($footer); $parser->backlink(1); ok $parser->parse_string_document( "=head1 Foo \n\n=head2 Bar \n\n=head1 Baz" ), 'Parse headers'; is $results, <<'EOF', 'Should have the index and backlinks';
<html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> </head> <body id="_podtop_">
<ul id="index"> <li><a href="#Foo">Foo</a> <ul> <li><a href="#Bar">Bar</a></li> </ul> </li> <li><a href="#Baz">Baz</a></li> </ul>
<a href="#_podtop_"><h1 id="Foo">Foo</h1></a>
<h2 id="Bar">Bar</h2>
<a href="#_podtop_"><h1 id="Baz">Baz</h1></a>
</body> </html>
EOF
initialize($parser, $results); $parser->html_header($header); $parser->html_footer($footer); $parser->index(0); $parser->backlink(1); ok $parser->parse_string_document( "=head1 Foo \n\n=head1 Bar" ), 'Parse headers'; is $results, <<'EOF', 'Should have backlinks but no index';
<html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> </head> <body id="_podtop_">
<a href="#_podtop_"><h1 id="Foo">Foo</h1></a>
<a href="#_podtop_"><h1 id="Bar">Bar</h1></a>
</body> </html>
EOF
initialize($parser, $results); $parser->html_header($header); $parser->html_footer($footer); $parser->backlink(1); $parser->html_h_level(2); ok $parser->parse_string_document( "=head1 Foo \n\n=head1 Bar" ), 'Parse headers'; is $results, <<'EOF', 'Should have index and backlinks around h2 elements';
<html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> </head> <body id="_podtop_">
<ul id="index"> <li> <ul> <li><a href="#Foo">Foo</a></li> <li><a href="#Bar">Bar</a></li> </ul> </li> </ul>
<a href="#_podtop_"><h2 id="Foo">Foo</h2></a>
<a href="#_podtop_"><h2 id="Bar">Bar</h2></a>
</body> </html>
EOF
initialize($parser, $results); $parser->anchor_items(1); ok $parser->parse_string_document( <<'EOPOD' ), 'Parse POD'; =head1 Foo
not anchored
still not anchored
is $results, <<'EOF', 'Anchor =item directives'; <ul id="index"> <li><a href="#Foo">Foo</a></li> </ul>
<h1 id="Foo">Foo</h1>
<dl>
<dt id="test">test</dt> <dd>
</dd> <dt id="Test-2">Test 2</dt> <dd>
<p>body of item</p>
</dd> </dl>
<ul>
<li><p>not anchored</p>
</li> </ul>
<ol>
<li><p>still not anchored</p>
</li> </ol>
EOF
initialize($parser, $results); $parser->anchor_items(0); ok $parser->parse_string_document( <<'EOPOD' ), 'Parse POD'; =head1 Foo
not anchored
still not anchored
<h1 id="Foo">Foo</h1>
<dl>
<dt>test</dt> <dd>
</dd> <dt>Test 2</dt> <dd>
<p>body of item</p>
</dd> </dl>
<ul>
<li><p>not anchored</p>
</li> </ul>
<ol>
<li><p>still not anchored</p>
</li> </ol>
EOF
$ENV{FOO}= 1;
initialize($parser, $results); ok $parser->parse_string_document( <<'EOPOD' ), 'Parse POD'; =head1 Foo
Test links from perlpodspec: "About L<...> Codes"
About L<...> Codes
Here it is EOPOD
my $id = 'About-L...-Codes'; # what should this be?
is $results, <<EOF, 'anchor and h1 use same section id for complex sections'; <ul id="index"> <li><a href="#Foo">Foo</a></li> <li><a href="#$id">About L<...> Codes</a></li> </ul>
<h1 id="Foo">Foo</h1>
<p>Test links from perlpodspec: <a href="#$id">"About L<...> Codes"</a></p>
<h1 id="$id">About L<...> Codes</h1>
<p>Here it is</p>
EOF
sub initialize { $_[0] = Pod::Simple::XHTML->new; $_[0]->html_header(''); $_[0]->html_footer(''); $_[0]->index(1); $_[0]->output_string( \$results ); # Send the resulting output to a string $_[1] = ''; return; }
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 599:
=back doesn't take any parameters, but you said =back EOPOD
- Around line 668:
=back doesn't take any parameters, but you said =back EOPOD is $results, <<'EOF', 'Do not anchor =item directives'; <ul id="index"> <li><a href="#Foo">Foo</a></li> </ul>