#! /usr/bin/perl # #=============================================================================== # # FILE: html.t # # DESCRIPTION: Tests of HTML generation from various POD constructs # # FILES: --- # BUGS: --- # NOTES: --- # AUTHOR: Geoffrey Leach, # VERSION: 1.0 # CREATED: 10/28/07 09:56:16 PDT # REVISION: --- #=============================================================================== use 5.006002; use strict; use warnings; use lib qw(./t); use Run qw( run html_file ); use Pod::HtmlEasy::Data qw(NL); use version; our $VERSION = qv('1.0'); #--------------------------- test 4 my $html_file = html_file(); run(q{head1}, [ q{=head1 Testing POD}, q{`twas brillig and the slythe toes} . NL . q{did gyre and gimbal in the wave}, qq{=head1 NAME $html_file}, qq{Content of NAME: note the file is called $html_file}, q{=head1 E}, q{This is the content of a paragraph with less-than as title, ie., E}, ], [ q{

Testing POD

}, q{

`twas brillig and the slythe toes} . NL . q{did gyre and gimbal in the wave

}, qq{

NAME $html_file

}, qq{

Content of NAME: note the file is called $html_file

}, q{

<

}, q{

This is the content of a paragraph with less-than as title, ie., <

}, ], [ q{
  • Testing POD
  • }, qq{
  • NAME $html_file
  • }, q{
  • <
  • }, ], ); #--------------------------- test 5 run(q{head2}, [ q{=head2 Testing head2}, q{`twas brillig and the slythe toes} . NL . q{did gyre and gimbal in the wave}, q{=head2 NAME I}, q{Content of NAME with italicized content I} . NL . q{and code content C} . NL . q{This is head 2, so no title effect}, ], [ q{

    Testing head2

    }, q{

    `twas brillig and the slythe toes} . NL . q{did gyre and gimbal in the wave

    }, q{

    NAME foobar

    }, q{

    Content of NAME with italicized content foobar} . NL . q{and code content this is foo bar!} . NL . q{This is head 2, so no title effect

    }, ], [ q{}, ], ); #--------------------------- test 6 run(q{head3}, [ q{=head3 Testing head3}, q{`twas brillig and the slythe toes} . NL . q{did gyre and gimbal in the wave}, ], [ q{

    Testing head3

    }, q{

    `twas brillig and the slythe toes} . NL . q{did gyre and gimbal in the wave

    }, ], [ q{}, ], ); #--------------------------- test 7 run(q{head4}, [ q{=head4 Testing head4}, q{`twas brillig and the slythe toes} . NL . q{did gyre and gimbal in the wave}, ], [ q{

    Testing head4

    }, q{

    `twas brillig and the slythe toes} . NL . q{did gyre and gimbal in the wave

    }, ], [ q{}, ], ); #--------------------------- test 8 run(q{item}, [ q{=item Testing item and verbatum text}, q{ This text is indened one space} . NL . q{ which makes it verbatum}, q{=item *}, q{Starred}, q{The title of this item is "Starred" because it's "=item *"}, q{=item * Title on item line}, q{This item has a normal title and a asterisk, which is ignored} ], [ q{
  • } . q{Testing item and verbatum text
  • }, q{
     This text is indened one space} 
                . NL
                . q{ which makes it verbatum
    }, q{
  • Starred
  • }, q{

    The title of this item is "Starred" because } . q{it's "=item *"

    }, q{
  • Title on item line
  • }, q{

    This item has a normal title and a asterisk, which is ignored

    }, ], ); #--------------------------- test 9 run(q{over and back}, [ q{=item over 4}, q{=over 4}, q{Text that is indented 4 spaces}, q{=over 10}, q{"Over 10" text that is indented 4 more spaces, demonstrating that } . q{the level is ignored}, q{=back}, q{=back}, ], [ q{
  • over 4
  • }, q{
      }, q{

      Text that is indented 4 spaces

      }, q{
        }, q{

        "Over 10" text that is indented 4 more spaces, } . q{demonstrating that the level is ignored

        }, q{
      }, q{
    }, ], ); #--------------------------- test 10 run(q{ignored controls}, [ q{=for}, q{=begin}, q{This text is ignored: begin/end group}, q{=end}, ], [ # It's no accident that there's nothing here ], ); #--------------------------- test 11 run(q{various URIs}, [ q{http://fedoraproject.org}, q{https://fedoraproject.org}, q{ftp://fedoraproject.org/}, q{file:///etc/hosts/}, q{root@fedoraproject.org}, ], [ q{

    } . q{fedoraproject.org

    }, q{

    } . q{fedoraproject.org

    }, q{

    fedoraproject.org

    }, q{

    /etc/hosts/

    }, q{

    root@fedoraproject.org

    }, ], ); #--------------------------- test 12 run(q{various L<>}, [ q{L}, q{L}, q{L}, q{L}, q{L}, # Pod::Parselinrk sees this as POD spec # Quite properly, as its _not_ a hyperlink. See perlpod() #q{L}, q{L}, q{L}, # These are from podspec q{L}, q{L}, q{L}, q{L}, # More q{L<"Section">}, q{mail foo@foo.com}, q{B (foo site).>}, q{L}, q{L}, q{L}, # From parselink.t q{L}, q{L}, q{L}, q{L}, q{L}, q{L}, q{L}, q{L}, q{Lbar>}, qq{L}, q{L}, q{L|foo/bar>}, q{L}, q{L|fooEbar>}, q{L}, # An interesting case. The news: gets it as a URL, # but as firefox does not support the news protocol, # we punt to mail. q{L}, ], [ q{

    } . q{fedoraproject.org

    }, q{

    } . q{fedoraproject.org

    }, q{

    fedoraproject.org

    }, q{

    /etc/hosts/

    }, q{

    root@fedoraproject.org

    }, q{

    Pod::HtmlEasy} . q{

    }, q{

    crontab(5)

    }, q{

    Perlport's} . q{ section on NL's

    }, q{

    "Newlines" } . q{in perlport

    }, q{

    "Object Attributes"

    }, q{

    "DESCRIPTION" in crontab(5)

    }, q{

    "Section"

    }, q{

    mail foo@foo.com

    }, q{

    } . q{www.foo.com (foo site).

    }, q{

    Text

    }, q{

    Foo

    }, q{

    Foo::Bar

    }, q{

    parselink

    }, q{

    Foo

    }, q{

    "Bar" } . q{in Foo

    }, q{

    "baz boo" in foo} . q{

    }, q{

    "bar"

    }, q{

    "baz boo"

    }, q{

    "baz boo"

    }, q{

    "baz boo" } . q{in foo bar

    }, q{

    foobar

    }, q{

    "boo" } . q{in foo bar baz

    }, q{

    anchor

    }, q{

    Testing} . q{ italics

    }, q{

    some manual page in perl(1)

    }, q{

    Nested } . q{www.perl.org

    }, q{

    ls(1)

    }, q{

    news:yld72axzc8.} . q{fsf@windlord.stanford.edu

    }, ] ); #--------------------------- test 13 run(q{various coded <>}, [ q{B}, q{I}, q{C}, q{E}, q{F}, q{S}, q{X}, q{Z}, q{& < > " E E E E E }, ], [ q{

    BOLD

    }, q{

    ITALIC

    }, q{

    CODE

    }, q{

    &escaped;

    }, q{

    file_name

    }, q{

    Non-breaking space

    }, q{

    }, q{

    }, q{

    & < > " Ý √ ⇑ ↑ <

    }, ], ); #--------------------------- test 14 run(q{Special cases of =head}, [ q{=head1 NAME}, q{The Name of NAME}, q{=head1 simple test}, q{simple test text}, q{=head2 sub title}, q{sub title sub text}, q{=over }, q{=item foo}, q{foo text}, q{=item bar}, q{bar text}, q{=item *}, q{star}, q{=item end}, q{end text}, q{=back}, q{=head2 sub title 2}, q{sub title 2 text}, ], [ q{

    NAME

    }, q{

    The Name of NAME

    }, q{

    simple test

    }, q{

    simple test text

    }, q{

    sub title

    }, q{

    sub title sub text

    }, q{
      }, q{
    • foo
    • }, q{

      foo text

      }, q{
    • bar
    • }, q{

      bar text

      }, q{
    • star
    • }, q{
    • end
    • }, q{

      end text

      }, q{
    }, q{

    sub title 2

    }, q{

    sub title 2 text

    }, ], [ q{
  • NAME
  • }, q{
  • simple test
  • }, q{}, ], { no_css => 1, title => q{Overrides the content of =head1 NAME}, no_generator => 1, }, ); #--------------------------- test 15 run(q{Mixed non-regular =head}, [ q{=head1 head1 #1}, q{Testing head1 #1}, q{=head2 head2 #1}, q{Testing head2 #1}, q{=head1 head1 #2}, q{Testing head1 #2}, q{=head2 head2 #2}, q{Testing head2 #2}, q{=head3 head3 #1}, q{Testing head3 #1}, q{=head4 head4 #1}, q{Testing head4 #1}, q{=head1 head1 #3}, q{Testing head1 #3}, q{=head3 head3 #2}, q{Testing head3 #2}, q{=head4 head4 #2}, q{Testing head4 #2}, q{=head2 head2 #3}, q{Testing head2 #3}, q{=head1 head1 #4}, q{Testing head1 #4}, q{=head2 head2 #4}, q{Testing head2 #4}, q{=head1 head1 #5}, q{Testing head1 #5}, q{=head2 head2 #5}, q{Testing head2 #5}, ], [ q{

    head1 #1

    }, q{

    Testing head1 #1

    }, q{

    head2 #1

    }, q{

    Testing head2 #1

    }, q{

    head1 #2

    }, q{

    Testing head1 #2

    }, q{

    head2 #2

    }, q{

    Testing head2 #2

    }, q{

    head3 #1

    }, q{

    Testing head3 #1

    }, q{

    head4 #1

    }, q{

    Testing head4 #1

    }, q{

    head1 #3

    }, q{

    Testing head1 #3

    }, q{

    head3 #2

    }, q{

    Testing head3 #2

    }, q{

    head4 #2

    }, q{

    Testing head4 #2

    }, q{

    head2 #3

    }, q{

    Testing head2 #3

    }, q{

    head1 #4

    }, q{

    Testing head1 #4

    }, q{

    head2 #4

    }, q{

    Testing head2 #4

    }, q{

    head1 #5

    }, q{

    Testing head1 #5

    }, q{

    head2 #5

    }, q{

    Testing head2 #5

    }, ], [ q{
  • head1 #1
  • }, q{}, q{
  • head1 #2
  • }, q{}, q{
  • head1 #3
  • }, q{}, q{
  • head1 #4
  • }, q{}, q{
  • head1 #5
  • }, q{}, ], ); #--------------------------- test 16 run(q{Mixed =head and =item}, [ q{=head1 CONFIGURATION AND ENVIRONMENT}, q{=over}, q{=item @addpods}, q{=item $CPAN}, q{=back}, q{=head1 DIAGNOSTICS}, q{=over 4}, q{=item C<-verbose> }, q{=item Tag references more than one POD.}, q{=back}, q{=head1 SCRIPT CATEGORIES}, ], [ q{} . q{

    CONFIGURATION AND ENVIRONMENT

    }, q{
      }, q{
    • @addpods
    • }, q{
    • $CPAN
    • }, q{
    }, q{

    DIAGNOSTICS

    }, q{
      }, q{
    • -verbose
    • }, q{
    • } . q{Tag references more than one POD.
    • }, q{
    }, q{

    SCRIPT CATEGORIES

    }, ], [ q{
  • } . q{CONFIGURATION AND ENVIRONMENT
  • }, q{}, q{
  • DIAGNOSTICS
  • }, q{}, q{
  • SCRIPT CATEGORIES
  • }, ], { no_css => 1, index_item => 1, }, );