#!perl -w use strict; use Test::More tests => 35; use Test::NoWarnings; use_ok( 'Pod::PseudoPod::XHTML' ) or exit; my $parser = Pod::PseudoPod::XHTML->new(); isa_ok( $parser, 'Pod::PseudoPod::XHTML' ); my $results; initialize( $parser, $results ); $parser->parse_string_document( "=head0 Narf!" ); is( $results, "

Narf!

\n\n", "head0 level output" ); initialize( $parser, $results ); $parser->parse_string_document( "=head1 Poit!" ); is( $results, "

Poit!

\n\n", "head1 level output" ); initialize( $parser, $results ); $parser->parse_string_document( "=head2 I think so Brain." ); is( $results, "

I think so Brain.

\n\n", "head2 level output" ); initialize( $parser, $results ); $parser->parse_string_document( "=head3 I say, Brain..." ); is( $results, "

I say, Brain...

\n\n", "head3 level output" ); initialize( $parser, $results ); $parser->parse_string_document( "=head4 Zort!" ); is( $results, "
Zort!
\n\n", "head4 level output" ); initialize( $parser, $results ); $parser->parse_string_document( <<'EOPOD'); =pod Gee, Brain, what do you want to do tonight? EOPOD is( $results, <<'EOHTML', "simple paragraph" );

Gee, Brain, what do you want to do tonight?

EOHTML initialize( $parser, $results ); $parser->parse_string_document( <<'EOPOD'); =pod B: Now, Pinky, if by any chance you are captured during this mission, remember you are Gunther Heindriksen from Appenzell. You moved to Grindelwald to drive the cog train to Murren. Can you repeat that? P: Mmmm, no, Brain, don't think I can. EOPOD my $html = '

B: Now, Pinky, if by any chance you are captured during this mission, ' . 'remember you are Gunther Heindriksen from Appenzell. You moved to ' . "Grindelwald to drive the cog train to Murren. Can you repeat that?

\n\n" . "

P: Mmmm, no, Brain, don't think I can.

\n\n"; is( $results, $html, "multiple paragraphs" ); initialize( $parser, $results ); $parser->parse_string_document( <<'EOPOD'); =over =item * P: Gee, Brain, what do you want to do tonight? =item * B: The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is( $results, <<'EOHTML', "simple bulleted list" ); EOHTML initialize( $parser, $results ); $parser->parse_string_document( <<'EOPOD'); =over =item 1 P: Gee, Brain, what do you want to do tonight? =item 2 B: The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is( $results, <<'EOHTML', "numbered list" );
  1. 1. P: Gee, Brain, what do you want to do tonight?
  2. 2. B: The same thing we do every night, Pinky. Try to take over the world!
EOHTML initialize( $parser, $results ); $parser->parse_string_document( <<'EOPOD'); =over =item Pinky Gee, Brain, what do you want to do tonight? =item Brain The same thing we do every night, Pinky. Try to take over the world! =back EOPOD is( $results, <<'EOHTML', "list with text headings" ); EOHTML initialize( $parser, $results ); $parser->parse_string_document( <<'EOPOD'); =pod 1 + 1 = 2; 2 + 2 = 4; EOPOD is( $results, <<'EOHTML', "code block" );
  1 + 1 = 2;
  2 + 2 = 4;
EOHTML initialize( $parser, $results ); $parser->parse_string_document( <<'EOPOD'); =pod A plain paragraph with a C. EOPOD is( $results, <<"EOHTML", "code entity in a paragraph" );

A plain paragraph with a functionname.

EOHTML initialize( $parser, $results ); $parser->parse_string_document( <<'EOPOD'); =pod A plain paragraph with aN. EOPOD is( $results, <<"EOHTML", "footnote entity in a paragraph" );

A plain paragraph with a (footnote: footnote entry).

EOHTML initialize( $parser, $results ); $parser->add_body_tags( 1 ); $parser->parse_string_document( <<'EOPOD'); =pod A plain paragraph with body tags turned on. EOPOD is( $results, <<"EOHTML", "adding default html body tags" );

A plain paragraph with body tags turned on.

EOHTML initialize( $parser, $results ); $parser->add_body_tags( 1 ); $parser->dtd_strict; $parser->parse_string_document( <<'EOPOD'); =pod A plain paragraph with body tags turned on. EOPOD is( $results, <<"EOHTML", "adding strict html body tags" );

A plain paragraph with body tags turned on.

EOHTML initialize( $parser, $results ); $parser->add_body_tags( 1 ); $parser->dtd_transitional; $parser->parse_string_document( <<'EOPOD'); =pod A plain paragraph with body tags turned on. EOPOD is( $results, <<"EOHTML", "adding transitional html body tags" );

A plain paragraph with body tags turned on.

EOHTML initialize( $parser, $results ); $parser->add_body_tags( 1 ); $parser->add_css_tags( 1 ); $parser->parse_string_document( <<'EOPOD'); =pod A plain paragraph with body tags and css tags turned on. EOPOD is( $results, <<"EOHTML", "adding html body tags and css tags" );

A plain paragraph with body tags and css tags turned on.

EOHTML initialize( $parser, $results ); $parser->add_css_tags( 1 ); $parser->add_body_tags( 1 ); $parser->dtd_transitional; $parser->parse_string_document( <<'EOPOD'); =pod A plain paragraph with body tags turned on. EOPOD is( $results, <<"EOHTML", "adding transitional css and html body tags" );

A plain paragraph with body tags turned on.

EOHTML initialize( $parser, $results ); $parser->add_css_tags( 1 ); $parser->parse_string_document( <<'EOPOD'); =pod A plain paragraph with aN and css tags. EOPOD is( $results, <<"EOHTML", "css footnote entity in a paragraph" );

A plain paragraph with a (footnote: footnote entry) and css tags.

EOHTML initialize( $parser, $results ); $parser->add_css_tags( 1 ); $parser->parse_string_document( <<'EOPOD'); =pod A plain paragraph with a U. EOPOD is( $results, <<"EOHTML", "URL entity in a paragraph" );

A plain paragraph with a http://test.url.com/stuff/and/junk.txt.

EOHTML initialize( $parser, $results ); $parser->parse_string_document( <<'EOPOD'); =pod A plain paragraph with a Z. EOPOD is( $results, <<"EOHTML", "Link anchor entity in a paragraph" );

A plain paragraph with a .

EOHTML initialize( $parser, $results ); $parser->parse_string_document( <<'EOPOD'); =pod A plain paragraph with a A. EOPOD is( $results, <<"EOHTML", "Link entity in a paragraph" );

A plain paragraph with a link.

EOHTML initialize( $parser, $results ); $parser->parse_string_document( <<'EOPOD'); =pod A plain paragraph with a G. EOPOD is( $results, <<"EOHTML", "Superscript in a paragraph" );

A plain paragraph with a superscript.

EOHTML initialize( $parser, $results ); $parser->parse_string_document( <<'EOPOD'); =pod A plain paragraph with a H. EOPOD is( $results, <<"EOHTML", "Subscript in a paragraph" );

A plain paragraph with a subscript.

EOHTML initialize( $parser, $results ); $parser->parse_string_document( <<'EOPOD'); =pod A plain paragraph with B. EOPOD is( $results, <<"EOHTML", "Bold text in a paragraph" );

A plain paragraph with bold text.

EOHTML initialize( $parser, $results ); $parser->parse_string_document( <<'EOPOD'); =pod A plain paragraph with I. EOPOD is( $results, <<"EOHTML", "Italic text in a paragraph" );

A plain paragraph with italic text.

EOHTML initialize( $parser, $results ); $parser->parse_string_document( <<'EOPOD'); =pod A plain paragraph with R. EOPOD is( $results, <<"EOHTML", "Replaceable text in a paragraph" );

A plain paragraph with replaceable text.

EOHTML initialize( $parser, $results ); $parser->parse_string_document( <<'EOPOD'); =pod A plain paragraph with a F. EOPOD is( $results, <<"EOHTML", "File name in a paragraph" );

A plain paragraph with a filename.

EOHTML initialize( $parser, $results ); $parser->parse_string_document( <<'EOPOD'); =pod # this header is very important & don't you forget it my $text = "File is: " . ; EOPOD like( $results, qr/"/, "Verbatim text with encodable quotes" ); like( $results, qr/&/, "Verbatim text with encodable ampersands" ); like( $results, qr/</, "Verbatim text with encodable less-than" ); like( $results, qr/>/, "Verbatim text with encodable greater-than" ); ###################################### sub initialize { $_[ 0 ] = Pod::PseudoPod::XHTML->new(); $_[ 0 ]->output_string( \$results ); # Send the resulting output to a string $_[ 1 ] = ''; return; }