Pod-Tree-1.31/0000755000175000017500000000000013433752154012420 5ustar manwarmanwarPod-Tree-1.31/t/0000755000175000017500000000000013433752154012663 5ustar manwarmanwarPod-Tree-1.31/t/html.d/0000755000175000017500000000000013433752154014051 5ustar manwarmanwarPod-Tree-1.31/t/html.d/link.pod0000644000175000017500000000235313377746260015525 0ustar manwarmanwar=head1 NAME Links =head2 Original A L manual page. An L item in manual page. A L section in other manual page. A L<"sec"> section in this manual page (the quotes are B optional). A L< sec > section in this manual page A L section in this manual page A L link to a module POD A L section in this manual page (the quotes are optional). =head2 Total Control A L manual page. An L item in manual page. A L section in other manual page. A L section in this manual page (quotes are B optional). A L section in this manual page A L section in this manual page A L link to a module POD A L section in this manual page (quotes are optional). =head2 Targets X X X X target> =head2 Links L L<"target with spaces"> L<" target w/spaces "> L<"target with line breaks"> L B> L/I
> L L Pod-Tree-1.31/t/html.d/sequence.exp0000644000175000017500000000227313377746260016413 0ustar manwarmanwar print [-n] file

NAME

print [-n] file

DESCRIPTION

=head1 introduces a 1st level heading. print sends file to a printer. bold, italic, zero, bold, bold italic, bold normal. Non-breaking space, 0.

code, bold code, file, <, >, /, |, A, À <, >, /, |, A, À <, >, /, |, A, À

© ° ÷ ½ µ · ¬ ® ×

$a <=> $b, $a <=> $b

$foo->bar, $foo->bar ,

An page/section markup.

$a << $b, $a >> $b ;

see (?>pattern).

see No backtracking.

Italic Bold Code

Pod-Tree-1.31/t/html.d/cut.exp0000644000175000017500000000025213377746260015371 0ustar manwarmanwar POD

In pod.

POD

More in pod.

Pod-Tree-1.31/t/html.d/cut.pod0000644000175000017500000000011113377746260015351 0ustar manwarmanwarNot in pod. =pod In pod. =cut Not in pod. =head1 POD More in pod. Pod-Tree-1.31/t/html.d/empty.pod0000644000175000017500000000002713377746260015722 0ustar manwarmanwarNo POD here. __END__ Pod-Tree-1.31/t/html.d/for.pod0000644000175000017500000000060313377746260015352 0ustar manwarmanwar=pod =head1 HEAD =for html Line 1
<Line 2> =for html Steven VERBATIM VERBATIM VERBATIM Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz =for image flower.gif =begin text =head2 Not really a command VERBATIM VERBATIM VERBATIM Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz =end text =head2 Really a commmand. Pod-Tree-1.31/t/html.d/for.exp0000644000175000017500000000063313377746260015367 0ustar manwarmanwar

HEAD

Line 1
<Line 2>

Steven

	VERBATIM
	VERBATIM
	VERBATIM

Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz

Really a commmand.

Pod-Tree-1.31/t/html.d/toc.exp0000644000175000017500000000013513377746260015363 0ustar manwarmanwar Pod-Tree-1.31/t/html.d/link.exp0000644000175000017500000000452413377746260015541 0ustar manwarmanwar Links

NAME

Links

Original

A name manual page.

An name/ident item in manual page.

A name/"sec" section in other manual page.

A "sec" section in this manual page (the quotes are not optional).

A sec section in this manual page

A sec tion section in this manual page

A mod::ule.foo link to a module POD

A /"sec" section in this manual page (the quotes are optional).

Total Control

A text manual page.

An text item in manual page.

A text section in other manual page.

A text section in this manual page (quotes are not optional).

A text section in this manual page

A text section in this manual page

A text link to a module POD

A text section in this manual page (quotes are optional).

Targets

Links

/target

"target with spaces"

" target w/spaces "

"target with line breaks"

/italic target

page/section

http://world.std.com/~swmcd/steven/index.html

Steven McDougall

Pod-Tree-1.31/t/html.d/depth.exp0000644000175000017500000000461213377746260015706 0ustar manwarmanwar Links

NAME

Links

Original

A name manual page.

An name/ident item in manual page.

A name/"sec" section in other manual page.

A "sec" section in this manual page (the quotes are not optional).

A sec section in this manual page

A sec tion section in this manual page

A mod::ule.foo link to a module POD

A /"sec" section in this manual page (the quotes are optional).

Total Control

A text manual page.

An text item in manual page.

A text section in other manual page.

A text section in this manual page (quotes are not optional).

A text section in this manual page

A text section in this manual page

A text link to a module POD

A text section in this manual page (quotes are optional).

Targets

Links

/target

"target with spaces"

" target w/spaces "

"target with line breaks"

/italic target

page/section

http://world.std.com/~swmcd/steven/index.html

Steven McDougall

Pod-Tree-1.31/t/html.d/list.pod0000644000175000017500000000320313377746260015536 0ustar manwarmanwar=head1 NAME Lists =head2 Bullet =over 4 =item * foo =item * bar =item * baz =back =head2 Number =over 4 =item 1 foo =item 2 bar =item 3 baz =back =head2 Text =over 4 =item do a deer, a female deer =item ray a drop of goden sun =item me me, a name, I call myself =item fa a long, long way to run =back =over 4 =item * do a deer, a female deer =item * ray a drop of goden sun =back =over 4 =item 3 me me, a name, I call myself =item 4 fa a long, long way to run =back =head2 Siblings =over 4 =item * Star 1 Para 1 Star 1 Para 2 Star 1 Para 3 =item * Star 2 Star 2 Verbatim 1 Star 2 Verbatim 2 Star 2 Verbatim 3 =item * Star 3 =back =head2 Markups =over 4 =item term 1 definition 1 =item I C =item I> S =back =head2 Nested =over 4 =item * Level 1, Star 1 of 2 =over 4 =item * Level 2, Star 1 of 2 =item * Level 2, Star 2 of 2 =back =item * =over 4 =item 1 Level 2, Number 1 of 2 =item 2 Level 2, Number 2 of 2 =back =back =over 4 =item Level 1, term 1 of 2 =over 4 =item * Level 2, Star 1 of 3 =item * Level 2, Star 2 of 3 =item * Level 2, Star 3 of 3 =back =item Level 1, term 2 of 2 =over 4 =item * Level 2, Star 1 of 3 =over 4 =item 1 Level 3, Number 1 of 2 =item 2 Level 3, Number 2 of 2 =back =item * Level 2, Star 2 of 3 =item * Level 2, Star 3 of 3 =back =back =head2 Pathological =over 8 =item * Over 8 =back =over 4 =item * Star 1 =item 2 Number 2 =item Term 3 Definition 3 =back Empty =over 4 =back =over 4 No Items =back =over 4 =item * Star 1 =item * No =back Pod-Tree-1.31/t/html.d/paragraph.exp0000644000175000017500000000132513377746260016545 0ustar manwarmanwar Head 1 text

HEAD1

Head 1 text

HEAD2

Head2 text

    +------------------------------+
    | This is a verbatim paragraph |
    +------------------------------+


    +----------------------------------+
    | Anda nother verbatim paragraph   |
    +----------------------------------+

    +----------------------------------+
    | Stella nother verbatim paragraph |
    +----------------------------------+

HEAD3

Sub head

HEAD4

Sub sub head

Pod-Tree-1.31/t/html.d/paragraph.pod0000644000175000017500000000073413377746260016536 0ustar manwarmanwar=head1 HEAD1 Head 1 text =head2 HEADI<2> Head2 B +------------------------------+ | This is a verbatim paragraph | +------------------------------+ +----------------------------------+ | Anda nother verbatim paragraph | +----------------------------------+ +----------------------------------+ | Stella nother verbatim paragraph | +----------------------------------+ =head3 HEAD3 Sub head =head4 HEAD4 Sub sub head Pod-Tree-1.31/t/html.d/body.exp0000644000175000017500000000115313377746260015534 0ustar manwarmanwar

HEAD1

Head 1 text

HEAD2

Head2 text

    +------------------------------+
    | This is a verbatim paragraph |
    +------------------------------+


    +----------------------------------+
    | Anda nother verbatim paragraph   |
    +----------------------------------+

    +----------------------------------+
    | Stella nother verbatim paragraph |
    +----------------------------------+

HEAD3

Sub head

HEAD4

Sub sub head

Pod-Tree-1.31/t/html.d/base.exp0000644000175000017500000000460113377746260015512 0ustar manwarmanwar Links

NAME

Links

Original

A name manual page.

An name/ident item in manual page.

A name/"sec" section in other manual page.

A "sec" section in this manual page (the quotes are not optional).

A sec section in this manual page

A sec tion section in this manual page

A mod::ule.foo link to a module POD

A /"sec" section in this manual page (the quotes are optional).

Total Control

A text manual page.

An text item in manual page.

A text section in other manual page.

A text section in this manual page (quotes are not optional).

A text section in this manual page

A text section in this manual page

A text link to a module POD

A text section in this manual page (quotes are optional).

Targets

Links

/target

"target with spaces"

" target w/spaces "

"target with line breaks"

/italic target

page/section

http://world.std.com/~swmcd/steven/index.html

Steven McDougall

Pod-Tree-1.31/t/html.d/sequence.pod0000644000175000017500000000143513377746260016400 0ustar manwarmanwar=head1 NAME B [-n] I =head1 DESCRIPTION =Z<>head1 introduces a 1st level heading. B sends I to a printer. B, I, zeZ<>ro, B, bold> normal. S, C<0>. C, B>, F, X E, E, E, E, E<65>, E B, E, E, E, E<65>, E> I, E, E, E, E<65>, E>> E E E E E E E E E C<< $a <=> $b >>, C<<< $a <=> $b >>> C<< B<<< $foo->bar >>> >>, I< C<< B<<< $foo->bar >>> >> >, An C<<<< L >>>> markup. C<<< $a << $b >>>, B< C<<< $a >> $b >>> >; see Lpattern) >>>. see Lpattern)>. C>>>> Pod-Tree-1.31/t/html.d/list.exp0000644000175000017500000000473213377746260015560 0ustar manwarmanwar Lists

NAME

Lists

Bullet

  • foo
  • bar
  • baz

Number

  1. foo
  2. bar
  3. baz

Text

do
a deer, a female deer
ray
a drop of goden sun
me
me, a name, I call myself
fa
a long, long way to run
* do
a deer, a female deer
* ray
a drop of goden sun
3 me
me, a name, I call myself
4 fa
a long, long way to run

Siblings

  • Star 1 Para 1

    Star 1 Para 2

    Star 1 Para 3

  • Star 2

    	Star 2 Verbatim 1
    	Star 2 Verbatim 2
    	Star 2 Verbatim 3
  • Star 3

Markups

term 1
definition 1
term 2
definition 2
term 3
definition 3

Nested

  • Level 1, Star 1 of 2

    • Level 2, Star 1 of 2
    • Level 2, Star 2 of 2
    1. Level 2, Number 1 of 2
    2. Level 2, Number 2 of 2
Level 1, term 1 of 2
  • Level 2, Star 1 of 3
  • Level 2, Star 2 of 3
  • Level 2, Star 3 of 3
Level 1, term 2 of 2
  • Level 2, Star 1 of 3

    1. Level 3, Number 1 of 2
    2. Level 3, Number 2 of 2
  • Level 2, Star 2 of 3
  • Level 2, Star 3 of 3

Pathological

  • Over 8
  • Star 1
  • Number 2
  • Term 3
    Definition 3

Empty

No Items

  • Star 1
  • No =back
Pod-Tree-1.31/t/94-version.t0000644000175000017500000000051513377746260015000 0ustar manwarmanwaruse 5.006; use strict; use warnings; use Test::More; ## no critic eval q{use Test::Version 1.003001 qw( version_all_ok ), { is_strict => 1, has_version => 1, consistent => 1, }; }; plan skip_all => "Test::Version 1.003001 required for testing version numbers" if $@; version_all_ok(); done_testing; Pod-Tree-1.31/t/option.d/0000755000175000017500000000000013433752154014415 5ustar manwarmanwarPod-Tree-1.31/t/option.d/hr0.exp0000644000175000017500000000165013377746260015636 0ustar manwarmanwar ether bunny

Level 1, ether

ether bunny

Level 1, anda

anda nother ether bunny

Level 2, stella

stella nother ether bunny

Level 2, consumption

consumption be done about all these ether bunnys?

Level 1, wham

WHAM! Big truck run over all the ether bunnys

Pod-Tree-1.31/t/option.d/hr3.exp0000644000175000017500000000170113377746260015636 0ustar manwarmanwar ether bunny

Level 1, ether

ether bunny


Level 1, anda

anda nother ether bunny


Level 2, stella

stella nother ether bunny


Level 2, consumption

consumption be done about all these ether bunnys?


Level 1, wham

WHAM! Big truck run over all the ether bunnys

Pod-Tree-1.31/t/option.d/base.pod0000644000175000017500000000012113377746260016035 0ustar manwarmanwar=head1 See also L L L L<"frag"> L L<> Pod-Tree-1.31/t/option.d/toc1.exp0000644000175000017500000000165513377746260016020 0ustar manwarmanwar ether bunny

Level 1, ether

ether bunny

Level 1, anda

anda nother ether bunny

Level 2, stella

stella nother ether bunny

Level 2, consumption

consumption be done about all these ether bunnys?

Level 1, wham

WHAM! Big truck run over all the ether bunnys

Pod-Tree-1.31/t/option.d/hr2.exp0000644000175000017500000000166713377746260015650 0ustar manwarmanwar ether bunny

Level 1, ether

ether bunny


Level 1, anda

anda nother ether bunny

Level 2, stella

stella nother ether bunny

Level 2, consumption

consumption be done about all these ether bunnys?


Level 1, wham

WHAM! Big truck run over all the ether bunnys

Pod-Tree-1.31/t/option.d/toc0.exp0000644000175000017500000000116013377746260016006 0ustar manwarmanwar ether bunny

Level 1, ether

ether bunny

Level 1, anda

anda nother ether bunny

Level 2, stella

stella nother ether bunny

Level 2, consumption

consumption be done about all these ether bunnys?

Level 1, wham

WHAM! Big truck run over all the ether bunnys

Pod-Tree-1.31/t/option.d/baseD.exp0000644000175000017500000000075113377746260016164 0ustar manwarmanwar page

See also

page

page/frag

page/"frag"

"frag"

/frag

Pod-Tree-1.31/t/option.d/hr1.exp0000644000175000017500000000165513377746260015644 0ustar manwarmanwar ether bunny

Level 1, ether

ether bunny

Level 1, anda

anda nother ether bunny

Level 2, stella

stella nother ether bunny

Level 2, consumption

consumption be done about all these ether bunnys?

Level 1, wham

WHAM! Big truck run over all the ether bunnys

Pod-Tree-1.31/t/option.d/toc.pod0000644000175000017500000000043313377746260015716 0ustar manwarmanwar=head1 Level 1, ether ether bunny =head1 Level 1, anda anda nother ether bunny =head2 Level 2, stella stella nother ether bunny =head2 Level 2, consumption consumption be done about all these ether bunnys? =head1 Level 1, wham WHAM! Big truck run over all the ether bunnys Pod-Tree-1.31/t/option.d/hr.pod0000644000175000017500000000043313377746260015542 0ustar manwarmanwar=head1 Level 1, ether ether bunny =head1 Level 1, anda anda nother ether bunny =head2 Level 2, stella stella nother ether bunny =head2 Level 2, consumption consumption be done about all these ether bunnys? =head1 Level 1, wham WHAM! Big truck run over all the ether bunnys Pod-Tree-1.31/t/option.d/baseU.exp0000644000175000017500000000070313377746260016202 0ustar manwarmanwar page

See also

page

page/frag

page/"frag"

"frag"

/frag

Pod-Tree-1.31/t/00-compile.t0000644000175000017500000000036213377746260014726 0ustar manwarmanwaruse 5.006; use strict; use warnings; use Test::Compile; my @scripts = qw(mod2html podtree2html pods2html perl2html); my $test = Test::Compile->new(); $test->all_files_ok(); $test->pl_file_compiles($_) for @scripts; $test->done_testing(); Pod-Tree-1.31/t/14-option.t0000644000175000017500000000160013377746260014607 0ustar manwarmanwaruse 5.006; use strict; use warnings; use HTML::Stream; use Path::Tiny qw(path); use Test::More tests => 8; use Pod::Tree; use Pod::Tree::HTML; Option( "toc", 0, 0 ); Option( "toc", 1, 1 ); Option( "hr", 0, 0 ); Option( "hr", 1, 1 ); Option( "hr", 2, 2 ); Option( "hr", 3, 3 ); Option( "base", "U" ); Option( "base", "D", "http://www.site.com/dir/" ); sub Option { my ( $option, $suffix, $value ) = @_; my $dir = "t/option.d"; my $tree = Pod::Tree->new; my $pod = "$dir/$option.pod"; $tree->load_file($pod) or die "Can't load $pod: $!\n"; my $actual = ''; my $html = Pod::Tree::HTML->new( $tree, \$actual ); $html->set_options( $option => $value ); $html->translate; my $expected = path("$dir/$option$suffix.exp")->slurp; is $actual, $expected; path("$dir/$option$suffix.act")->spew($actual); # WriteFile("$ENV{HOME}/public_html/pod/$option$suffix.html", $actual); } Pod-Tree-1.31/t/tree.d/0000755000175000017500000000000013433752154014044 5ustar manwarmanwarPod-Tree-1.31/t/tree.d/link.pod0000644000175000017500000000244613377746260015523 0ustar manwarmanwar=head1 NAME Links =head2 Original A L manual page. An L item in manual page. A L section in other manual page. A L<"sec"> section in this manual page (the quotes are B optional). A L< sec > section in this manual page A L section in this manual page A L link to a module POD A L section in this manual page (the quotes are optional). =head2 Total Control A L manual page. An L item in manual page. A L section in other manual page. A L section in this manual page (quotes are B optional). A L section in this manual page A L section in this manual page A L link to a module POD A L section in this manual page (quotes are optional). =head2 Targets X X X X target> =head2 Links L L<"target with spaces"> L<" target w/spaces "> L<"target with line breaks"> L B> L/I
> L This probably won't do what you want L L Pod-Tree-1.31/t/tree.d/sequence.exp0000644000175000017500000000574713377746260016417 0ustar manwarmanwarROOT { COMMAND head1 { TEXT NAME } ORDINARY { SEQUENCE B { TEXT print } TEXT [-n] SEQUENCE I { TEXT file } TEXT } COMMAND head1 { TEXT DESCRIPTION } ORDINARY { TEXT =head1 introduces a 1st level heading. SEQUENCE B { TEXT print } TEXT sends SEQUENCE I { TEXT file } TEXT to a printer. SEQUENCE B { TEXT bold } TEXT , SEQUENCE I { TEXT italic } TEXT , zero, SEQUENCE B { TEXT bold, SEQUENCE I { TEXT bold italic } TEXT , bold } TEXT normal. SEQUENCE S { TEXT Non-breaking space } TEXT , SEQUENCE C { TEXT 0 } TEXT . } ORDINARY { SEQUENCE C { TEXT code } TEXT , SEQUENCE B { TEXT bold SEQUENCE C { TEXT code } } TEXT , SEQUENCE F { TEXT file } TEXT , SEQUENCE X { TEXT index } TEXT <, >, /, |, A, \xc0 SEQUENCE B { TEXT <, >, /, |, A, \xc0 } TEXT SEQUENCE I { SEQUENCE B { TEXT <, >, /, |, A, \xc0 } } TEXT } ORDINARY { TEXT \xa9 \xb0 \xf7 \xbd \xb5 \xb7 \xac \xae \xd7 } ORDINARY { SEQUENCE C { TEXT $a <=> $b } TEXT , SEQUENCE C { TEXT $a <=> $b } TEXT } ORDINARY { SEQUENCE C { SEQUENCE B { TEXT $foo->bar } } TEXT , SEQUENCE I { TEXT SEQUENCE C { SEQUENCE B { TEXT $foo->bar } } TEXT } TEXT , } ORDINARY { TEXT An SEQUENCE C { SEQUENCE L page / section { TEXT page/section } } TEXT markup. } ORDINARY { SEQUENCE C { TEXT $a << $b } TEXT , SEQUENCE B { TEXT SEQUENCE C { TEXT $a >> $b } TEXT } TEXT ; } ORDINARY { TEXT see SEQUENCE L / (?>pattern) { SEQUENCE C { TEXT (?>pattern) } } TEXT . } ORDINARY { TEXT see SEQUENCE L / (?>pattern) { TEXT No backtracking } TEXT . } ORDINARY { SEQUENCE C { SEQUENCE B { SEQUENCE I { TEXT Italic Bold Code } } } TEXT } } Pod-Tree-1.31/t/tree.d/cut.exp0000644000175000017500000000043213377746260015364 0ustar manwarmanwarROOT { CODE { Not in pod. } COMMAND pod { } ORDINARY { TEXT In pod. } COMMAND cut { } CODE { Not in pod. } COMMAND head1 { TEXT POD } ORDINARY { TEXT More in pod. } } Pod-Tree-1.31/t/tree.d/cut.pod0000644000175000017500000000011113377746260015344 0ustar manwarmanwarNot in pod. =pod In pod. =cut Not in pod. =head1 POD More in pod. Pod-Tree-1.31/t/tree.d/empty.pod0000644000175000017500000000000013377746260015704 0ustar manwarmanwarPod-Tree-1.31/t/tree.d/for.pod0000644000175000017500000000055413377746260015352 0ustar manwarmanwar=pod =head1 HEAD =for html Line 1
<Line 2> =for html Steven VERBATIM VERBATIM VERBATIM Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz =begin text =head2 Not really a command VERBATIM VERBATIM VERBATIM Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz =end text =head2 Really a commmand. Pod-Tree-1.31/t/tree.d/for.exp0000644000175000017500000000106313377746260015360 0ustar manwarmanwarROOT { COMMAND pod { } COMMAND head1 { TEXT HEAD } FOR html Line 1
<Line 2> FOR html Steven VERBATIM VERBATIM VERBATIM VERBATIM ORDINARY { TEXT Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz } FOR text =head2 Not really a command VERBATIM VERBATIM VERBATIM Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz COMMAND head2 { TEXT Really a commmand. } } Pod-Tree-1.31/t/tree.d/link.exp0000644000175000017500000001120513377746260015526 0ustar manwarmanwarROOT { COMMAND head1 { TEXT NAME } ORDINARY { TEXT Links } COMMAND head2 { TEXT Original } ORDINARY { TEXT A SEQUENCE L name / { TEXT name } TEXT manual page. } ORDINARY { TEXT An SEQUENCE L name / ident { TEXT name/ident } TEXT item in manual page. } ORDINARY { TEXT A SEQUENCE L name / sec { TEXT name/"sec" } TEXT section in other manual page. } ORDINARY { TEXT A SEQUENCE L / sec { TEXT "sec" } TEXT section in this manual page (the quotes are SEQUENCE B { TEXT not } TEXT optional). } ORDINARY { TEXT A SEQUENCE L / sec { TEXT sec } TEXT section in this manual page } ORDINARY { TEXT A SEQUENCE L / sec tion { TEXT sec tion } TEXT section in this manual page } ORDINARY { TEXT A SEQUENCE L mod::ule.foo / { TEXT mod::ule.foo } TEXT link to a module POD } ORDINARY { TEXT A SEQUENCE L / sec { TEXT /"sec" } TEXT section in this manual page (the quotes are optional). } COMMAND head2 { TEXT Total Control } ORDINARY { TEXT A SEQUENCE L name / { TEXT text } TEXT manual page. } ORDINARY { TEXT An SEQUENCE L name / ident { TEXT text } TEXT item in manual page. } ORDINARY { TEXT A SEQUENCE L name / sec { TEXT text } TEXT section in other manual page. } ORDINARY { TEXT A SEQUENCE L / sec { TEXT text } TEXT section in this manual page (quotes are SEQUENCE B { TEXT not } TEXT optional). } ORDINARY { TEXT A SEQUENCE L / sec { TEXT text } TEXT section in this manual page } ORDINARY { TEXT A SEQUENCE L / sec tion { TEXT text } TEXT section in this manual page } ORDINARY { TEXT A SEQUENCE L bar-mod::ule / { TEXT text } TEXT link to a module POD } ORDINARY { TEXT A SEQUENCE L / sec { TEXT text } TEXT section in this manual page (quotes are optional). } COMMAND head2 { TEXT Targets } ORDINARY { SEQUENCE X { TEXT target } TEXT } ORDINARY { SEQUENCE X { TEXT target with spaces } TEXT } ORDINARY { SEQUENCE X { TEXT target w/spaces } TEXT } ORDINARY { SEQUENCE X { SEQUENCE I { TEXT italic } TEXT target } TEXT } COMMAND head2 { TEXT Links } ORDINARY { SEQUENCE L / target { TEXT /target } TEXT } ORDINARY { SEQUENCE L / target with spaces { TEXT "target with spaces" } TEXT } ORDINARY { SEQUENCE L / target w/spaces { TEXT " target w/spaces " } TEXT } ORDINARY { SEQUENCE L / target with line breaks { TEXT "target with line breaks" } TEXT } ORDINARY { SEQUENCE L / italic target { TEXT / SEQUENCE I { TEXT italic } TEXT SEQUENCE B { TEXT target } } TEXT } ORDINARY { SEQUENCE L page / section { SEQUENCE I { TEXT page } TEXT / SEQUENCE I { TEXT section } } TEXT } ORDINARY { SEQUENCE L / c|foo.html { TEXT target } TEXT This probably won't do what you want } ORDINARY { SEQUENCE L http://world.std.com/~swmcd/steven/index.html / { TEXT http://world.std.com/~swmcd/steven/index.html } TEXT } ORDINARY { SEQUENCE L http://world.std.com/~swmcd/steven/index.html / { TEXT Steven McDougall } TEXT } } Pod-Tree-1.31/t/tree.d/list.pod0000644000175000017500000000320313377746260015531 0ustar manwarmanwar=head1 NAME Lists =head2 Bullet =over 4 =item * foo =item * bar =item * baz =back =head2 Number =over 4 =item 1 foo =item 2 bar =item 3 baz =back =head2 Text =over 4 =item do a deer, a female deer =item ray a drop of goden sun =item me me, a name, I call myself =item fa a long, long way to run =back =over 4 =item * do a deer, a female deer =item * ray a drop of goden sun =back =over 4 =item 3 me me, a name, I call myself =item 4 fa a long, long way to run =back =head2 Siblings =over 4 =item * Star 1 Para 1 Star 1 Para 2 Star 1 Para 3 =item * Star 2 Star 2 Verbatim 1 Star 2 Verbatim 2 Star 2 Verbatim 3 =item * Star 3 =back =head2 Markups =over 4 =item term 1 definition 1 =item I C =item I> S =back =head2 Nested =over 4 =item * Level 1, Star 1 of 2 =over 4 =item * Level 2, Star 1 of 2 =item * Level 2, Star 2 of 2 =back =item * =over 4 =item 1 Level 2, Number 1 of 2 =item 2 Level 2, Number 2 of 2 =back =back =over 4 =item Level 1, term 1 of 2 =over 4 =item * Level 2, Star 1 of 3 =item * Level 2, Star 2 of 3 =item * Level 2, Star 3 of 3 =back =item Level 1, term 2 of 2 =over 4 =item * Level 2, Star 1 of 3 =over 4 =item 1 Level 3, Number 1 of 2 =item 2 Level 3, Number 2 of 2 =back =item * Level 2, Star 2 of 3 =item * Level 2, Star 3 of 3 =back =back =head2 Pathological =over 8 =item * Over 8 =back =over 4 =item * Star 1 =item 2 Number 2 =item Term 3 Definition 3 =back Empty =over 4 =back =over 4 No Items =back =over 4 =item * Star 1 =item * No =back Pod-Tree-1.31/t/tree.d/paragraph.exp0000644000175000017500000000067513377746260016547 0ustar manwarmanwarROOT { COMMAND head1 { TEXT HEAD1 } ORDINARY { TEXT Head 1 text } COMMAND head2 { TEXT HEAD SEQUENCE I { TEXT 2 } TEXT } ORDINARY { TEXT Head2 SEQUENCE B { TEXT text } TEXT } VERBATIM +------------------------------+ | This is a verbatim paragraph | +------------------------------+ } Pod-Tree-1.31/t/tree.d/paragraph.pod0000644000175000017500000000025313377746260016525 0ustar manwarmanwar=head1 HEAD1 Head 1 text =head2 HEADI<2> Head2 B +------------------------------+ | This is a verbatim paragraph | +------------------------------+ Pod-Tree-1.31/t/tree.d/sequence.pod0000644000175000017500000000143513377746260016373 0ustar manwarmanwar=head1 NAME B [-n] I =head1 DESCRIPTION =Z<>head1 introduces a 1st level heading. B sends I to a printer. B, I, zeZ<>ro, B, bold> normal. S, C<0>. C, B>, F, X E, E, E, E, E<65>, E B, E, E, E, E<65>, E> I, E, E, E, E<65>, E>> E E E E E E E E E C<< $a <=> $b >>, C<<< $a <=> $b >>> C<< B<<< $foo->bar >>> >>, I< C<< B<<< $foo->bar >>> >> >, An C<<<< L >>>> markup. C<<< $a << $b >>>, B< C<<< $a >> $b >>> >; see Lpattern) >>>. see Lpattern)>. C>>>> Pod-Tree-1.31/t/tree.d/code.pm0000644000175000017500000000073113377746260015325 0ustar manwarmanwar#!/usr/local/bin/perl use 5.006; use strict; use warnings; my @entries; my %entry; while (<>) { /^##/ and next; m(^//) and do { push @entries, {%entry}; %entry = (); next; }; chomp; my ( $key, $val ) = split ' ', $_, 2; $key or next; $entry{$key} = $val; } @entries = sort { $a->{GENOME_SIZE} <=> $b->{GENOME_SIZE} } @entries; for my $entry (@entries) { my @vals = map { $entry->{$_} } qw(COMMON_NAME GENOME_SIZE); printf "%-40s %12.f\n", @vals; } Pod-Tree-1.31/t/tree.d/list.exp0000644000175000017500000002025113377746260015545 0ustar manwarmanwarROOT { COMMAND head1 { TEXT NAME } ORDINARY { TEXT Lists } COMMAND head2 { TEXT Bullet } LIST BULLET { ITEM BULLET { TEXT * } [ ORDINARY { TEXT foo } ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT bar } ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT baz } ] } COMMAND head2 { TEXT Number } LIST NUMBER { ITEM NUMBER { TEXT 1 } [ ORDINARY { TEXT foo } ] ITEM NUMBER { TEXT 2 } [ ORDINARY { TEXT bar } ] ITEM NUMBER { TEXT 3 } [ ORDINARY { TEXT baz } ] } COMMAND head2 { TEXT Text } LIST TEXT { ITEM TEXT { TEXT do } [ ORDINARY { TEXT a deer, a female deer } ] ITEM TEXT { TEXT ray } [ ORDINARY { TEXT a drop of goden sun } ] ITEM TEXT { TEXT me } [ ORDINARY { TEXT me, a name, I call myself } ] ITEM TEXT { TEXT fa } [ ORDINARY { TEXT a long, long way to run } ] } LIST TEXT { ITEM TEXT { TEXT * do } [ ORDINARY { TEXT a deer, a female deer } ] ITEM TEXT { TEXT * ray } [ ORDINARY { TEXT a drop of goden sun } ] } LIST TEXT { ITEM TEXT { TEXT 3 me } [ ORDINARY { TEXT me, a name, I call myself } ] ITEM TEXT { TEXT 4 fa } [ ORDINARY { TEXT a long, long way to run } ] } COMMAND head2 { TEXT Siblings } LIST BULLET { ITEM BULLET { TEXT * } [ ORDINARY { TEXT Star 1 Para 1 } ORDINARY { TEXT Star 1 Para 2 } ORDINARY { TEXT Star 1 Para 3 } ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT Star 2 } VERBATIM Star 2 Verbatim 1 Star 2 Verbatim 2 Star 2 Verbatim 3 ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT Star 3 } ] } COMMAND head2 { TEXT Markups } LIST TEXT { ITEM TEXT { TEXT term 1 } [ ORDINARY { TEXT definition 1 } ] ITEM TEXT { SEQUENCE I { TEXT term 2 } TEXT } [ ORDINARY { SEQUENCE C { TEXT definition 2 } TEXT } ] ITEM TEXT { SEQUENCE I { TEXT term SEQUENCE B { TEXT 3 } } TEXT } [ ORDINARY { SEQUENCE S { TEXT definition 3 } TEXT } ] } COMMAND head2 { TEXT Nested } LIST BULLET { ITEM BULLET { TEXT * } [ ORDINARY { TEXT Level 1, Star 1 of 2 } LIST BULLET { ITEM BULLET { TEXT * } [ ORDINARY { TEXT Level 2, Star 1 of 2 } ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT Level 2, Star 2 of 2 } ] } ] ITEM BULLET { TEXT * } [ LIST NUMBER { ITEM NUMBER { TEXT 1 } [ ORDINARY { TEXT Level 2, Number 1 of 2 } ] ITEM NUMBER { TEXT 2 } [ ORDINARY { TEXT Level 2, Number 2 of 2 } ] } ] } LIST TEXT { ITEM TEXT { TEXT Level 1, term 1 of 2 } [ LIST BULLET { ITEM BULLET { TEXT * } [ ORDINARY { TEXT Level 2, Star 1 of 3 } ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT Level 2, Star 2 of 3 } ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT Level 2, Star 3 of 3 } ] } ] ITEM TEXT { TEXT Level 1, term 2 of 2 } [ LIST BULLET { ITEM BULLET { TEXT * } [ ORDINARY { TEXT Level 2, Star 1 of 3 } LIST NUMBER { ITEM NUMBER { TEXT 1 } [ ORDINARY { TEXT Level 3, Number 1 of 2 } ] ITEM NUMBER { TEXT 2 } [ ORDINARY { TEXT Level 3, Number 2 of 2 } ] } ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT Level 2, Star 2 of 3 } ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT Level 2, Star 3 of 3 } ] } ] } COMMAND head2 { TEXT Pathological } LIST BULLET { ITEM BULLET { TEXT * } [ ORDINARY { TEXT Over 8 } ] } LIST BULLET { ITEM BULLET { TEXT * } [ ORDINARY { TEXT Star 1 } ] ITEM NUMBER { TEXT 2 } [ ORDINARY { TEXT Number 2 } ] ITEM TEXT { TEXT Term 3 } [ ORDINARY { TEXT Definition 3 } ] } ORDINARY { TEXT Empty } LIST { } LIST { ORDINARY { TEXT No Items } } LIST BULLET { ITEM BULLET { TEXT * } [ ORDINARY { TEXT Star 1 } ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT No =back } ] } } Pod-Tree-1.31/t/mapper.d/0000755000175000017500000000000013433752154014371 5ustar manwarmanwarPod-Tree-1.31/t/mapper.d/link.pod0000644000175000017500000000235313377746260016045 0ustar manwarmanwar=head1 NAME Links =head2 Original A L manual page. An L item in manual page. A L section in other manual page. A L<"sec"> section in this manual page (the quotes are B optional). A L< sec > section in this manual page A L section in this manual page A L link to a module POD A L section in this manual page (the quotes are optional). =head2 Total Control A L manual page. An L item in manual page. A L section in other manual page. A L section in this manual page (quotes are B optional). A L section in this manual page A L section in this manual page A L link to a module POD A L section in this manual page (quotes are optional). =head2 Targets X X X X target> =head2 Links L L<"target with spaces"> L<" target w/spaces "> L<"target with line breaks"> L B> L/I
> L L Pod-Tree-1.31/t/mapper.d/sequence.exp0000644000175000017500000000227313377746260016733 0ustar manwarmanwar print [-n] file

NAME

print [-n] file

DESCRIPTION

=head1 introduces a 1st level heading. print sends file to a printer. bold, italic, zero, bold, bold italic, bold normal. Non-breaking space, 0.

code, bold code, file, <, >, /, |, A, À <, >, /, |, A, À <, >, /, |, A, À

© ° ÷ ½ µ · ¬ ® ×

$a <=> $b, $a <=> $b

$foo->bar, $foo->bar ,

An page/section markup.

$a << $b, $a >> $b ;

see (?>pattern).

see No backtracking.

Italic Bold Code

Pod-Tree-1.31/t/mapper.d/cut.exp0000644000175000017500000000025213377746260015711 0ustar manwarmanwar POD

In pod.

POD

More in pod.

Pod-Tree-1.31/t/mapper.d/cut.pod0000644000175000017500000000011113377746260015671 0ustar manwarmanwarNot in pod. =pod In pod. =cut Not in pod. =head1 POD More in pod. Pod-Tree-1.31/t/mapper.d/for.pod0000644000175000017500000000060313377746260015672 0ustar manwarmanwar=pod =head1 HEAD =for html Line 1
<Line 2> =for html Steven VERBATIM VERBATIM VERBATIM Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz =for image flower.gif =begin text =head2 Not really a command VERBATIM VERBATIM VERBATIM Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz =end text =head2 Really a commmand. Pod-Tree-1.31/t/mapper.d/for.exp0000644000175000017500000000063313377746260015707 0ustar manwarmanwar

HEAD

Line 1
<Line 2>

Steven

	VERBATIM
	VERBATIM
	VERBATIM

Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz

Really a commmand.

Pod-Tree-1.31/t/mapper.d/link.exp0000644000175000017500000000452413377746260016061 0ustar manwarmanwar Links

NAME

Links

Original

A name manual page.

An name/ident item in manual page.

A name/"sec" section in other manual page.

A "sec" section in this manual page (the quotes are not optional).

A sec section in this manual page

A sec tion section in this manual page

A mod::ule.foo link to a module POD

A /"sec" section in this manual page (the quotes are optional).

Total Control

A text manual page.

An text item in manual page.

A text section in other manual page.

A text section in this manual page (quotes are not optional).

A text section in this manual page

A text section in this manual page

A text link to a module POD

A text section in this manual page (quotes are optional).

Targets

Links

/target

"target with spaces"

" target w/spaces "

"target with line breaks"

/italic target

page/section

http://world.std.com/~swmcd/steven/index.html

Steven McDougall

Pod-Tree-1.31/t/mapper.d/list.pod0000644000175000017500000000320313377746260016056 0ustar manwarmanwar=head1 NAME Lists =head2 Bullet =over 4 =item * foo =item * bar =item * baz =back =head2 Number =over 4 =item 1 foo =item 2 bar =item 3 baz =back =head2 Text =over 4 =item do a deer, a female deer =item ray a drop of goden sun =item me me, a name, I call myself =item fa a long, long way to run =back =over 4 =item * do a deer, a female deer =item * ray a drop of goden sun =back =over 4 =item 3 me me, a name, I call myself =item 4 fa a long, long way to run =back =head2 Siblings =over 4 =item * Star 1 Para 1 Star 1 Para 2 Star 1 Para 3 =item * Star 2 Star 2 Verbatim 1 Star 2 Verbatim 2 Star 2 Verbatim 3 =item * Star 3 =back =head2 Markups =over 4 =item term 1 definition 1 =item I C =item I> S =back =head2 Nested =over 4 =item * Level 1, Star 1 of 2 =over 4 =item * Level 2, Star 1 of 2 =item * Level 2, Star 2 of 2 =back =item * =over 4 =item 1 Level 2, Number 1 of 2 =item 2 Level 2, Number 2 of 2 =back =back =over 4 =item Level 1, term 1 of 2 =over 4 =item * Level 2, Star 1 of 3 =item * Level 2, Star 2 of 3 =item * Level 2, Star 3 of 3 =back =item Level 1, term 2 of 2 =over 4 =item * Level 2, Star 1 of 3 =over 4 =item 1 Level 3, Number 1 of 2 =item 2 Level 3, Number 2 of 2 =back =item * Level 2, Star 2 of 3 =item * Level 2, Star 3 of 3 =back =back =head2 Pathological =over 8 =item * Over 8 =back =over 4 =item * Star 1 =item 2 Number 2 =item Term 3 Definition 3 =back Empty =over 4 =back =over 4 No Items =back =over 4 =item * Star 1 =item * No =back Pod-Tree-1.31/t/mapper.d/paragraph.exp0000644000175000017500000000054613377746260017071 0ustar manwarmanwar Head 1 text

HEAD1

Head 1 text

HEAD2

Head2 text

    +------------------------------+
    | This is a verbatim paragraph |
    +------------------------------+
Pod-Tree-1.31/t/mapper.d/paragraph.pod0000644000175000017500000000025313377746260017052 0ustar manwarmanwar=head1 HEAD1 Head 1 text =head2 HEADI<2> Head2 B +------------------------------+ | This is a verbatim paragraph | +------------------------------+ Pod-Tree-1.31/t/mapper.d/sequence.pod0000644000175000017500000000143513377746260016720 0ustar manwarmanwar=head1 NAME B [-n] I =head1 DESCRIPTION =Z<>head1 introduces a 1st level heading. B sends I to a printer. B, I, zeZ<>ro, B, bold> normal. S, C<0>. C, B>, F, X E, E, E, E, E<65>, E B, E, E, E, E<65>, E> I, E, E, E, E<65>, E>> E E E E E E E E E C<< $a <=> $b >>, C<<< $a <=> $b >>> C<< B<<< $foo->bar >>> >>, I< C<< B<<< $foo->bar >>> >> >, An C<<<< L >>>> markup. C<<< $a << $b >>>, B< C<<< $a >> $b >>> >; see Lpattern) >>>. see Lpattern)>. C>>>> Pod-Tree-1.31/t/mapper.d/list.exp0000644000175000017500000000473213377746260016100 0ustar manwarmanwar Lists

NAME

Lists

Bullet

  • foo
  • bar
  • baz

Number

  1. foo
  2. bar
  3. baz

Text

do
a deer, a female deer
ray
a drop of goden sun
me
me, a name, I call myself
fa
a long, long way to run
* do
a deer, a female deer
* ray
a drop of goden sun
3 me
me, a name, I call myself
4 fa
a long, long way to run

Siblings

  • Star 1 Para 1

    Star 1 Para 2

    Star 1 Para 3

  • Star 2

    	Star 2 Verbatim 1
    	Star 2 Verbatim 2
    	Star 2 Verbatim 3
  • Star 3

Markups

term 1
definition 1
term 2
definition 2
term 3
definition 3

Nested

  • Level 1, Star 1 of 2

    • Level 2, Star 1 of 2
    • Level 2, Star 2 of 2
    1. Level 2, Number 1 of 2
    2. Level 2, Number 2 of 2
Level 1, term 1 of 2
  • Level 2, Star 1 of 3
  • Level 2, Star 2 of 3
  • Level 2, Star 3 of 3
Level 1, term 2 of 2
  • Level 2, Star 1 of 3

    1. Level 3, Number 1 of 2
    2. Level 3, Number 2 of 2
  • Level 2, Star 2 of 3
  • Level 2, Star 3 of 3

Pathological

  • Over 8
  • Star 1
  • Number 2
  • Term 3
    Definition 3

Empty

No Items

  • Star 1
  • No =back
Pod-Tree-1.31/t/17-pods2html.t0000644000175000017500000000524413377746260015226 0ustar manwarmanwaruse 5.006; use strict; use warnings; use Config; use File::Path; use Test::More tests => 8; my $dir = "t/pods2html.d"; Simple($dir); Empty($dir); Subdir($dir); Recurse($dir); sub Simple { my $d = shift; my $pods2html = "blib/script/pods2html"; my $template = "$d/template.txt"; my $values = "$d/values.pl"; rmtree("$d/html_act"); system "$Config{perlpath} $pods2html $d/pod $d/html_act"; ok !RDiff( "$d/html_exp", "$d/html_act" ); rmtree("$d/html_act_t"); system "$Config{perlpath} $pods2html --variables $values $d/pod $d/html_act_t $template"; ok !RDiff( "$d/html_exp_t", "$d/html_act_t" ); rmtree("$d/html_act_tv"); system "$Config{perlpath} $pods2html --variables $values $d/pod $d/html_act_tv $template color=red"; ok !RDiff( "$d/html_exp_tv", "$d/html_act_tv" ); } sub Empty { my $d = shift; rmtree("$d/html_act"); system "$Config{perlpath} blib/script/pods2html $d/pod $d/html_act"; ok !RDiff( "$d/html_exp", "$d/html_act" ); rmtree("$d/html_act"); system "$Config{perlpath} blib/script/pods2html --empty $d/pod $d/html_act"; ok !RDiff( "$d/empty_exp", "$d/html_act" ); } sub Subdir { my $d = shift; rmtree("$d/A"); system "$Config{perlpath} blib/script/pods2html $d/pod $d/A/B/C"; ok !RDiff( "$d/html_exp", "$d/A/B/C" ); } sub Recurse { my $d = shift; my $pods2html = "blib/script/pods2html"; rmtree("$d/podR/HTML"); system "$Config{perlpath} blib/script/pods2html $d/podR $d/podR/HTML"; ok !RDiff( "$d/podR_exp", "$d/podR" ); system "$Config{perlpath} blib/script/pods2html $d/podR $d/podR/HTML"; ok !RDiff( "$d/podR_exp", "$d/podR" ); } sub RDiff # Recursive subdirectory comparison { my ( $a, $b ) = @_; eval { DirCmp( $a, $b ) }; print STDERR $@; $@; } sub DirCmp { my ( $a, $b ) = @_; my @a = Names($a); my @b = Names($b); ListCmp( \@a, \@b ) and die "Different names: $a $b\n"; @a = map {"$a/$_"} @a; @b = map {"$b/$_"} @b; for ( @a, @b ) { -f or -d or die "bad type: $_\n" } while ( @a and @b ) { $a = shift @a; $b = shift @b; -f $a and -f $b and FileCmp( $a, $b ) and return "$a ne $b"; -d $a and -d $b and DirCmp( $a, $b ); -f $a and -d $b or -d $a and -f $b and return "type mismatch: $a $b"; } ''; } sub Names { my $dir = shift; opendir DIR, $dir or die "Can't opendir $dir: $!\n"; my @names = grep { not m(^\.) and $_ ne 'CVS' } readdir(DIR); closedir DIR; sort @names; } sub ListCmp { my ( $a, $b ) = @_; @$a == @$b or return 1; for ( my $i = 0; $i < @$a; $i++ ) { $a->[$i] eq $b->[$i] or return 1; } 0; } sub FileCmp { my ( $x, $y ) = @_; local $/ = undef; open my $fx, '<', $x or die "Can't open $x: $!\n"; open my $fy, '<', $y or die "Can't open $y: $!\n"; return <$fx> ne <$fy>; } Pod-Tree-1.31/t/load.d/0000755000175000017500000000000013433752154014024 5ustar manwarmanwarPod-Tree-1.31/t/load.d/list.pod0000644000175000017500000000320313377746260015511 0ustar manwarmanwar=head1 NAME Lists =head2 Bullet =over 4 =item * foo =item * bar =item * baz =back =head2 Number =over 4 =item 1 foo =item 2 bar =item 3 baz =back =head2 Text =over 4 =item do a deer, a female deer =item ray a drop of goden sun =item me me, a name, I call myself =item fa a long, long way to run =back =over 4 =item * do a deer, a female deer =item * ray a drop of goden sun =back =over 4 =item 3 me me, a name, I call myself =item 4 fa a long, long way to run =back =head2 Siblings =over 4 =item * Star 1 Para 1 Star 1 Para 2 Star 1 Para 3 =item * Star 2 Star 2 Verbatim 1 Star 2 Verbatim 2 Star 2 Verbatim 3 =item * Star 3 =back =head2 Markups =over 4 =item term 1 definition 1 =item I C =item I> S =back =head2 Nested =over 4 =item * Level 1, Star 1 of 2 =over 4 =item * Level 2, Star 1 of 2 =item * Level 2, Star 2 of 2 =back =item * =over 4 =item 1 Level 2, Number 1 of 2 =item 2 Level 2, Number 2 of 2 =back =back =over 4 =item Level 1, term 1 of 2 =over 4 =item * Level 2, Star 1 of 3 =item * Level 2, Star 2 of 3 =item * Level 2, Star 3 of 3 =back =item Level 1, term 2 of 2 =over 4 =item * Level 2, Star 1 of 3 =over 4 =item 1 Level 3, Number 1 of 2 =item 2 Level 3, Number 2 of 2 =back =item * Level 2, Star 2 of 3 =item * Level 2, Star 3 of 3 =back =back =head2 Pathological =over 8 =item * Over 8 =back =over 4 =item * Star 1 =item 2 Number 2 =item Term 3 Definition 3 =back Empty =over 4 =back =over 4 No Items =back =over 4 =item * Star 1 =item * No =back Pod-Tree-1.31/t/load.d/list.exp0000644000175000017500000002025113377746260015525 0ustar manwarmanwarROOT { COMMAND head1 { TEXT NAME } ORDINARY { TEXT Lists } COMMAND head2 { TEXT Bullet } LIST BULLET { ITEM BULLET { TEXT * } [ ORDINARY { TEXT foo } ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT bar } ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT baz } ] } COMMAND head2 { TEXT Number } LIST NUMBER { ITEM NUMBER { TEXT 1 } [ ORDINARY { TEXT foo } ] ITEM NUMBER { TEXT 2 } [ ORDINARY { TEXT bar } ] ITEM NUMBER { TEXT 3 } [ ORDINARY { TEXT baz } ] } COMMAND head2 { TEXT Text } LIST TEXT { ITEM TEXT { TEXT do } [ ORDINARY { TEXT a deer, a female deer } ] ITEM TEXT { TEXT ray } [ ORDINARY { TEXT a drop of goden sun } ] ITEM TEXT { TEXT me } [ ORDINARY { TEXT me, a name, I call myself } ] ITEM TEXT { TEXT fa } [ ORDINARY { TEXT a long, long way to run } ] } LIST TEXT { ITEM TEXT { TEXT * do } [ ORDINARY { TEXT a deer, a female deer } ] ITEM TEXT { TEXT * ray } [ ORDINARY { TEXT a drop of goden sun } ] } LIST TEXT { ITEM TEXT { TEXT 3 me } [ ORDINARY { TEXT me, a name, I call myself } ] ITEM TEXT { TEXT 4 fa } [ ORDINARY { TEXT a long, long way to run } ] } COMMAND head2 { TEXT Siblings } LIST BULLET { ITEM BULLET { TEXT * } [ ORDINARY { TEXT Star 1 Para 1 } ORDINARY { TEXT Star 1 Para 2 } ORDINARY { TEXT Star 1 Para 3 } ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT Star 2 } VERBATIM Star 2 Verbatim 1 Star 2 Verbatim 2 Star 2 Verbatim 3 ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT Star 3 } ] } COMMAND head2 { TEXT Markups } LIST TEXT { ITEM TEXT { TEXT term 1 } [ ORDINARY { TEXT definition 1 } ] ITEM TEXT { SEQUENCE I { TEXT term 2 } TEXT } [ ORDINARY { SEQUENCE C { TEXT definition 2 } TEXT } ] ITEM TEXT { SEQUENCE I { TEXT term SEQUENCE B { TEXT 3 } } TEXT } [ ORDINARY { SEQUENCE S { TEXT definition 3 } TEXT } ] } COMMAND head2 { TEXT Nested } LIST BULLET { ITEM BULLET { TEXT * } [ ORDINARY { TEXT Level 1, Star 1 of 2 } LIST BULLET { ITEM BULLET { TEXT * } [ ORDINARY { TEXT Level 2, Star 1 of 2 } ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT Level 2, Star 2 of 2 } ] } ] ITEM BULLET { TEXT * } [ LIST NUMBER { ITEM NUMBER { TEXT 1 } [ ORDINARY { TEXT Level 2, Number 1 of 2 } ] ITEM NUMBER { TEXT 2 } [ ORDINARY { TEXT Level 2, Number 2 of 2 } ] } ] } LIST TEXT { ITEM TEXT { TEXT Level 1, term 1 of 2 } [ LIST BULLET { ITEM BULLET { TEXT * } [ ORDINARY { TEXT Level 2, Star 1 of 3 } ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT Level 2, Star 2 of 3 } ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT Level 2, Star 3 of 3 } ] } ] ITEM TEXT { TEXT Level 1, term 2 of 2 } [ LIST BULLET { ITEM BULLET { TEXT * } [ ORDINARY { TEXT Level 2, Star 1 of 3 } LIST NUMBER { ITEM NUMBER { TEXT 1 } [ ORDINARY { TEXT Level 3, Number 1 of 2 } ] ITEM NUMBER { TEXT 2 } [ ORDINARY { TEXT Level 3, Number 2 of 2 } ] } ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT Level 2, Star 2 of 3 } ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT Level 2, Star 3 of 3 } ] } ] } COMMAND head2 { TEXT Pathological } LIST BULLET { ITEM BULLET { TEXT * } [ ORDINARY { TEXT Over 8 } ] } LIST BULLET { ITEM BULLET { TEXT * } [ ORDINARY { TEXT Star 1 } ] ITEM NUMBER { TEXT 2 } [ ORDINARY { TEXT Number 2 } ] ITEM TEXT { TEXT Term 3 } [ ORDINARY { TEXT Definition 3 } ] } ORDINARY { TEXT Empty } LIST { } LIST { ORDINARY { TEXT No Items } } LIST BULLET { ITEM BULLET { TEXT * } [ ORDINARY { TEXT Star 1 } ] ITEM BULLET { TEXT * } [ ORDINARY { TEXT No =back } ] } } Pod-Tree-1.31/t/16-pod2html.t0000644000175000017500000000247113377746260015041 0ustar manwarmanwaruse 5.006; use strict; use warnings; use Config; use Test::More; my @Files = qw(cut for link list paragraph sequence); my $NFiles = @Files; plan tests => 3 * $NFiles; my $Dir = "t/pod2html.d"; for my $file (@Files) { my $pod = "$Dir/$file.pod"; my $html = "$Dir/$file.html"; my $exp = "$Dir/$file.exp"; unlink $html; system "$Config{perlpath} blib/script/podtree2html --notoc $pod $html"; ok !FileCmp( $html, $exp ); } for my $file (@Files) { my $pod = "$Dir/$file.pod"; my $html = "$Dir/$file.html_t"; my $exp = "$Dir/$file.exp_t"; my $template = "$Dir/template.txt"; my $values = "$Dir/values.pl"; unlink $html; system "$Config{perlpath} blib/script/podtree2html --notoc -variables $values $pod $html $template"; ok !FileCmp( $html, $exp ); } for my $file (@Files) { my $pod = "$Dir/$file.pod"; my $html = "$Dir/$file.html_tv"; my $exp = "$Dir/$file.exp_tv"; my $template = "$Dir/template.txt"; my $values = "$Dir/values.pl"; unlink $html; system "$Config{perlpath} blib/script/podtree2html --notoc -variables $values $pod $html $template color=red"; ok !FileCmp( $html, $exp ); } sub FileCmp { my ( $x, $y ) = @_; local $/ = undef; open my $fx, '<', $x or die "Can't open $x: $!\n"; open my $fy, '<', $y or die "Can't open $y: $!\n"; return <$fx> ne <$fy>; } Pod-Tree-1.31/t/10-cut.t0000644000175000017500000000303013377746260014065 0ustar manwarmanwaruse 5.006; use strict; use warnings; use IO::File; use Path::Tiny qw(path); use Test::More tests => 6; use Pod::Tree; my $Dir = "t/cut.d"; LoadFile("fileU"); LoadFile( "file0", 0 ); LoadFile( "file1", 1 ); LoadString("stringU"); LoadString( "string0", 0 ); LoadString( "string1", 1 ); sub LoadFile { my ( $dump, $in_pod ) = @_; my %options; defined $in_pod and $options{in_pod} = $in_pod; my $tree = Pod::Tree->new; $tree->load_file( "$Dir/cut.pod", %options ); my $actual = $tree->dump; my $expected = path("$Dir/$dump.exp")->slurp; is $actual, $expected; path("$Dir/$dump.act")->spew($actual); } sub LoadString { my ( $dump, $in_pod ) = @_; my $string = path("$Dir/cut.pod")->slurp; my %options; defined $in_pod and $options{in_pod} = $in_pod; my $tree = Pod::Tree->new; $tree->load_string( $string, %options ); my $actual = $tree->dump; my $expected = path("$Dir/$dump.exp")->slurp; is $actual, $expected; path("$Dir/$dump.act")->spew($actual); } sub LoadParagraphs { my $file = shift; my $string = path("$file.pod")->slurp; my @paragraphs = split m(\n{2,}), $string; my $tree = Pod::Tree->new; $tree->load_paragraphs( \@paragraphs ); my $actual = $tree->dump; my $expected = path("$file.p_exp")->slurp; is $actual, $expected; } sub Split { my $string = shift; my @pieces = split /(\n{2,})/, $string; my @paragraphs; while (@pieces) { my ( $text, $ending ) = splice @pieces, 0, 2; $ending or $ending = ''; # to quiet -w push @paragraphs, $text . $ending; } @paragraphs; } Pod-Tree-1.31/t/12-load.t0000644000175000017500000000275213377746260014225 0ustar manwarmanwaruse 5.006; use strict; use warnings; use IO::File; use Path::Tiny qw(path); use Test::More tests => 3; use Pod::Tree; my $Dir = "t/load.d"; LoadFH("$Dir/list"); LoadString("$Dir/list"); LoadParagraphs("$Dir/list"); sub LoadFH { my $file = shift; my $fh = IO::File->new; my $tree = Pod::Tree->new; $fh->open("$file.pod") or die "Can't open $file.pod: $!\n"; $tree->load_fh($fh); my $actual = $tree->dump; my $expected = path("$file.exp")->slurp; is $actual, $expected; path("$file.act")->spew($actual); } sub LoadString { my $file = shift; my $string = path("$file.pod")->slurp; my $tree = Pod::Tree->new; $tree->load_string($string); my $actual = $tree->dump; my $expected = path("$file.exp")->slurp; is $actual, $expected; } sub LoadParagraphs { my $file = shift; my @paragraphs = ReadParagraphs("$file.pod"); my $tree = Pod::Tree->new; $tree->load_paragraphs( \@paragraphs ); my $actual = $tree->dump; my $expected = path("$file.exp")->slurp; is $actual, $expected; } sub ReadParagraphs { my $file = shift; my $pod = path($file)->slurp; my @chunks = split /(\n{2,})/, $pod; my @paragraphs; while (@chunks) { push @paragraphs, join '', splice @chunks, 0, 2; } @paragraphs; } sub Split { my $string = shift; my @pieces = split /(\n{2,})/, $string; my @paragraphs; while (@pieces) { my ( $text, $ending ) = splice @pieces, 0, 2; $ending or $ending = ''; # to quiet -w push @paragraphs, $text . $ending; } @paragraphs; } Pod-Tree-1.31/t/11-html.t0000644000175000017500000001126013377746260014243 0ustar manwarmanwaruse 5.006; use strict; use warnings; use HTML::Stream; use Path::Tiny qw(path); use Test::More; use Pod::Tree; use Pod::Tree::HTML; my $Dir = 't/html.d'; my $nTests = 5 + 5 + 6 + 2 + 2 + 1 + 1; plan tests => $nTests; Source1(); Source2(); Source3(); Source4(); Source5(); Dest1(); Dest2(); Dest3(); Dest4(); Dest5(); Translate(); Empty(); Emit(); Base(); Depth(); sub Source1 { my $tree = Pod::Tree->new; $tree->load_file("$Dir/paragraph.pod"); my $actual; my $html = Pod::Tree::HTML->new( $tree, \$actual ); Source( $html, \$actual ); } sub Source2 { my $actual; my $html = Pod::Tree::HTML->new( "$Dir/paragraph.pod", \$actual ); Source( $html, \$actual ); } sub Source3 { my $io = IO::File->new("$Dir/paragraph.pod"); my $actual; my $html = Pod::Tree::HTML->new( $io, \$actual ); Source( $html, \$actual ); } sub Source4 { my $pod = path("$Dir/paragraph.pod")->slurp; my $actual; my $html = Pod::Tree::HTML->new( \$pod, \$actual ); Source( $html, \$actual ); } sub Source5 { my @paragraphs = ReadParagraphs("$Dir/paragraph.pod"); my $actual; my $html = Pod::Tree::HTML->new( \@paragraphs, \$actual ); Source( $html, \$actual ); } sub Source { my ( $html, $actual ) = @_; $html->set_options( toc => 0 ); $html->translate; my $expected = path("$Dir/paragraph.exp")->slurp; is $$actual, $expected; } sub Dest1 { my $actual; my $string = IO::String->new($actual); my $stream = HTML::Stream->new($string); my $html = Pod::Tree::HTML->new( "$Dir/paragraph.pod", $stream ); $html->set_options( toc => 0 ); $html->translate; my $expected = path("$Dir/paragraph.exp")->slurp; is $actual, $expected; } sub Dest2 { { my $file = IO::File->new( "$Dir/paragraph.act", '>' ); my $html = Pod::Tree::HTML->new( "$Dir/paragraph.pod", $file ); $html->set_options( toc => 0 ); $html->translate; } my $expected = path("$Dir/paragraph.exp")->slurp; my $actual = path("$Dir/paragraph.act")->slurp; is $actual, $expected; } sub Dest3 { my $actual; my $string = IO::String->new($actual); my $html = Pod::Tree::HTML->new( "$Dir/paragraph.pod", $string ); $html->set_options( toc => 0 ); $html->translate; my $expected = path("$Dir/paragraph.exp")->slurp; is $actual, $expected; } sub Dest4 { my $actual; my $html = Pod::Tree::HTML->new( "$Dir/paragraph.pod", \$actual ); $html->set_options( toc => 0 ); $html->translate; my $expected = path("$Dir/paragraph.exp")->slurp; is $actual, $expected; } sub Dest5 { { my $html = Pod::Tree::HTML->new( "$Dir/paragraph.pod", "$Dir/paragraph.act" ); $html->set_options( toc => 0 ); $html->translate; } my $expected = path("$Dir/paragraph.exp")->slurp; my $actual = path("$Dir/paragraph.act")->slurp; is $actual, $expected; } sub Translate { for my $file (qw(cut paragraph list sequence for link)) { my $actual = ''; my $html = Pod::Tree::HTML->new( "$Dir/$file.pod", \$actual ); $html->set_options( toc => 0 ); $html->translate; my $expected = path("$Dir/$file.exp")->slurp; is $actual, $expected; path("$Dir/$file.act")->spew($actual); # WriteFile("$ENV{HOME}/public_html/pod/$file.html", $actual); } } sub Empty { my $actual = "$Dir/empty.act"; unlink $actual; my $html = Pod::Tree::HTML->new( "$Dir/empty.pod", $actual ); $html->translate; ok !-e $actual; $html = Pod::Tree::HTML->new( "$Dir/empty.pod", $actual, empty => 1 ); $html->translate; ok -e $actual; } sub Emit { for my $piece (qw(body toc)) { my $actual = ''; my $html = Pod::Tree::HTML->new( "$Dir/paragraph.pod", \$actual ); my $emit = "emit_$piece"; $html->set_options( hr => 0 ); $html->$emit; my $expected = path("$Dir/$piece.exp")->slurp; is $actual, $expected; path("$Dir/$piece.act")->spew($actual); # WriteFile("$ENV{HOME}/public_html/pod/$piece.html", $actual); } } sub Base { my $actual = ''; my $html = Pod::Tree::HTML->new( "$Dir/link.pod", \$actual ); $html->set_options( toc => 0, base => 'http://world.std.com/~swmcd/pod' ); $html->translate; my $expected = path("$Dir/base.exp")->slurp; is $actual, $expected; path("$Dir/base.act")->spew($actual); # WriteFile("$ENV{HOME}/public_html/pod/base.html", $actual); } sub Depth { my $actual = ''; my $html = Pod::Tree::HTML->new( "$Dir/link.pod", \$actual ); $html->set_options( toc => 0, depth => 2 ); $html->translate; my $expected = path("$Dir/depth.exp")->slurp; is $actual, $expected; path("$Dir/depth.act")->spew($actual); # WriteFile("$ENV{HOME}/public_html/pod/depth.html", $actual); } sub ReadParagraphs { my $file = shift; my $pod = path($file)->slurp; my @chunks = split /( \n\s*\n | \r\s*\r | \r\n\s*\r\n )/x, $pod; my @paragraphs; while (@chunks) { push @paragraphs, join '', splice @chunks, 0, 2; } @paragraphs; } Pod-Tree-1.31/t/18-template.t0000644000175000017500000000165413377746260015127 0ustar manwarmanwaruse 5.006; use strict; use warnings; use HTML::Stream; use Path::Tiny qw(path); use Test::More tests => 12; use Pod::Tree; use Pod::Tree::HTML; my $Dir = 't/template.d'; Template1(); Template2(); sub Template1 { for my $file (qw(cut paragraph list sequence for link)) { my $act = "$Dir/$file.act"; unlink $act; { my $html = Pod::Tree::HTML->new( "$Dir/$file.pod", $act ); $html->translate("$Dir/template.txt"); } my $expected = path("$Dir/$file.exp")->slurp; my $actual = path($act)->slurp; is $actual, $expected; } } sub Template2 { for my $file (qw(cut paragraph list sequence for link)) { my $act = "$Dir/$file.act"; unlink $act; { my $dest = IO::File->new("> $act"); my $html = Pod::Tree::HTML->new( "$Dir/$file.pod", $dest ); $html->translate("$Dir/template.txt"); } my $expected = path("$Dir/$file.exp")->slurp; my $actual = path("$act")->slurp; is $actual, $expected; } } Pod-Tree-1.31/t/cut.d/0000755000175000017500000000000013433752154013700 5ustar manwarmanwarPod-Tree-1.31/t/cut.d/cut.pod0000644000175000017500000000013413377746260015205 0ustar manwarmanwarNot in pod. Still not in pod. =pod In pod. =cut Not in pod. =head1 POD More in pod. Pod-Tree-1.31/t/cut.d/string1.exp0000644000175000017500000000052713377746260016021 0ustar manwarmanwarROOT { ORDINARY { TEXT Not in pod. } ORDINARY { TEXT Still not in pod. } COMMAND pod { } ORDINARY { TEXT In pod. } COMMAND cut { } CODE { Not in pod. } COMMAND head1 { TEXT POD } ORDINARY { TEXT More in pod. } } Pod-Tree-1.31/t/cut.d/stringU.exp0000644000175000017500000000052713377746260016065 0ustar manwarmanwarROOT { ORDINARY { TEXT Not in pod. } ORDINARY { TEXT Still not in pod. } COMMAND pod { } ORDINARY { TEXT In pod. } COMMAND cut { } CODE { Not in pod. } COMMAND head1 { TEXT POD } ORDINARY { TEXT More in pod. } } Pod-Tree-1.31/t/cut.d/file0.exp0000644000175000017500000000046313377746260015430 0ustar manwarmanwarROOT { CODE { Not in pod. Still not in pod. } COMMAND pod { } ORDINARY { TEXT In pod. } COMMAND cut { } CODE { Not in pod. } COMMAND head1 { TEXT POD } ORDINARY { TEXT More in pod. } } Pod-Tree-1.31/t/cut.d/string0.exp0000644000175000017500000000046313377746260016017 0ustar manwarmanwarROOT { CODE { Not in pod. Still not in pod. } COMMAND pod { } ORDINARY { TEXT In pod. } COMMAND cut { } CODE { Not in pod. } COMMAND head1 { TEXT POD } ORDINARY { TEXT More in pod. } } Pod-Tree-1.31/t/cut.d/fileU.exp0000644000175000017500000000046313377746260015475 0ustar manwarmanwarROOT { CODE { Not in pod. Still not in pod. } COMMAND pod { } ORDINARY { TEXT In pod. } COMMAND cut { } CODE { Not in pod. } COMMAND head1 { TEXT POD } ORDINARY { TEXT More in pod. } } Pod-Tree-1.31/t/cut.d/file1.exp0000644000175000017500000000052713377746260015432 0ustar manwarmanwarROOT { ORDINARY { TEXT Not in pod. } ORDINARY { TEXT Still not in pod. } COMMAND pod { } ORDINARY { TEXT In pod. } COMMAND cut { } CODE { Not in pod. } COMMAND head1 { TEXT POD } ORDINARY { TEXT More in pod. } } Pod-Tree-1.31/t/13-mapper.t0000644000175000017500000000260113377746260014564 0ustar manwarmanwaruse 5.006; use strict; use warnings; use HTML::Stream; use Path::Tiny qw(path); use Test::More tests => 6 * 3; use Pod::Tree; use Pod::Tree::HTML; my $Dir = 't/mapper.d'; Translate(); my $mapper = Map_Mapper->new; Translate($mapper); $mapper = URL_Mapper->new; Translate($mapper); sub Translate { my $mapper = shift; for my $file (qw(cut paragraph list sequence for link)) { my $actual = ''; my $html = Pod::Tree::HTML->new( "$Dir/$file.pod", \$actual ); $html->set_options( toc => 0 ); $html->set_options( link_map => $mapper ) if $mapper; $html->translate; my $expected = path("$Dir/$file.exp")->slurp; is $actual, $expected; path("$Dir/$file.act")->spew($actual); # WriteFile("$ENV{HOME}/public_html/pod/$file.html", $actual); } } ## no critic (RequireFilenameMatchesPackage) package URL_Mapper; sub new { bless {}, shift } sub url { my ( $mapper, $html, $target ) = @_; my $depth = $html->{options}{depth}; my $base = join '/', ('..') x $depth; my $page = $target->get_page; $page =~ s(::)(/)g; $page .= '.html' if $page; my $section = $target->get_section; my $fragment = $html->escape_2396($section); my $url = $html->assemble_url( $base, $page, $fragment ); $url; } package Map_Mapper; sub new { bless {}, shift } sub map { my ( $link_map, $base, $page, $section, $depth ) = @_; $page =~ s(::)(/)g; ( '../' x $depth, $page, $section ); } Pod-Tree-1.31/t/pod.d/0000755000175000017500000000000013433752154013667 5ustar manwarmanwarPod-Tree-1.31/t/pod.d/link.pod0000644000175000017500000000240513377746260015341 0ustar manwarmanwar=head1 NAME Links =head2 Original A L manual page. An L item in manual page. A L section in other manual page. A L<"sec"> section in this manual page (the quotes are B optional). A L< sec > section in this manual page A L section in this manual page A L link to a module POD A L section in this manual page (the quotes are optional). =head2 Total Control A L manual page. An L item in manual page. A L section in other manual page. A L section in this manual page (quotes are B optional). A L section in this manual page A L section in this manual page A L link to a module POD A L section in this manual page (quotes are optional). =head2 Targets X X X X target> =head2 Links L L<"target with spaces"> L<" target w/spaces "> L<"target with line breaks"> L B> L/I
> L This probably won't do what you want Lbar|blort> Lbar|blort> LbarEbaz|blort> Pod-Tree-1.31/t/pod.d/cut.pod0000644000175000017500000000011113377746260015167 0ustar manwarmanwarNot in pod. =pod In pod. =cut Not in pod. =head1 POD More in pod. Pod-Tree-1.31/t/pod.d/for.pod0000644000175000017500000000055413377746260015175 0ustar manwarmanwar=pod =head1 HEAD =for html Line 1
<Line 2> =for html Steven VERBATIM VERBATIM VERBATIM Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz =begin text =head2 Not really a command VERBATIM VERBATIM VERBATIM Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz =end text =head2 Really a commmand. Pod-Tree-1.31/t/pod.d/list.pod0000644000175000017500000000320313377746260015354 0ustar manwarmanwar=head1 NAME Lists =head2 Bullet =over 4 =item * foo =item * bar =item * baz =back =head2 Number =over 4 =item 1 foo =item 2 bar =item 3 baz =back =head2 Text =over 4 =item do a deer, a female deer =item ray a drop of goden sun =item me me, a name, I call myself =item fa a long, long way to run =back =over 4 =item * do a deer, a female deer =item * ray a drop of goden sun =back =over 4 =item 3 me me, a name, I call myself =item 4 fa a long, long way to run =back =head2 Siblings =over 4 =item * Star 1 Para 1 Star 1 Para 2 Star 1 Para 3 =item * Star 2 Star 2 Verbatim 1 Star 2 Verbatim 2 Star 2 Verbatim 3 =item * Star 3 =back =head2 Markups =over 4 =item term 1 definition 1 =item I C =item I> S =back =head2 Nested =over 4 =item * Level 1, Star 1 of 2 =over 4 =item * Level 2, Star 1 of 2 =item * Level 2, Star 2 of 2 =back =item * =over 4 =item 1 Level 2, Number 1 of 2 =item 2 Level 2, Number 2 of 2 =back =back =over 4 =item Level 1, term 1 of 2 =over 4 =item * Level 2, Star 1 of 3 =item * Level 2, Star 2 of 3 =item * Level 2, Star 3 of 3 =back =item Level 1, term 2 of 2 =over 4 =item * Level 2, Star 1 of 3 =over 4 =item 1 Level 3, Number 1 of 2 =item 2 Level 3, Number 2 of 2 =back =item * Level 2, Star 2 of 3 =item * Level 2, Star 3 of 3 =back =back =head2 Pathological =over 8 =item * Over 8 =back =over 4 =item * Star 1 =item 2 Number 2 =item Term 3 Definition 3 =back Empty =over 4 =back =over 4 No Items =back =over 4 =item * Star 1 =item * No =back Pod-Tree-1.31/t/pod.d/paragraph.pod0000644000175000017500000000065713377746260016360 0ustar manwarmanwar=head1 HEAD1 Head 1 text =head2 HEADI<2> Head2 B +----------------------------------+ | This is a verbatim paragraph | +----------------------------------+ +----------------------------------+ | Anda nother verbatim paragraph | +----------------------------------+ +----------------------------------+ | Stella nother verbatim paragraph | +----------------------------------+ Pod-Tree-1.31/t/pod.d/sequence.pod0000644000175000017500000000105113377746260016210 0ustar manwarmanwar=head1 NAME B [-n] I =head1 DESCRIPTION =Z<>head1 introduces a 1st level heading. B sends I to a printer. B, I, zero, B, bold> normal. S, C<0>. C, B>, F, X <, >, /, |, A, E<192> B<<, E, /, |, A, E<192>> I, /, |, A, E<192>>> E<169> E<176> E<247> E<189> E<181> E<183> E<172> E<174> E<215> C<$a <=E $b> Cbar>>, Ibar>>>, An C> markup. C<$a << $b>, BE$b>>; Pod-Tree-1.31/t/template.d/0000755000175000017500000000000013433752154014720 5ustar manwarmanwarPod-Tree-1.31/t/template.d/link.pod0000644000175000017500000000235313377746260016374 0ustar manwarmanwar=head1 NAME Links =head2 Original A L manual page. An L item in manual page. A L section in other manual page. A L<"sec"> section in this manual page (the quotes are B optional). A L< sec > section in this manual page A L section in this manual page A L link to a module POD A L section in this manual page (the quotes are optional). =head2 Total Control A L manual page. An L item in manual page. A L section in other manual page. A L section in this manual page (quotes are B optional). A L section in this manual page A L section in this manual page A L link to a module POD A L section in this manual page (quotes are optional). =head2 Targets X X X X target> =head2 Links L L<"target with spaces"> L<" target w/spaces "> L<"target with line breaks"> L B> L/I
> L L Pod-Tree-1.31/t/template.d/template.txt0000644000175000017500000000032213377746260017301 0ustar manwarmanwar {$title} {$toc} {$body} Pod-Tree-1.31/t/template.d/sequence.exp0000644000175000017500000000254313377746260017262 0ustar manwarmanwar print [-n] file

NAME

print [-n] file

DESCRIPTION

=head1 introduces a 1st level heading. print sends file to a printer. bold, italic, zero, bold, bold italic, bold normal. Non-breaking space, 0.

code, bold code, file, <, >, /, |, A, À <, >, /, |, A, À <, >, /, |, A, À

© ° ÷ ½ µ · ¬ ® ×

$a <=> $b, $a <=> $b

$foo->bar, $foo->bar ,

An page/section markup.

$a << $b, $a >> $b ;

see (?>pattern).

see No backtracking.

Italic Bold Code

Pod-Tree-1.31/t/template.d/cut.exp0000644000175000017500000000044413377746260016243 0ustar manwarmanwar POD

In pod.

POD

More in pod.

Pod-Tree-1.31/t/template.d/cut.pod0000644000175000017500000000011113377746260016220 0ustar manwarmanwarNot in pod. =pod In pod. =cut Not in pod. =head1 POD More in pod. Pod-Tree-1.31/t/template.d/for.pod0000644000175000017500000000060313377746260016221 0ustar manwarmanwar=pod =head1 HEAD =for html Line 1
<Line 2> =for html Steven VERBATIM VERBATIM VERBATIM Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz =for image flower.gif =begin text =head2 Not really a command VERBATIM VERBATIM VERBATIM Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz =end text =head2 Really a commmand. Pod-Tree-1.31/t/template.d/for.exp0000644000175000017500000000115713377746260016240 0ustar manwarmanwar

HEAD

Line 1
<Line 2>

Steven

	VERBATIM
	VERBATIM
	VERBATIM

Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz

Really a commmand.

Pod-Tree-1.31/t/template.d/link.exp0000644000175000017500000000516713377746260016414 0ustar manwarmanwar Links

NAME

Links

Original

A name manual page.

An name/ident item in manual page.

A name/"sec" section in other manual page.

A "sec" section in this manual page (the quotes are not optional).

A sec section in this manual page

A sec tion section in this manual page

A mod::ule.foo link to a module POD

A /"sec" section in this manual page (the quotes are optional).

Total Control

A text manual page.

An text item in manual page.

A text section in other manual page.

A text section in this manual page (quotes are not optional).

A text section in this manual page

A text section in this manual page

A text link to a module POD

A text section in this manual page (quotes are optional).

Targets

Links

/target

"target with spaces"

" target w/spaces "

"target with line breaks"

/italic target

page/section

http://world.std.com/~swmcd/steven/index.html

Steven McDougall

Pod-Tree-1.31/t/template.d/list.pod0000644000175000017500000000320313377746260016405 0ustar manwarmanwar=head1 NAME Lists =head2 Bullet =over 4 =item * foo =item * bar =item * baz =back =head2 Number =over 4 =item 1 foo =item 2 bar =item 3 baz =back =head2 Text =over 4 =item do a deer, a female deer =item ray a drop of goden sun =item me me, a name, I call myself =item fa a long, long way to run =back =over 4 =item * do a deer, a female deer =item * ray a drop of goden sun =back =over 4 =item 3 me me, a name, I call myself =item 4 fa a long, long way to run =back =head2 Siblings =over 4 =item * Star 1 Para 1 Star 1 Para 2 Star 1 Para 3 =item * Star 2 Star 2 Verbatim 1 Star 2 Verbatim 2 Star 2 Verbatim 3 =item * Star 3 =back =head2 Markups =over 4 =item term 1 definition 1 =item I C =item I> S =back =head2 Nested =over 4 =item * Level 1, Star 1 of 2 =over 4 =item * Level 2, Star 1 of 2 =item * Level 2, Star 2 of 2 =back =item * =over 4 =item 1 Level 2, Number 1 of 2 =item 2 Level 2, Number 2 of 2 =back =back =over 4 =item Level 1, term 1 of 2 =over 4 =item * Level 2, Star 1 of 3 =item * Level 2, Star 2 of 3 =item * Level 2, Star 3 of 3 =back =item Level 1, term 2 of 2 =over 4 =item * Level 2, Star 1 of 3 =over 4 =item 1 Level 3, Number 1 of 2 =item 2 Level 3, Number 2 of 2 =back =item * Level 2, Star 2 of 3 =item * Level 2, Star 3 of 3 =back =back =head2 Pathological =over 8 =item * Over 8 =back =over 4 =item * Star 1 =item 2 Number 2 =item Term 3 Definition 3 =back Empty =over 4 =back =over 4 No Items =back =over 4 =item * Star 1 =item * No =back Pod-Tree-1.31/t/template.d/paragraph.exp0000644000175000017500000000160513377746260017415 0ustar manwarmanwar Head 1 text

HEAD1

Head 1 text

HEAD2

Head2 text

    +------------------------------+
    | This is a verbatim paragraph |
    +------------------------------+


    +----------------------------------+
    | Anda nother verbatim paragraph   |
    +----------------------------------+

    +----------------------------------+
    | Stella nother verbatim paragraph |
    +----------------------------------+

HEAD3

Sub head

HEAD4

Sub sub head

Pod-Tree-1.31/t/template.d/paragraph.pod0000644000175000017500000000073413377746260017405 0ustar manwarmanwar=head1 HEAD1 Head 1 text =head2 HEADI<2> Head2 B +------------------------------+ | This is a verbatim paragraph | +------------------------------+ +----------------------------------+ | Anda nother verbatim paragraph | +----------------------------------+ +----------------------------------+ | Stella nother verbatim paragraph | +----------------------------------+ =head3 HEAD3 Sub head =head4 HEAD4 Sub sub head Pod-Tree-1.31/t/template.d/sequence.pod0000644000175000017500000000143513377746260017247 0ustar manwarmanwar=head1 NAME B [-n] I =head1 DESCRIPTION =Z<>head1 introduces a 1st level heading. B sends I to a printer. B, I, zeZ<>ro, B, bold> normal. S, C<0>. C, B>, F, X E, E, E, E, E<65>, E B, E, E, E, E<65>, E> I, E, E, E, E<65>, E>> E E E E E E E E E C<< $a <=> $b >>, C<<< $a <=> $b >>> C<< B<<< $foo->bar >>> >>, I< C<< B<<< $foo->bar >>> >> >, An C<<<< L >>>> markup. C<<< $a << $b >>>, B< C<<< $a >> $b >>> >; see Lpattern) >>>. see Lpattern)>. C>>>> Pod-Tree-1.31/t/template.d/list.exp0000644000175000017500000000553513377746260016431 0ustar manwarmanwar Lists

NAME

Lists

Bullet

  • foo
  • bar
  • baz

Number

  1. foo
  2. bar
  3. baz

Text

do
a deer, a female deer
ray
a drop of goden sun
me
me, a name, I call myself
fa
a long, long way to run
* do
a deer, a female deer
* ray
a drop of goden sun
3 me
me, a name, I call myself
4 fa
a long, long way to run

Siblings

  • Star 1 Para 1

    Star 1 Para 2

    Star 1 Para 3

  • Star 2

    	Star 2 Verbatim 1
    	Star 2 Verbatim 2
    	Star 2 Verbatim 3
  • Star 3

Markups

term 1
definition 1
term 2
definition 2
term 3
definition 3

Nested

  • Level 1, Star 1 of 2

    • Level 2, Star 1 of 2
    • Level 2, Star 2 of 2
    1. Level 2, Number 1 of 2
    2. Level 2, Number 2 of 2
Level 1, term 1 of 2
  • Level 2, Star 1 of 3
  • Level 2, Star 2 of 3
  • Level 2, Star 3 of 3
Level 1, term 2 of 2
  • Level 2, Star 1 of 3

    1. Level 3, Number 1 of 2
    2. Level 3, Number 2 of 2
  • Level 2, Star 2 of 3
  • Level 2, Star 3 of 3

Pathological

  • Over 8
  • Star 1
  • Number 2
  • Term 3
    Definition 3

Empty

No Items

  • Star 1
  • No =back
Pod-Tree-1.31/t/pods2html.d/0000755000175000017500000000000013433752154015021 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/template.txt0000644000175000017500000000042413377746260017405 0ustar manwarmanwar {$title}

TEMPLATE

{$color} is the color of my true love's {$part} {$toc} {$body} Pod-Tree-1.31/t/pods2html.d/podR_exp/0000755000175000017500000000000013433752154016601 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/podR_exp/A/0000755000175000017500000000000013433752154016761 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/podR_exp/A/B.pod0000644000175000017500000000012413377746260017653 0ustar manwarmanwar=head1 NAME A::B - module A::B =head1 LINKS L L L L L Pod-Tree-1.31/t/pods2html.d/podR_exp/HTML/0000755000175000017500000000000013433752154017345 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/podR_exp/HTML/A/0000755000175000017500000000000013433752154017525 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/podR_exp/HTML/A/B.html0000644000175000017500000000067713377746260020616 0ustar manwarmanwar A::B

NAME

A::B - module A::B

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/podR_exp/HTML/C.html0000644000175000017500000000064713377746260020434 0ustar manwarmanwar C

NAME

C - module C

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/podR_exp/HTML/A.html0000644000175000017500000000064713377746260020432 0ustar manwarmanwar A

NAME

A - module A

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/podR_exp/HTML/C/0000755000175000017500000000000013433752154017527 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/podR_exp/HTML/C/D/0000755000175000017500000000000013433752154017712 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/podR_exp/HTML/C/D/E.html0000644000175000017500000000072713377746260021002 0ustar manwarmanwar C::D::E

NAME

C::D::E - module C::D::E

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/podR_exp/HTML/C/D.html0000644000175000017500000000070013377746260020605 0ustar manwarmanwar C::D

NAME

C::D - module C::D

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/podR_exp/A.pm0000644000175000017500000000000013377746260017315 0ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/podR_exp/A.pod0000644000175000017500000000011613377746260017473 0ustar manwarmanwar=head1 NAME A - module A =head1 LINKS L L L L L Pod-Tree-1.31/t/pods2html.d/podR_exp/C.pod0000644000175000017500000000011613377746260017475 0ustar manwarmanwar=head1 NAME C - module C =head1 LINKS L L L L L Pod-Tree-1.31/t/pods2html.d/podR_exp/C/0000755000175000017500000000000013433752154016763 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/podR_exp/C/D.pod0000644000175000017500000000012513377746260017660 0ustar manwarmanwar=head1 NAME C::D - module C::D =head1 LINKS L L L L L Pod-Tree-1.31/t/pods2html.d/podR_exp/C/D/0000755000175000017500000000000013433752154017146 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/podR_exp/C/D/E.pod0000644000175000017500000000013213377746260020042 0ustar manwarmanwar=head1 NAME C::D::E - module C::D::E =head1 LINKS L L L L L Pod-Tree-1.31/t/pods2html.d/values.pl0000644000175000017500000000015213377746260016663 0ustar manwarmanwaruse 5.006; use strict; use warnings; $Pod::Tree::HTML::color = 'black'; $Pod::Tree::HTML::part = 'hair'; Pod-Tree-1.31/t/pods2html.d/html_exp_t/0000755000175000017500000000000013433752154017164 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/html_exp_t/A/0000755000175000017500000000000013433752154017344 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/html_exp_t/A/B.html0000644000175000017500000000107513377746260020426 0ustar manwarmanwar A::B

TEMPLATE

black is the color of my true love's hair

NAME

A::B - module A::B

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/html_exp_t/C.html0000644000175000017500000000104513377746260020244 0ustar manwarmanwar C

TEMPLATE

black is the color of my true love's hair

NAME

C - module C

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/html_exp_t/A.html0000644000175000017500000000104513377746260020242 0ustar manwarmanwar A

TEMPLATE

black is the color of my true love's hair

NAME

A - module A

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/html_exp_t/C/0000755000175000017500000000000013433752154017346 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/html_exp_t/C/D/0000755000175000017500000000000013433752154017531 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/html_exp_t/C/D/E.html0000644000175000017500000000112513377746260020612 0ustar manwarmanwar C::D::E

TEMPLATE

black is the color of my true love's hair

NAME

C::D::E - module C::D::E

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/html_exp_t/C/D.html0000644000175000017500000000107613377746260020433 0ustar manwarmanwar C::D

TEMPLATE

black is the color of my true love's hair

NAME

C::D - module C::D

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/html_exp/0000755000175000017500000000000013433752154016641 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/html_exp/A/0000755000175000017500000000000013433752154017021 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/html_exp/A/B.html0000644000175000017500000000067713377746260020112 0ustar manwarmanwar A::B

NAME

A::B - module A::B

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/html_exp/C.html0000644000175000017500000000064713377746260017730 0ustar manwarmanwar C

NAME

C - module C

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/html_exp/A.html0000644000175000017500000000064713377746260017726 0ustar manwarmanwar A

NAME

A - module A

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/html_exp/C/0000755000175000017500000000000013433752154017023 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/html_exp/C/D/0000755000175000017500000000000013433752154017206 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/html_exp/C/D/E.html0000644000175000017500000000072713377746260020276 0ustar manwarmanwar C::D::E

NAME

C::D::E - module C::D::E

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/html_exp/C/D.html0000644000175000017500000000070013377746260020101 0ustar manwarmanwar C::D

NAME

C::D - module C::D

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/podR/0000755000175000017500000000000013433752154015725 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/podR/A/0000755000175000017500000000000013433752154016105 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/podR/A/B.pod0000644000175000017500000000012413377746260016777 0ustar manwarmanwar=head1 NAME A::B - module A::B =head1 LINKS L L L L L Pod-Tree-1.31/t/pods2html.d/podR/A.pm0000644000175000017500000000000013377746260016441 0ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/podR/A.pod0000644000175000017500000000011613377746260016617 0ustar manwarmanwar=head1 NAME A - module A =head1 LINKS L L L L L Pod-Tree-1.31/t/pods2html.d/podR/C.pod0000644000175000017500000000011613377746260016621 0ustar manwarmanwar=head1 NAME C - module C =head1 LINKS L L L L L Pod-Tree-1.31/t/pods2html.d/podR/C/0000755000175000017500000000000013433752154016107 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/podR/C/D.pod0000644000175000017500000000012513377746260017004 0ustar manwarmanwar=head1 NAME C::D - module C::D =head1 LINKS L L L L L Pod-Tree-1.31/t/pods2html.d/podR/C/D/0000755000175000017500000000000013433752154016272 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/podR/C/D/E.pod0000644000175000017500000000013213377746260017166 0ustar manwarmanwar=head1 NAME C::D::E - module C::D::E =head1 LINKS L L L L L Pod-Tree-1.31/t/pods2html.d/pod/0000755000175000017500000000000013433752154015603 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/pod/A/0000755000175000017500000000000013433752154015763 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/pod/A/B.pod0000644000175000017500000000012413377746260016655 0ustar manwarmanwar=head1 NAME A::B - module A::B =head1 LINKS L L L L L Pod-Tree-1.31/t/pods2html.d/pod/empty.pod0000644000175000017500000000002713377746260017454 0ustar manwarmanwarNo POD here. __END__ Pod-Tree-1.31/t/pods2html.d/pod/A.pm0000644000175000017500000000000013377746260016317 0ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/pod/A.pod0000644000175000017500000000011613377746260016475 0ustar manwarmanwar=head1 NAME A - module A =head1 LINKS L L L L L Pod-Tree-1.31/t/pods2html.d/pod/C.pod0000644000175000017500000000011613377746260016477 0ustar manwarmanwar=head1 NAME C - module C =head1 LINKS L L L L L Pod-Tree-1.31/t/pods2html.d/pod/C/0000755000175000017500000000000013433752154015765 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/pod/C/D.pod0000644000175000017500000000012513377746260016662 0ustar manwarmanwar=head1 NAME C::D - module C::D =head1 LINKS L L L L L Pod-Tree-1.31/t/pods2html.d/pod/C/D/0000755000175000017500000000000013433752154016150 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/pod/C/D/E.pod0000644000175000017500000000013213377746260017044 0ustar manwarmanwar=head1 NAME C::D::E - module C::D::E =head1 LINKS L L L L L Pod-Tree-1.31/t/pods2html.d/empty_exp/0000755000175000017500000000000013433752154017033 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/empty_exp/A/0000755000175000017500000000000013433752154017213 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/empty_exp/A/B.html0000644000175000017500000000066313377746260020277 0ustar manwarmanwar A::B

NAME

A::B - module A::B

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/empty_exp/C.html0000644000175000017500000000063313377746260020115 0ustar manwarmanwar C

NAME

C - module C

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/empty_exp/empty.html0000644000175000017500000000013713377746260021070 0ustar manwarmanwar

Pod-Tree-1.31/t/pods2html.d/empty_exp/A.html0000644000175000017500000000063313377746260020113 0ustar manwarmanwar A

NAME

A - module A

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/empty_exp/C/0000755000175000017500000000000013433752154017215 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/empty_exp/C/D/0000755000175000017500000000000013433752154017400 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/empty_exp/C/D/E.html0000644000175000017500000000071313377746260020463 0ustar manwarmanwar C::D::E

NAME

C::D::E - module C::D::E

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/empty_exp/C/D.html0000644000175000017500000000066413377746260020304 0ustar manwarmanwar C::D

NAME

C::D - module C::D

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/html_exp_tv/0000755000175000017500000000000013433752154017352 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/html_exp_tv/A/0000755000175000017500000000000013433752154017532 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/html_exp_tv/A/B.html0000644000175000017500000000107313377746260020612 0ustar manwarmanwar A::B

TEMPLATE

red is the color of my true love's hair

NAME

A::B - module A::B

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/html_exp_tv/C.html0000644000175000017500000000104313377746260020430 0ustar manwarmanwar C

TEMPLATE

red is the color of my true love's hair

NAME

C - module C

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/html_exp_tv/A.html0000644000175000017500000000104313377746260020426 0ustar manwarmanwar A

TEMPLATE

red is the color of my true love's hair

NAME

A - module A

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/html_exp_tv/C/0000755000175000017500000000000013433752154017534 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/html_exp_tv/C/D/0000755000175000017500000000000013433752154017717 5ustar manwarmanwarPod-Tree-1.31/t/pods2html.d/html_exp_tv/C/D/E.html0000644000175000017500000000112313377746260020776 0ustar manwarmanwar C::D::E

TEMPLATE

red is the color of my true love's hair

NAME

C::D::E - module C::D::E

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pods2html.d/html_exp_tv/C/D.html0000644000175000017500000000107413377746260020617 0ustar manwarmanwar C::D

TEMPLATE

red is the color of my true love's hair

NAME

C::D - module C::D

LINKS

A A::B C C::D C::D::E

Pod-Tree-1.31/t/pod2html.d/0000755000175000017500000000000013433752154014636 5ustar manwarmanwarPod-Tree-1.31/t/pod2html.d/link.pod0000644000175000017500000000235313377746260016312 0ustar manwarmanwar=head1 NAME Links =head2 Original A L manual page. An L item in manual page. A L section in other manual page. A L<"sec"> section in this manual page (the quotes are B optional). A L< sec > section in this manual page A L section in this manual page A L link to a module POD A L section in this manual page (the quotes are optional). =head2 Total Control A L manual page. An L item in manual page. A L section in other manual page. A L section in this manual page (quotes are B optional). A L section in this manual page A L section in this manual page A L link to a module POD A L section in this manual page (quotes are optional). =head2 Targets X X X X target> =head2 Links L L<"target with spaces"> L<" target w/spaces "> L<"target with line breaks"> L B> L/I
> L L Pod-Tree-1.31/t/pod2html.d/template.txt0000644000175000017500000000042413377746260017222 0ustar manwarmanwar {$title}

TEMPLATE

{$color} is the color of my true love's {$part} {$toc} {$body} Pod-Tree-1.31/t/pod2html.d/sequence.exp0000644000175000017500000000227313377746260017200 0ustar manwarmanwar print [-n] file

NAME

print [-n] file

DESCRIPTION

=head1 introduces a 1st level heading. print sends file to a printer. bold, italic, zero, bold, bold italic, bold normal. Non-breaking space, 0.

code, bold code, file, <, >, /, |, A, À <, >, /, |, A, À <, >, /, |, A, À

© ° ÷ ½ µ · ¬ ® ×

$a <=> $b, $a <=> $b

$foo->bar, $foo->bar ,

An page/section markup.

$a << $b, $a >> $b ;

see (?>pattern).

see No backtracking.

Italic Bold Code

Pod-Tree-1.31/t/pod2html.d/link.exp_tv0000644000175000017500000000473413377746260017042 0ustar manwarmanwar Links

TEMPLATE

red is the color of my true love's hair

NAME

Links

Original

A name manual page.

An name/ident item in manual page.

A name/"sec" section in other manual page.

A "sec" section in this manual page (the quotes are not optional).

A sec section in this manual page

A sec tion section in this manual page

A mod::ule.foo link to a module POD

A /"sec" section in this manual page (the quotes are optional).

Total Control

A text manual page.

An text item in manual page.

A text section in other manual page.

A text section in this manual page (quotes are not optional).

A text section in this manual page

A text section in this manual page

A text link to a module POD

A text section in this manual page (quotes are optional).

Targets

Links

/target

"target with spaces"

" target w/spaces "

"target with line breaks"

/italic target

page/section

http://world.std.com/~swmcd/steven/index.html

Steven McDougall

Pod-Tree-1.31/t/pod2html.d/cut.exp0000644000175000017500000000025213377746260016156 0ustar manwarmanwar POD

In pod.

POD

More in pod.

Pod-Tree-1.31/t/pod2html.d/cut.pod0000644000175000017500000000011113377746260016136 0ustar manwarmanwarNot in pod. =pod In pod. =cut Not in pod. =head1 POD More in pod. Pod-Tree-1.31/t/pod2html.d/sequence.exp_t0000644000175000017500000000250513377746260017521 0ustar manwarmanwar print [-n] file

TEMPLATE

black is the color of my true love's hair

NAME

print [-n] file

DESCRIPTION

=head1 introduces a 1st level heading. print sends file to a printer. bold, italic, zero, bold, bold italic, bold normal. Non-breaking space, 0.

code, bold code, file, <, >, /, |, A, À <, >, /, |, A, À <, >, /, |, A, À

© ° ÷ ½ µ · ¬ ® ×

$a <=> $b, $a <=> $b

$foo->bar, $foo->bar ,

An page/section markup.

$a << $b, $a >> $b ;

see (?>pattern).

see No backtracking.

Italic Bold Code

Pod-Tree-1.31/t/pod2html.d/for.pod0000644000175000017500000000060313377746260016137 0ustar manwarmanwar=pod =head1 HEAD =for html Line 1
<Line 2> =for html Steven VERBATIM VERBATIM VERBATIM Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz =for image flower.gif =begin text =head2 Not really a command VERBATIM VERBATIM VERBATIM Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz =end text =head2 Really a commmand. Pod-Tree-1.31/t/pod2html.d/for.exp0000644000175000017500000000063313377746260016154 0ustar manwarmanwar

HEAD

Line 1
<Line 2>

Steven

	VERBATIM
	VERBATIM
	VERBATIM

Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz

Really a commmand.

Pod-Tree-1.31/t/pod2html.d/values.pl0000644000175000017500000000015213377746260016500 0ustar manwarmanwaruse 5.006; use strict; use warnings; $Pod::Tree::HTML::color = 'black'; $Pod::Tree::HTML::part = 'hair'; Pod-Tree-1.31/t/pod2html.d/link.exp0000644000175000017500000000452413377746260016326 0ustar manwarmanwar Links

NAME

Links

Original

A name manual page.

An name/ident item in manual page.

A name/"sec" section in other manual page.

A "sec" section in this manual page (the quotes are not optional).

A sec section in this manual page

A sec tion section in this manual page

A mod::ule.foo link to a module POD

A /"sec" section in this manual page (the quotes are optional).

Total Control

A text manual page.

An text item in manual page.

A text section in other manual page.

A text section in this manual page (quotes are not optional).

A text section in this manual page

A text section in this manual page

A text link to a module POD

A text section in this manual page (quotes are optional).

Targets

Links

/target

"target with spaces"

" target w/spaces "

"target with line breaks"

/italic target

page/section

http://world.std.com/~swmcd/steven/index.html

Steven McDougall

Pod-Tree-1.31/t/pod2html.d/cut.exp_t0000644000175000017500000000046413377746260016506 0ustar manwarmanwar POD

TEMPLATE

black is the color of my true love's hair

In pod.

POD

More in pod.

Pod-Tree-1.31/t/pod2html.d/paragraph.exp_t0000644000175000017500000000076013377746260017657 0ustar manwarmanwar Head 1 text

TEMPLATE

black is the color of my true love's hair

HEAD1

Head 1 text

HEAD2

Head2 text

    +------------------------------+
    | This is a verbatim paragraph |
    +------------------------------+
Pod-Tree-1.31/t/pod2html.d/list.pod0000644000175000017500000000320313377746260016323 0ustar manwarmanwar=head1 NAME Lists =head2 Bullet =over 4 =item * foo =item * bar =item * baz =back =head2 Number =over 4 =item 1 foo =item 2 bar =item 3 baz =back =head2 Text =over 4 =item do a deer, a female deer =item ray a drop of goden sun =item me me, a name, I call myself =item fa a long, long way to run =back =over 4 =item * do a deer, a female deer =item * ray a drop of goden sun =back =over 4 =item 3 me me, a name, I call myself =item 4 fa a long, long way to run =back =head2 Siblings =over 4 =item * Star 1 Para 1 Star 1 Para 2 Star 1 Para 3 =item * Star 2 Star 2 Verbatim 1 Star 2 Verbatim 2 Star 2 Verbatim 3 =item * Star 3 =back =head2 Markups =over 4 =item term 1 definition 1 =item I C =item I> S =back =head2 Nested =over 4 =item * Level 1, Star 1 of 2 =over 4 =item * Level 2, Star 1 of 2 =item * Level 2, Star 2 of 2 =back =item * =over 4 =item 1 Level 2, Number 1 of 2 =item 2 Level 2, Number 2 of 2 =back =back =over 4 =item Level 1, term 1 of 2 =over 4 =item * Level 2, Star 1 of 3 =item * Level 2, Star 2 of 3 =item * Level 2, Star 3 of 3 =back =item Level 1, term 2 of 2 =over 4 =item * Level 2, Star 1 of 3 =over 4 =item 1 Level 3, Number 1 of 2 =item 2 Level 3, Number 2 of 2 =back =item * Level 2, Star 2 of 3 =item * Level 2, Star 3 of 3 =back =back =head2 Pathological =over 8 =item * Over 8 =back =over 4 =item * Star 1 =item 2 Number 2 =item Term 3 Definition 3 =back Empty =over 4 =back =over 4 No Items =back =over 4 =item * Star 1 =item * No =back Pod-Tree-1.31/t/pod2html.d/link.exp_t0000644000175000017500000000473613377746260016656 0ustar manwarmanwar Links

TEMPLATE

black is the color of my true love's hair

NAME

Links

Original

A name manual page.

An name/ident item in manual page.

A name/"sec" section in other manual page.

A "sec" section in this manual page (the quotes are not optional).

A sec section in this manual page

A sec tion section in this manual page

A mod::ule.foo link to a module POD

A /"sec" section in this manual page (the quotes are optional).

Total Control

A text manual page.

An text item in manual page.

A text section in other manual page.

A text section in this manual page (quotes are not optional).

A text section in this manual page

A text section in this manual page

A text link to a module POD

A text section in this manual page (quotes are optional).

Targets

Links

/target

"target with spaces"

" target w/spaces "

"target with line breaks"

/italic target

page/section

http://world.std.com/~swmcd/steven/index.html

Steven McDougall

Pod-Tree-1.31/t/pod2html.d/paragraph.exp0000644000175000017500000000054613377746260017336 0ustar manwarmanwar Head 1 text

HEAD1

Head 1 text

HEAD2

Head2 text

    +------------------------------+
    | This is a verbatim paragraph |
    +------------------------------+
Pod-Tree-1.31/t/pod2html.d/paragraph.pod0000644000175000017500000000025313377746260017317 0ustar manwarmanwar=head1 HEAD1 Head 1 text =head2 HEADI<2> Head2 B +------------------------------+ | This is a verbatim paragraph | +------------------------------+ Pod-Tree-1.31/t/pod2html.d/cut.exp_tv0000644000175000017500000000046213377746260016672 0ustar manwarmanwar POD

TEMPLATE

red is the color of my true love's hair

In pod.

POD

More in pod.

Pod-Tree-1.31/t/pod2html.d/list.exp_t0000644000175000017500000000514413377746260016666 0ustar manwarmanwar Lists

TEMPLATE

black is the color of my true love's hair

NAME

Lists

Bullet

  • foo
  • bar
  • baz

Number

  1. foo
  2. bar
  3. baz

Text

do
a deer, a female deer
ray
a drop of goden sun
me
me, a name, I call myself
fa
a long, long way to run
* do
a deer, a female deer
* ray
a drop of goden sun
3 me
me, a name, I call myself
4 fa
a long, long way to run

Siblings

  • Star 1 Para 1

    Star 1 Para 2

    Star 1 Para 3

  • Star 2

    	Star 2 Verbatim 1
    	Star 2 Verbatim 2
    	Star 2 Verbatim 3
  • Star 3

Markups

term 1
definition 1
term 2
definition 2
term 3
definition 3

Nested

  • Level 1, Star 1 of 2

    • Level 2, Star 1 of 2
    • Level 2, Star 2 of 2
    1. Level 2, Number 1 of 2
    2. Level 2, Number 2 of 2
Level 1, term 1 of 2
  • Level 2, Star 1 of 3
  • Level 2, Star 2 of 3
  • Level 2, Star 3 of 3
Level 1, term 2 of 2
  • Level 2, Star 1 of 3

    1. Level 3, Number 1 of 2
    2. Level 3, Number 2 of 2
  • Level 2, Star 2 of 3
  • Level 2, Star 3 of 3

Pathological

  • Over 8
  • Star 1
  • Number 2
  • Term 3
    Definition 3

Empty

No Items

  • Star 1
  • No =back
Pod-Tree-1.31/t/pod2html.d/paragraph.exp_tv0000644000175000017500000000075613377746260020052 0ustar manwarmanwar Head 1 text

TEMPLATE

red is the color of my true love's hair

HEAD1

Head 1 text

HEAD2

Head2 text

    +------------------------------+
    | This is a verbatim paragraph |
    +------------------------------+
Pod-Tree-1.31/t/pod2html.d/list.exp_tv0000644000175000017500000000514213377746260017052 0ustar manwarmanwar Lists

TEMPLATE

red is the color of my true love's hair

NAME

Lists

Bullet

  • foo
  • bar
  • baz

Number

  1. foo
  2. bar
  3. baz

Text

do
a deer, a female deer
ray
a drop of goden sun
me
me, a name, I call myself
fa
a long, long way to run
* do
a deer, a female deer
* ray
a drop of goden sun
3 me
me, a name, I call myself
4 fa
a long, long way to run

Siblings

  • Star 1 Para 1

    Star 1 Para 2

    Star 1 Para 3

  • Star 2

    	Star 2 Verbatim 1
    	Star 2 Verbatim 2
    	Star 2 Verbatim 3
  • Star 3

Markups

term 1
definition 1
term 2
definition 2
term 3
definition 3

Nested

  • Level 1, Star 1 of 2

    • Level 2, Star 1 of 2
    • Level 2, Star 2 of 2
    1. Level 2, Number 1 of 2
    2. Level 2, Number 2 of 2
Level 1, term 1 of 2
  • Level 2, Star 1 of 3
  • Level 2, Star 2 of 3
  • Level 2, Star 3 of 3
Level 1, term 2 of 2
  • Level 2, Star 1 of 3

    1. Level 3, Number 1 of 2
    2. Level 3, Number 2 of 2
  • Level 2, Star 2 of 3
  • Level 2, Star 3 of 3

Pathological

  • Over 8
  • Star 1
  • Number 2
  • Term 3
    Definition 3

Empty

No Items

  • Star 1
  • No =back
Pod-Tree-1.31/t/pod2html.d/sequence.pod0000644000175000017500000000143513377746260017165 0ustar manwarmanwar=head1 NAME B [-n] I =head1 DESCRIPTION =Z<>head1 introduces a 1st level heading. B sends I to a printer. B, I, zeZ<>ro, B, bold> normal. S, C<0>. C, B>, F, X E, E, E, E, E<65>, E B, E, E, E, E<65>, E> I, E, E, E, E<65>, E>> E E E E E E E E E C<< $a <=> $b >>, C<<< $a <=> $b >>> C<< B<<< $foo->bar >>> >>, I< C<< B<<< $foo->bar >>> >> >, An C<<<< L >>>> markup. C<<< $a << $b >>>, B< C<<< $a >> $b >>> >; see Lpattern) >>>. see Lpattern)>. C>>>> Pod-Tree-1.31/t/pod2html.d/sequence.exp_tv0000644000175000017500000000250313377746260017705 0ustar manwarmanwar print [-n] file

TEMPLATE

red is the color of my true love's hair

NAME

print [-n] file

DESCRIPTION

=head1 introduces a 1st level heading. print sends file to a printer. bold, italic, zero, bold, bold italic, bold normal. Non-breaking space, 0.

code, bold code, file, <, >, /, |, A, À <, >, /, |, A, À <, >, /, |, A, À

© ° ÷ ½ µ · ¬ ® ×

$a <=> $b, $a <=> $b

$foo->bar, $foo->bar ,

An page/section markup.

$a << $b, $a >> $b ;

see (?>pattern).

see No backtracking.

Italic Bold Code

Pod-Tree-1.31/t/pod2html.d/for.exp_t0000644000175000017500000000106513377746260016477 0ustar manwarmanwar

TEMPLATE

black is the color of my true love's hair

HEAD

Line 1
<Line 2>

Steven

	VERBATIM
	VERBATIM
	VERBATIM

Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz

Really a commmand.

Pod-Tree-1.31/t/pod2html.d/list.exp0000644000175000017500000000473213377746260016345 0ustar manwarmanwar Lists

NAME

Lists

Bullet

  • foo
  • bar
  • baz

Number

  1. foo
  2. bar
  3. baz

Text

do
a deer, a female deer
ray
a drop of goden sun
me
me, a name, I call myself
fa
a long, long way to run
* do
a deer, a female deer
* ray
a drop of goden sun
3 me
me, a name, I call myself
4 fa
a long, long way to run

Siblings

  • Star 1 Para 1

    Star 1 Para 2

    Star 1 Para 3

  • Star 2

    	Star 2 Verbatim 1
    	Star 2 Verbatim 2
    	Star 2 Verbatim 3
  • Star 3

Markups

term 1
definition 1
term 2
definition 2
term 3
definition 3

Nested

  • Level 1, Star 1 of 2

    • Level 2, Star 1 of 2
    • Level 2, Star 2 of 2
    1. Level 2, Number 1 of 2
    2. Level 2, Number 2 of 2
Level 1, term 1 of 2
  • Level 2, Star 1 of 3
  • Level 2, Star 2 of 3
  • Level 2, Star 3 of 3
Level 1, term 2 of 2
  • Level 2, Star 1 of 3

    1. Level 3, Number 1 of 2
    2. Level 3, Number 2 of 2
  • Level 2, Star 2 of 3
  • Level 2, Star 3 of 3

Pathological

  • Over 8
  • Star 1
  • Number 2
  • Term 3
    Definition 3

Empty

No Items

  • Star 1
  • No =back
Pod-Tree-1.31/t/pod2html.d/for.exp_tv0000644000175000017500000000106313377746260016663 0ustar manwarmanwar

TEMPLATE

red is the color of my true love's hair

HEAD

Line 1
<Line 2>

Steven

	VERBATIM
	VERBATIM
	VERBATIM

Fee, Fie, Foe, Fum Foo, Bar, Baz, Buz

Really a commmand.

Pod-Tree-1.31/t/19-tree.t0000644000175000017500000000136213377746260014250 0ustar manwarmanwaruse 5.006; use strict; use warnings; use Test::More tests => 9; use Pod::Tree; use Path::Tiny qw(path); my $Dir = "t/tree.d"; Parse(); HasPod( "cut.pod", 1 ); HasPod( "code.pm", 0 ); HasPod( "empty.pod", 0 ); sub Parse { for my $file (qw(cut paragraph list sequence link for)) { my $tree = Pod::Tree->new; my $pod = "$Dir/$file.pod"; $tree->load_file($pod) or die "Can't load $pod: $!\n"; my $actual = $tree->dump; my $expected = path("$Dir/$file.exp")->slurp; is $actual, $expected; path("$Dir/$file.act")->spew($actual); } } sub HasPod { my ( $file, $expected ) = @_; my $tree = Pod::Tree->new; my $pod = "$Dir/$file"; $tree->load_file($pod) or die "Can't load $pod: $!\n"; ok !( $tree->has_pod xor $expected ); } Pod-Tree-1.31/t/15-pod.t0000644000175000017500000000123113377746260014062 0ustar manwarmanwaruse 5.006; use strict; use warnings; use Path::Tiny qw(path); use Test::More tests => 6; use Pod::Tree; use Pod::Tree::Pod; my $dir = "t/pod.d"; for my $file (qw(cut paragraph list sequence for link)) { my $tree = Pod::Tree->new; $tree->load_file("$dir/$file.pod"); my $actual = IO::String->new; my $pod = Pod::Tree::Pod->new( $tree, $actual ); $pod->translate; my $expected = path("$dir/$file.pod")->slurp; is $$actual, $expected; path("$dir/$file.act")->spew($$actual); } ##no critic (RequireFilenameMatchesPackage) package IO::String; sub new { my $self = ''; bless \$self, shift; } sub print { my $self = shift; $$self .= join( '', @_ ); } Pod-Tree-1.31/pod.css0000644000175000017500000000102213377746260013717 0ustar manwarmanwar/* Example style sheet for pod*2html converters */ a:link { background: #ff8080 } body { background: #f0f0f0 } code { background: #c0ffc0 } dd { background: #ffffe0 } dl { background: #fffff0 } dt { background: #ffffc0 } h1 { background: #ffc0c0 } h2 { background: #ffe0e0 } hr { background: #ff0000; height: 5px } i { background: #ffc0c0 } li { background: #e0e0e0 } ol { background: #fff0ff } p { background: #f0f0ff } pre { background: #f0fff0 } ul { background: #f0ffff } Pod-Tree-1.31/lib/0000755000175000017500000000000013433752154013166 5ustar manwarmanwarPod-Tree-1.31/lib/Pod/0000755000175000017500000000000013433752154013710 5ustar manwarmanwarPod-Tree-1.31/lib/Pod/Tree.pm0000644000175000017500000002575413433574665015173 0ustar manwarmanwar# Copyright (c) 1999-2009 by Steven McDougall. This module is free # software; you can redistribute it and/or modify it under the same # terms as Perl itself. package Pod::Tree; use 5.006; use strict; use warnings; use IO::File; use Pod::Tree::Node; use Pod::Tree::Stream; our $VERSION = '1.31'; sub new { my $class = shift; my $tree = { loaded => 0, paragraphs => [] }; bless $tree, $class; } sub load_file { my ( $tree, $file, %options ) = @_; Pod::Tree::Node->set_filename($file); my $fh = IO::File->new; $fh->open($file) or return ''; $tree->load_fh( $fh, %options ); Pod::Tree::Node->set_filename(""); 1; } sub load_fh { my ( $tree, $fh, %options ) = @_; $tree->{in_pod} = 0; $tree->_load_options(%options); my $limit = $tree->{limit}; my $stream = Pod::Tree::Stream->new($fh); my $paragraph; my @paragraphs; while ( $paragraph = $stream->get_paragraph ) { push @paragraphs, $paragraph; $limit and $limit == @paragraphs and last; } $tree->{paragraphs} = \@paragraphs; $tree->_parse; } sub load_string { my ( $tree, $string, %options ) = @_; my @chunks = split /( \n\s*\n | \r\s*\r | \r\n\s*\r\n )/x, $string; my (@paragraphs); while (@chunks) { push @paragraphs, join '', splice @chunks, 0, 2; } $tree->load_paragraphs( \@paragraphs, %options ); } sub load_paragraphs { my ( $tree, $paragraphs, %options ) = @_; $tree->{in_pod} = 1; $tree->_load_options(%options); my $limit = $tree->{limit}; my @paragraphs = @$paragraphs; $limit and splice @paragraphs, $limit; $tree->{paragraphs} = \@paragraphs; $tree->_parse; } sub loaded { shift->{'loaded'} } sub _load_options { my ( $tree, %options ) = @_; my ( $key, $value ); while ( ( $key, $value ) = each %options ) { $tree->{$key} = $value; } } sub _parse { my $tree = shift; $tree->_make_nodes; $tree->_make_for; $tree->_make_sequences; my $root = $tree->{root}; $root->parse_links; $root->unescape; $root->consolidate; $root->make_lists; $tree->{'loaded'} = 1; } sub _add_paragraph { my ( $tree, $paragraph ) = @_; for ($paragraph) { /^=cut/ and do { $tree->{in_pod} = 0; last; }; $tree->{in_pod} and do { push @{ $tree->{paragraphs} }, $paragraph; last; }; /^=\w/ and do { $tree->{in_pod} = 1; push @{ $tree->{paragraphs} }, $paragraph; last; }; } } my %Command = map { $_ => 1 } qw(=pod =cut =head1 =head2 =head3 =head4 =over =item =back =for =begin =end); sub _make_nodes { my $tree = shift; my $paragraphs = $tree->{paragraphs}; my $in_pod = $tree->{in_pod}; my @children; for my $paragraph (@$paragraphs) { my ($word) = split( /\s/, $paragraph ); my $node; if ($in_pod) { if ( $paragraph =~ /^\s/ ) { $node = Pod::Tree::Node->verbatim($paragraph); } elsif ( $Command{$word} ) { $node = Pod::Tree::Node->command($paragraph); $in_pod = $word ne '=cut'; } else { $node = Pod::Tree::Node->ordinary($paragraph); } } else { if ( $Command{$word} ) { $node = Pod::Tree::Node->command($paragraph); $in_pod = $word ne '=cut'; } else { $node = Pod::Tree::Node->code($paragraph); } } push @children, $node; } $tree->{root} = Pod::Tree::Node->root( \@children ); } sub _make_for { my $tree = shift; my $root = $tree->{root}; my $old = $root->get_children; my @new; while (@$old) { my $node = shift @$old; $node->is_c_for and $node->force_for; $node->is_c_begin and $node->parse_begin($old); push @new, $node; } $root->set_children( \@new ); } sub _make_sequences { my $tree = shift; my $root = $tree->{root}; my $nodes = $root->get_children; for my $node (@$nodes) { $node->is_code and next; $node->is_verbatim and next; $node->is_for and next; $node->make_sequences; } } sub dump { my $tree = shift; $tree->{root}->dump; } sub get_root { shift->{root} } sub set_root { my ( $tree, $root ) = @_; $tree->{root} = $root; } sub push { my ( $tree, @nodes ) = @_; my $root = $tree->{root}; my $children = $root->get_children; push @$children, @nodes; } sub pop { my $tree = shift; my $root = $tree->get_root; my $children = $root->get_children; pop @$children; } sub walk { my ( $tree, $sub ) = @_; my $root = $tree->get_root; _walk( $root, $sub ); } sub _walk { my ( $tree, $sub ) = @_; my $descend = &$sub($tree); # :TRICKY: sub can modify node $descend or return; my $node = $tree; my $children = $node->get_children; for my $child (@$children) { _walk( $child, $sub ); } my $siblings = $node->get_siblings; for my $sibling (@$siblings) { _walk( $sibling, $sub ); } } sub has_pod { my $tree = shift; my $root = $tree->get_root; my $children = $root->get_children; scalar grep { $_->get_type ne 'code' } @$children; } 1 __END__ =head1 NAME Pod::Tree - Create a static syntax tree for a POD =head1 SYNOPSIS use Pod::Tree; $tree = Pod::Tree->new; $tree->load_file ( $file, %options) $tree->load_fh ( $fh , %options); $tree->load_string ( $pod , %options); $tree->load_paragraphs(\@pod , %options); $loaded = $tree->loaded; $node = $tree->get_root; $tree->set_root ($node); $node = $tree->pop; $tree->push(@nodes); $tree->walk(\&sub); $tree->has_pod and ... print $tree->dump; =head1 EXPORTS Nothing =head1 DESCRIPTION C parses a POD into a static syntax tree. Applications walk the tree to recover the structure and content of the POD. See L> for a description of the tree. =head1 METHODS =over 4 =item I<$tree> = C->C Creates a new C object. The syntax tree is initially empty. =item I<$ok> = I<$tree>->C(I<$file>, I<%options>) Parses a POD and creates a syntax tree for it. I<$file> is the name of a file containing the POD. Returns null iff it can't open I<$file>. See L for a description of I<%options> =item I<$tree>->C(I<$fh>, I<%options>) Parses a POD and creates a syntax tree for it. I<$fh> is an C object that is open on a file containing the POD. See L for a description of I<%options> =item I<$tree>->C(I<$pod>, I<%options>) Parses a POD and creates a syntax tree for it. I<$pod> is a single string containing the POD. See L for a description of I<%options> =item I<$tree>->C(\I<@pod>, I<%options>) Parses a POD and creates a syntax tree for it. I<\@pod> is a reference to an array of strings. Each string is one paragraph of the POD. See L for a description of I<%options> =item I<$loaded> = I<$tree>->C Returns true iff one of the C* methods has been called on I<$tree>. =item I<$node> = I<$tree>->C Returns the root node of the syntax tree. See L for a description of the syntax tree. =item I<$tree>->C(I<$node>) Sets the root of the syntax tree to I<$node>. =item I<$tree>->C(I<@nodes>) Pushes I<@nodes> onto the end of the top-level list of nodes in I<$tree>. =item I<$node> = I<$tree>->C Pops I<$node> off of the end of the top-level list of nodes in I<$tree>. =item I<$tree>->C(I<\&sub>) Walks the syntax tree, depth first. Calls I once for each node in the tree. The current node is passed as the first argument to I. C descends to the children and siblings of I<$node> iff I returns true. =item I<$tree>->C Returns true iff I<$tree> contains POD paragraphs. =item I<$tree>->C Pretty prints the syntax tree. This will show you how C interpreted your POD. =back =head1 OPTIONS These options may be passed in the I<%options> hash to the C* methods. =over 4 =item C<< in_pod => 0 >> =item C<< in_pod => 1 >> Sets the initial value of C. When C is false, the parser ignores all text until the next =command paragraph. The initial value of C defaults to false for C and C calls and true for C and C calls. This is usually what you want, unless you want consistency. If this isn't what you want, pass different initial values in the I<%options> hash. =item C => I Only parse the first I paragraphs in the POD. =back =head1 DIAGNOSTICS =over 4 =item C(I<$file>) Returns null iff it can't open I<$file>. =back =head1 NOTES =head2 No round-tripping Currently, C does not provide a complete, exact representation of its input. For example, it doesn't distingish between C<$foo-Ebar> and C<< $foo->bar >> As a result, it is not guaranteed that a file can be exactly reconstructed from its C representation. =head2 LZ<><> markups In the documentation of the L<"sec"> section in this manual page markup, L> has always claimed (the quotes are optional) However, there is no way to decide from the syntax alone whether L is a link to the F man page or a link to the C section of this man page. C parses C<< LZ<> >> as a link to a section if C looks like a section name (e.g. contains whitespace), and as a link to a man page otherswise. In practice, this tends to break links to sections. If you want your section links to work reliably, write them as C<< LZ<><"foo"> >> or C<< LZ<> >>. =head1 SEE ALSO perl(1), L>, L> =head1 ACKNOWLEDGMENTS =over 4 =item * =item * =item * Paul Bettinger =item * Sean M. Burke =item * Brad Choate =item * Havard Eidnes =item * Rudi Farkas =item * Paul Gibeault =item * Jay Hannah =item * Paul Hawkins =item * Jost Krieger =item * Marc A. Lehmann =item * Jonas Liljegren =item * Thomas Linden =item * Johan Lindstrom =item * Terry Luedtke =item * Rob Napier =item * Kate L Pugh =item * Christopher Shalah =item * Johan Vromans =back =head1 AUTHOR Steven McDougall Currently maintained by Mohammad S Anwar =head1 COPYRIGHT Copyright (c) 1999-2009 by Steven McDougall. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Pod-Tree-1.31/lib/Pod/Tree/0000755000175000017500000000000013433752154014607 5ustar manwarmanwarPod-Tree-1.31/lib/Pod/Tree/PerlLib.pm0000644000175000017500000001621313433574665016512 0ustar manwarmanwarpackage Pod::Tree::PerlLib; use 5.006; use strict; use warnings; use HTML::Stream; use Pod::Tree; use Pod::Tree::HTML; use Pod::Tree::PerlUtil; our $VERSION = '1.31'; use base qw(Pod::Tree::PerlUtil); use constant COLUMN_WIDTH => 30; sub new { my ( $class, $perl_dir, $html_dir, $link_map, %options ) = @_; my %defaults = ( col_width => COLUMN_WIDTH, bgcolor => '#ffffff', text => '#000000' ); my $options = { %defaults, %options, link_map => $link_map }; my %stop_files = map { $_ => 1 } qw(perllocal.pod); my $perl_lib = { perl_dir => $perl_dir, html_dir => $html_dir, lib_dir => 'lib', top_page => 'lib.html', stop_files => \%stop_files, options => $options }; bless $perl_lib, $class; } sub scan { my ( $perl_lib, @dirs ) = @_; $perl_lib->report1("scan"); # Don't try to install PODs for modules on relative paths in @INC # (Typically `.') @dirs = grep {m(^/)} @dirs; $perl_lib->_stop_dirs(@dirs); for my $dir (@dirs) { $perl_lib->{find_dir} = $dir; File::Find::find( { wanted => sub { $perl_lib->_scan }, # Closures rock! no_chdir => 1 }, $dir ); } } sub _stop_dirs { my ( $perl_lib, @dirs ) = @_; for my $dir (@dirs) { for my $stop_dir (@dirs) { $stop_dir =~ /^$dir./ and $perl_lib->{stop_dir}{$dir}{$stop_dir} = 1; } } } sub _scan { my $perl_lib = shift; my $source = $File::Find::name; -d $source and $perl_lib->_scan_dir($source); -f $source and $perl_lib->_scan_file($source); } sub _scan_dir { my ( $perl_lib, $dir ) = @_; my $find_dir = $perl_lib->{find_dir}; if ( $perl_lib->{stop_dir}{$find_dir}{$dir} or $dir =~ /pod$/ ) { $File::Find::prune = 1; return; } my $html_dir = $perl_lib->{html_dir}; my $lib_dir = $perl_lib->{lib_dir}; $dir =~ s(^$find_dir)($html_dir/$lib_dir); $perl_lib->mkdir($dir); } sub _scan_file { my ( $perl_lib, $source ) = @_; $source =~ m(\. (?: pl | pm | pod ) $ )x or return; my $file = ( split m(/), $source )[-1]; $perl_lib->{stop_files}{$file} and return; my $module = $source; my $find_dir = $perl_lib->{find_dir}; $module =~ s(^$find_dir/)(); $module =~ s( \.\w+$ )()x; # Foo/Bar my $html_dir = $perl_lib->{html_dir}; my $lib_dir = $perl_lib->{lib_dir}; my $dest = "$html_dir/$lib_dir/$module.html"; my ( $name, $description ) = $perl_lib->get_name($source); $name or return; $perl_lib->report2($name); my $href = "$module.html"; my $link = "$lib_dir/$module"; my $entry = { source => $source, # .../Foo/Bar.pm dest => $dest, # .../html/lib/Foo/Bar.html href => $href, # Foo/Bar.html description => $description }; $perl_lib->{index}{$name} = $entry; $perl_lib->{options}{link_map}->add_page( $name, $link ); } sub index { my $perl_lib = shift; $perl_lib->report1("index"); my $html_dir = $perl_lib->{html_dir}; my $top_page = $perl_lib->{top_page}; my $dest = "$html_dir/$top_page"; my $fh = IO::File->new(">$dest"); defined $fh or die "Pod::Tree::PerlLib::index: Can't open $dest: $!\n"; my $stream = HTML::Stream->new($fh); my $options = $perl_lib->{options}; my $bgcolor = $options->{bgcolor}; my $text = $options->{text}; my $title = "Perl Modules"; $stream->HTML->HEAD; $stream->TITLE->text($title)->_TITLE; $stream->_HEAD->BODY( BGCOLOR => $bgcolor, TEXT => $text ); $stream->H1->t($title)->_H1; $perl_lib->_emit_entries($stream); $stream->_BODY->_HTML; } sub get_top_entry { my $perl_lib = shift; +{ URL => $perl_lib->{top_page}, description => 'Modules' }; } sub _emit_entries { my ( $perl_lib, $stream ) = @_; my $lib_dir = $perl_lib->{lib_dir}; my $index = $perl_lib->{index}; my $options = $perl_lib->{options}; my $col_width = $options->{col_width}; $stream->PRE; for my $name ( sort keys %$index ) { my $entry = $index->{$name}; my $href = $entry->{href}; my $desc = $entry->{description}; my $pad = $col_width - length $name; $stream->A( HREF => "$lib_dir/$href" )->t($name)->_A; $pad < 1 and do { $stream->nl; $pad = $col_width; }; $stream->t( ' ' x $pad, $desc )->nl; } $stream->_PRE; } sub translate { my $perl_lib = shift; $perl_lib->report1("translate"); my $index = $perl_lib->{index}; my $options = $perl_lib->{options}; for my $name ( sort keys %$index ) { $perl_lib->report2($name); my @path = split m(::), $name; my $depth = @path; # no -1 because they are all under /lib/ $options->{link_map}->set_depth($depth); my $entry = $index->{$name}; my $source = $entry->{source}; my $dest = $entry->{dest}; my $html = Pod::Tree::HTML->new( $source, $dest, %$options ); $html->translate; } } 1 __END__ =head1 NAME Pod::Tree::PerlLib - translate module PODs to HTML =head1 SYNOPSIS $perl_map = Pod::Tree::PerlMap->new; $perl_lib = Pod::Tree::PerlLib->new( $perl_dir, $HTML_dir, $perl_map, %opts ); $perl_lib->scan(@INC); $perl_lib->index; $perl_lib->translate; $top = $perl_lib->get_top_entry; =head1 DESCRIPTION C translates module PODs to HTML. It does a recursive subdirectory search through a list of directories (typically C<@INC>) to find PODs. C generates a top-level index of all the PODs that it finds, and writes it to IC. C generates and uses an index of the PODs that it finds to construct HTML links. Other modules can also use this index. =head1 METHODS =over 4 =item I<$perl_lib> = C C I<$perl_dir>, I<$HTML_dir>, I<$perl_map>, I<%options> Creates and returns a new C object. I<$HTML_dir> is the directory where HTML files will be written. I<$perl_map> maps module names to URLs. I<%options> are passed through to C. The I<$perl_dir> argument is included for consistency with the other C modules, but is currently unused. =item I<$perl_lib>->C(I<@INC>) Does a recursive subdirectory search through I<@INC> to locate module PODs. Each module that is identified is entered into I<$perl_map>. =item I<$perl_lib>->C Generates a top-level index of all the modules. The index is written to IC. =item I<$perl_lib>->C Translates each module POD found by C to HTML. The HTML pages are written to IC, in a subdirectory hierarchy that maps the module names. =item I<$perl_lib>->C Returns a hash reference of the form { URL => $URL, description => $description } C uses this to build a top-level index of all the Perl PODs. =back =head1 LINKING C expects the second paragraph of the POD to have the form Foo::Bar - description and enters I into I<$perl_map>. To link to a module POD, write L =head1 REQUIRES 5.005; HTML::Stream; Pod::Tree; Pod::Tree::HTML; Pod::Tree::PerlUtil; =head1 EXPORTS Nothing. =head1 SEE ALSO L>, L> =head1 AUTHOR Steven McDougall, swmcd@world.std.com =head1 COPYRIGHT Copyright (c) 2000 by Steven McDougall. This module is free software; you can redistribute it and/or modify it under the same terms as Perl. Pod-Tree-1.31/lib/Pod/Tree/Stream.pm0000644000175000017500000000117013433574665016410 0ustar manwarmanwarpackage Pod::Tree::Stream; use 5.006; use strict; use warnings; our $VERSION = '1.31'; sub new { my ( $package, $fh ) = @_; my $stream = { fh => $fh, line => '' }; bless $stream, $package; } sub get_paragraph { my $stream = shift; my $fh = $stream->{fh}; my $line = $stream->{line}; defined $line or return undef; ##no critic (ProhibitExplicitReturnUndef) my (@lines) = ($line); while ( $line = $fh->getline ) { push @lines, $line; $line =~ /\S/ or last; } while ( $line = $fh->getline ) { $line =~ /\S/ and last; push @lines, $line; } $stream->{line} = $line; join '', @lines; } 1; Pod-Tree-1.31/lib/Pod/Tree/HTML/0000755000175000017500000000000013433752154015353 5ustar manwarmanwarPod-Tree-1.31/lib/Pod/Tree/HTML/LinkMap.pm0000644000175000017500000000100313433574665017247 0ustar manwarmanwarpackage Pod::Tree::HTML::LinkMap; use 5.006; use strict; use warnings; our $VERSION = '1.31'; sub new { my $class = shift; bless {}, $class; } sub url { my ( $link_map, $html, $target ) = @_; my $depth = $html->{options}{depth}; my $base = join '/', ('..') x $depth; my $page = $target->get_page; $page =~ s(::)(/)g; $page .= '.html' if $page; my $section = $target->get_section; my $fragment = $html->escape_2396($section); my $url = $html->assemble_url( $base, $page, $fragment ); $url; } 1; Pod-Tree-1.31/lib/Pod/Tree/HTML/PerlTop.pm0000644000175000017500000000116213433574665017307 0ustar manwarmanwarpackage Pod::Tree::HTML::PerlTop; use 5.006; use strict; use warnings; use base qw(Pod::Tree::HTML); our $VERSION = '1.31'; sub set_links { my ( $html, $links ) = @_; $html->{links} = $links; } sub _emit_verbatim { my ( $html, $node ) = @_; my $stream = $html->{stream}; my $links = $html->{links}; my $text = $node->get_text; $text =~ s( \n\n$ )()x; my @words = split m/(\s+)/, $text; $stream->PRE; for my $word (@words) { if ( $links->{$word} ) { my $link = $links->{$word}; $stream->A( HREF => "$link.html" )->text($word)->_A; } else { $stream->text($word); } } $stream->_PRE; } 1; Pod-Tree-1.31/lib/Pod/Tree/PerlPod.pm0000644000175000017500000001462513433574665016533 0ustar manwarmanwarpackage Pod::Tree::PerlPod; use 5.006; use strict; use warnings; use File::Find; use HTML::Stream; use IO::File; use Pod::Tree::HTML; use Pod::Tree::PerlUtil; our $VERSION = '1.31'; use base qw(Pod::Tree::PerlUtil); sub new { my ( $class, $perl_dir, $html_dir, $link_map, %options ) = @_; my %defaults = ( col_width => 20, bgcolor => '#ffffff', text => '#000000' ); my $options = { %defaults, %options, link_map => $link_map }; my %special = map { $_ => 1 } qw(pod/perl pod/perlfunc); my $perl_pod = { perl_dir => $perl_dir, html_dir => $html_dir, top_page => 'pod.html', special => \%special, options => $options }; bless $perl_pod, $class; } sub scan { my $perl_pod = shift; $perl_pod->report1("scan"); my $perl_dir = $perl_pod->{perl_dir}; File::Find::find( { wanted => sub { $perl_pod->_scan }, # Perl rocks! no_chdir => 1 }, $perl_dir ); } sub _scan { my $perl_pod = shift; my $source = $File::Find::name; my $dest = $source; my $perl_dir = $perl_pod->{perl_dir}; my $html_dir = $perl_pod->{html_dir}; $dest =~ s(^$perl_dir)($html_dir); -d $source and $perl_pod->_scan_dir($dest); -f $source and $perl_pod->_scan_file( $source, $dest ); } sub _scan_dir { my ( $perl_pod, $dir ) = @_; $dir =~ m(/ext$) and do # extensions are handled by Pod::Tree::PerlLib { $File::Find::prune = 1; return; }; -d $dir or mkdir $dir, 0755 or die "Pod::Tree::PerlPod::_scan_dir: Can't mkdir $dir: $!\n"; } sub _scan_file { my ( $perl_pod, $source, $dest ) = @_; $source =~ m( (\w+)\.pod$ )x or return; my $link = $source; my $perl_dir = $perl_pod->{perl_dir}; $link =~ s(^$perl_dir/)(); $link =~ s( \.pod$ )()x; $perl_pod->report2($link); my $name = ( split m(/), $link )[-1]; my $desc = $perl_pod->get_description($source); $dest =~ s( \.\w+$ )(.html)x; my $pod = { name => $name, # perldata desc => $desc, # Perl data types link => $link, # pod/perldata source => $source, # .../perl5.5.650/pod/perldata.pod dest => $dest }; # .../public_html/perl/pod/perldata.html $perl_pod->{pods}{$link} = $pod; $perl_pod->{options}{link_map}->add_page( $name, $link ); } sub index { my $perl_pod = shift; $perl_pod->report1("index"); my $html_dir = $perl_pod->{html_dir}; my $top_page = $perl_pod->{top_page}; my $dest = "$html_dir/$top_page"; my $fh = IO::File->new(">$dest"); defined $fh or die "Pod::Tree::PerlPod::index: Can't open $dest: $!\n"; my $stream = HTML::Stream->new($fh); my $options = $perl_pod->{options}; my $bgcolor = $options->{bgcolor}; my $text = $options->{text}; my $title = "Perl PODs"; $stream->HTML->HEAD; $stream->TITLE->text($title)->_TITLE; $stream->_HEAD->BODY( BGCOLOR => $bgcolor, TEXT => $text ); $stream->H1->t($title)->_H1; $perl_pod->_emit_entries($stream); $stream->_BODY->_HTML; } sub get_top_entry { my $perl_dist = shift; +{ URL => $perl_dist->{top_page}, description => 'PODs' }; } sub _emit_entries { my ( $perl_pod, $stream ) = @_; my $pods = $perl_pod->{pods}; my $options = $perl_pod->{options}; my $col_width = $options->{col_width}; $stream->PRE; $pods = $perl_pod->{pods}; for my $link ( sort keys %$pods ) { my $pad = $col_width - length $link; $stream->A( HREF => "$link.html" )->t($link)->_A; $pad < 1 and do { $stream->nl; $pad = $col_width; }; $stream->t( ' ' x $pad, $pods->{$link}{desc} )->nl; } $stream->_PRE; } sub translate { my $perl_pod = shift; $perl_pod->report1("translate"); my $pods = $perl_pod->{pods}; my $special = $perl_pod->{special}; for my $link ( sort keys %$pods ) { $special->{$link} and next; $perl_pod->report2($link); $perl_pod->_translate($link); } } sub _translate { my ( $perl_pod, $link ) = @_; my $pod = $perl_pod->{pods}{$link}; my $source = $pod->{source}; my $dest = $pod->{dest}; my $options = $perl_pod->{options}; my @path = split m(\/), $link; my $depth = @path - 1; $options->{link_map}->set_depth($depth); my $html = Pod::Tree::HTML->new( $source, $dest, %$options ); $html->translate; } 1 __END__ =head1 NAME Pod::Tree::PerlPod - translate Perl PODs to HTML =head1 SYNOPSIS $perl_map = Pod::Tree::PerlMap->new; $perl_pod = Pod::Tree::PerlPod->new( $perl_dir, $HTML_dir, $perl_map, %opts ); $perl_pod->scan; $perl_pod->index; $perl_pod->translate; $top = $perl_pod->get_top_entry; =head1 DESCRIPTION C translates Perl PODs to HTML. It does a recursive subdirectory search through I<$perl_dir> to find PODs. C generates a top-level index of all the PODs that it finds, and writes it to IC. C generates and uses an index of the PODs that it finds to construct HTML links. Other modules can also use this index. =head1 METHODS =over 4 =item I<$perl_pod> = C C I<$perl_dir>, I<$HTML_dir>, I<$perl_map>, I<%options> Creates and returns a new C object. I<$perl_dir> is the root of the Perl source tree. I<$HTML_dir> is the directory where HTML files will be written. I<$perl_map> maps POD names to URLs. I<%options> are passed through to C. =item I<$perl_pod>->C; Does a recursive subdirectory search through I<$perl_dir> to locate PODs. Each POD that is located is entered into I<$perl_map>. =item I<$perl_pod>->C Generates a top-level index of all the PODs. The index is written to IC. =item I<$perl_pod>->C Translates each POD found by C to HTML. The HTML pages are written to I, in a subdirectory hierarchy that mirrors the the Perl source distribution. =item I<$perl_pod>->C Returns a hash reference of the form { URL => $URL, description => $description } C uses this to build a top-level index of all the Perl PODs. =back =head1 LINKING C indexes PODs by the base name of the POD file. To link to F, write L =head1 REQUIRES 5.005; File::Find; HTML::Stream; IO::File; Pod::Tree::HTML; Pod::Tree::PerlUtil; =head1 EXPORTS Nothing. =head1 SEE ALSO L>, L>, =head1 AUTHOR Steven McDougall, swmcd@world.std.com =head1 COPYRIGHT Copyright (c) 2000 by Steven McDougall. This module is free software; you can redistribute it and/or modify it under the same terms as Perl. Pod-Tree-1.31/lib/Pod/Tree/PerlFunc.pm0000644000175000017500000001614313433574665016701 0ustar manwarmanwarpackage Pod::Tree::PerlFunc; use 5.006; use strict; use warnings; use Pod::Tree; use Pod::Tree::HTML; use Pod::Tree::PerlUtil; our $VERSION = '1.31'; use base qw(Pod::Tree::PerlUtil); sub new { my ( $class, $perl_dir, $html_dir, $link_map, %options ) = @_; my %defaults = ( bgcolor => '#ffffff', text => '#000000' ); my $options = { %defaults, %options, link_map => $link_map }; my $perl_func = { perl_dir => $perl_dir, html_dir => $html_dir, pod_dir => 'pod', func_dir => 'func', page => 'perlfunc', options => $options }; bless $perl_func, $class; } sub scan { my $perl_func = shift; $perl_func->report1("scan"); $perl_func->load_tree; $perl_func->scan_tree; } sub load_tree { my $perl_func = shift; my $perl_dir = $perl_func->{perl_dir}; my $pod_dir = $perl_func->{pod_dir}; my $page = $perl_func->{page}; my $source = "$perl_dir/$pod_dir/$page.pod"; my $win_source = "$perl_dir/lib/$pod_dir/$page.pod"; my $tree = Pod::Tree->new; $tree->load_file($source) or # for building the doc set from a Perl distribution $tree->load_file($win_source) or # for building the doc set from a Windows installation die "Pod::Tree::PerlFunc::scan: Can't find $source or $win_source\n"; my $node = $tree->pop; my $funcs = $node->get_children; $perl_func->{tree} = $tree; $perl_func->{funcs} = $funcs; } sub scan_tree { my $perl_func = shift; my $funcs = $perl_func->{funcs}; my @funcs = @$funcs; my $link_map = $perl_func->{options}{link_map}; while (@funcs) { my @items = Shift_Items( \@funcs ); my ( $func0, $file0 ) = Parse_Name( $items[0] ); for my $item (@items) { my ( $func, $file ) = Parse_Name($item); $perl_func->report2($func); $perl_func->{index}{$func} = $file0; $link_map->add_func( $file, $file0 ); } } } sub index { my $perl_func = shift; $perl_func->report1("index"); $perl_func->add_links; $perl_func->add_index; my $tree = $perl_func->{tree}; my $html_dir = $perl_func->{html_dir}; my $pod_dir = $perl_func->{pod_dir}; my $page = $perl_func->{page}; my $options = $perl_func->{options}; $perl_func->mkdir("$html_dir/$pod_dir/"); $options->{link_map}->set_depth(1); my $dest = "$html_dir/$pod_dir/$page.html"; my $html = Pod::Tree::HTML->new( $tree, $dest, %$options ); $html->translate; } sub add_links { my $perl_func = shift; my $tree = $perl_func->{tree}; $tree->walk( sub { $perl_func->_add_links(shift) } ); } sub _add_links { my ( $perl_func, $node ) = @_; $node->is_sequence or return 1; $node->get_letter eq 'C' or return 1; my ($func) = Parse_Name($node); my $file = $perl_func->{index}{$func}; $file or return 1; # :TRICKY: *replaces* the node in the tree my $page = $perl_func->{page}; $_[1] = Pod::Tree::Node->link( $node, $page, $file ); 0; } sub add_index { my $perl_func = shift; my %funcs; my $index = $perl_func->{index}; for my $func ( sort keys %$index ) { my $file = $index->{$func}; my $letter = substr( $func, 0, 1 ); push @{ $funcs{$letter} }, [ $func, $file ]; } my $page = $perl_func->{page}; my @lines; for my $letter ( sort keys %funcs ) { my $funcs = $funcs{$letter}; my @links = map {"L[0]>|$page/$_->[1]>"} @$funcs; my $line = join ", ", @links; push @lines, $line; } my $pod = join "\n\n", @lines; my $tree = Pod::Tree->new; $tree->load_string($pod); my $children = $tree->get_root->get_children; $perl_func->{tree}->push(@$children); } sub translate { my $perl_func = shift; $perl_func->report1("translate"); my $html_dir = $perl_func->{html_dir}; my $pod_dir = $perl_func->{pod_dir}; my $func_dir = $perl_func->{func_dir}; $perl_func->mkdir("$html_dir/$pod_dir/$func_dir"); my $perl_dir = $perl_func->{perl_dir}; my $funcs = $perl_func->{funcs}; my $options = $perl_func->{options}; my $link_map = $options->{link_map}; $link_map->set_depth(2); $link_map->force_func(1); $options->{toc} = 0; while (@$funcs) { my @items = Shift_Items($funcs); my ( $func, $file ) = Parse_Name( $items[0] ); $perl_func->report2("func/$file"); my $tree = Pod::Tree->new; $tree->load_string("=head1 $func\n\n=over 4\n\n=back"); my $list = $tree->get_root->get_children->[1]; $list->set_children( \@items ); $list->_set_list_type; $options->{title} = $func; my $dest = "$html_dir/$pod_dir/$func_dir/$file.html"; my $html = Pod::Tree::HTML->new( $tree, $dest, %$options ); $html->translate; } $link_map->force_func(0); } sub Shift_Items { my $funcs = shift; my @items; while (@$funcs) { my $item = shift @$funcs; push @items, $item; @$funcs or last; my ($func0) = Parse_Name($item); my ($func1) = Parse_Name( $funcs->[0] ); my $sibs0 = $item->get_siblings; $func0 eq $func1 or @$sibs0 == 0 or last; } @items; } sub Parse_Name { my $item = shift; my $text = $item->get_deep_text; my @words = split m([^\w\-]+), $text; my $func = $words[0]; my $file = $func; $file =~ tr(A-Za-z0-9_-)()cd; ( $func, $file ); } 1 __END__ =head1 NAME Pod::Tree::PerlFunc - translate F to HTML =head1 SYNOPSIS $perl_map = Pod::Tree::PerlMap->new; $perl_func = Pod::Tree::PerlFunc->new($perl_dir, $HTML_dir, $perl_map, %opts); $perl_func->scan; $perl_func->index; $perl_func->translate; =head1 DESCRIPTION C translates F to HTML. It creates a separate HTML page for each function description in F. The pages for the individual descriptions are named after the function and written to a F subdirectory. F is generated as an index to all the pages in F. C generates and uses an index of the functions that it finds in F to construct HTML links. Other modules can also use this index. =head1 METHODS =over 4 =item I<$perl_func> = C C I<$perl_dir>, I<$HTML_dir>, I<$perl_map>, I<%options> Creates and returns a new C object. I<$perl_dir> is the root of the Perl source tree. I<$HTML_dir> is the directory where HTML files will be written. I<$perl_map> maps function names to URLs. I<%options> are passed through to C. =item I<$perl_func>->C Reads F and identifies all the functions in it. Each function that is identified is entered into I<$perl_map>. =item I<$perl_func>->C Generates a top-level index of all the functions. The index is written to IC. =item I<$perl_func>->C Translates each function found by C to HTML. The HTML pages are written to IC. =back =head1 LINKING C indexes every C<=item> paragraph in F. To link, for example, to the C function, write L =head1 REQUIRES 5.005; Pod::Tree; Pod::Tree::HTML; Pod::Tree::PerlUtil; =head1 EXPORTS Nothing. =head1 SEE ALSO L>, L>, =head1 AUTHOR Steven McDougall, swmcd@world.std.com =head1 COPYRIGHT Copyright (c) 2000 by Steven McDougall. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Pod-Tree-1.31/lib/Pod/Tree/Node.pm0000644000175000017500000007521713433574665016057 0ustar manwarmanwar# Copyright (c) 1999-2004 by Steven McDougall. This module is free # software; you can redistribute it and/or modify it under the same # terms as Perl itself. package Pod::Tree::Node; use 5.006; use strict; use warnings; use Pod::Escapes (); our $VERSION = '1.31'; sub root # ctor { my ( $class, $children ) = @_; my $node = { type => 'root', children => $children }; bless $node, $class; } sub code #ctor { my ( $class, $paragraph ) = @_; my $node = { type => 'code', text => $paragraph }; bless $node, $class; } sub verbatim # ctor { my ( $class, $paragraph ) = @_; my $node = { type => 'verbatim', raw => $paragraph, text => $paragraph }; bless $node, $class; } my %Argumentative = map { $_ => 1 } qw(=over =for =begin =end); sub command # ctor { my ( $class, $paragraph ) = @_; my ( $command, $arg, $text ); ($command) = split( /\s/, $paragraph ); if ( $Argumentative{$command} ) { ( $command, $arg, $text ) = split( /\s+/, $paragraph, 3 ); } else { ( $command, $text ) = split( /\s+/, $paragraph, 2 ); $arg = ''; } $command =~ s/^=//; my $node = { type => 'command', raw => $paragraph, command => $command, arg => $arg, text => $text }; bless $node, $class; } sub ordinary # ctor { my ( $class, $paragraph ) = @_; my $node = { type => 'ordinary', raw => $paragraph, text => $paragraph }; bless $node, $class; } sub letter # ctor { my ( $class, $token ) = @_; my $node = { type => 'letter', letter => substr( $token, 0, 1 ), width => $token =~ tr/ 'sequence', 'letter' => $letter->{'letter'}, children => $children }; bless $node, $class; } sub text # ctor { my ( $class, $text ) = @_; my $node = { type => 'text', text => $text }; bless $node, $class; } sub target # ctor { my ( $class, $children ) = @_; my $node = bless { type => 'target', children => $children }, $class; $node->unescape; my $text = $node->get_deep_text; if ( $text =~ m(^[A-Za-z]+:(?!:)) ) # a URL { $node->{page} = $text; $node->{section} = ''; $node->{domain} = 'HTTP'; } else # a POD link { my ( $page, $section ) = SplitTarget($text); $node->{page} = $page; $node->{section} = $section; $node->{domain} = 'POD'; } $node; } sub SplitTarget { my $text = shift; my ( $page, $section ); if ( $text =~ /^"(.*)"$/s ) # L<"sec">; { $page = ''; $section = $1; } else # all other cases { ( $page, $section ) = ( split( m(/), $text, 2 ), '', '' ); $page =~ s/\s*\(\d\)$//; # ls (1) -> ls $section =~ s( ^" | "$ )()xg; # lose the quotes # L
(without quotes) if ( $page !~ /^[\w.-]+(::[\w.-]+)*$/ and $section eq '' ) { $section = $page; $page = ''; } } $section =~ s( \s*\n\s* )( )xg; # close line breaks $section =~ s( ^\s+ | \s+$ )()xg; # clip leading and trailing WS ( $page, $section ); } sub link # ctor { my ( $class, $node, $page, $section ) = @_; my $target = bless { type => 'target', domain => 'POD', children => [$node], page => $page, section => $section }, $class; my $link = bless { type => 'sequence', letter => 'L', children => [$node], target => $target }, $class; $link; } sub is_code { shift->{type} eq 'code' } sub is_command { shift->{type} eq 'command' } sub is_for { shift->{type} eq 'for' } sub is_item { shift->{type} eq 'item' } sub is_letter { shift->{type} eq 'letter' } sub is_list { shift->{type} eq 'list' } sub is_ordinary { shift->{type} eq 'ordinary' } sub is_root { shift->{type} eq 'root' } sub is_sequence { shift->{type} eq 'sequence' } sub is_text { shift->{type} eq 'text' } sub is_verbatim { shift->{type} eq 'verbatim' } sub is_link { my $node = shift; $node->is_sequence and $node->{'letter'} eq 'L'; } sub is_pod { my $node = shift; not $node->is_code and not $node->is_c_cut and not $node->is_c_pod; } sub is_c_head1 { my $node = shift; $node->{type} eq 'command' and $node->{'command'} eq 'head1'; } sub is_c_head2 { my $node = shift; $node->{type} eq 'command' and $node->{'command'} eq 'head2'; } sub is_c_head3 { my $node = shift; $node->{type} eq 'command' and $node->{'command'} eq 'head3'; } sub is_c_head4 { my $node = shift; $node->{type} eq 'command' and $node->{'command'} eq 'head4'; } sub is_c_cut { my $node = shift; $node->{type} eq 'command' and $node->{'command'} eq 'cut'; } sub is_c_pod { my $node = shift; $node->{type} eq 'command' and $node->{'command'} eq 'pod'; } sub is_c_over { my $node = shift; $node->{type} eq 'command' and $node->{'command'} eq 'over'; } sub is_c_back { my $node = shift; $node->{type} eq 'command' and $node->{'command'} eq 'back'; } sub is_c_item { my $node = shift; $node->{type} eq 'command' and $node->{'command'} eq 'item'; } sub is_c_for { my $node = shift; $node->{type} eq 'command' and $node->{'command'} eq 'for'; } sub is_c_begin { my $node = shift; $node->{type} eq 'command' and $node->{'command'} eq 'begin'; } sub is_c_end { my $node = shift; $node->{type} eq 'command' and $node->{'command'} eq 'end'; } sub get_arg { shift->{arg} } sub get_back { shift->{back} } sub get_children { shift->{children} } sub get_command { shift->{'command'} } sub get_domain { shift->{domain} } sub get_item_type { shift->{item_type} } sub get_letter { shift->{'letter'} } sub get_list_type { shift->{list_type} } sub get_page { shift->{page} } sub get_raw { shift->{raw} } sub get_raw_kids { shift->{raw_kids} } sub get_section { shift->{section} } sub get_siblings { shift->{siblings} } sub get_target { shift->{'target'} } sub get_text { shift->{'text'} } sub get_type { shift->{'type'} } sub get_url { shift->{'url'} } sub get_brackets { my $node = shift; my $brackets = $node->{brackets}; $brackets; } sub get_deep_text { my $node = shift; for ( $node->get_type ) { /text/ and return $node->{'text'}; /verbatim/ and return $node->{'text'}; } join '', map { $_->get_deep_text } @{ $node->{children} }; } sub force_text { my ( $node, $text ) = @_; $node->{type} = 'text'; $node->{'text'} = $text; undef $node->{children}; } sub force_for { my $node = shift; $node->{type} = 'for'; my ($bracket) = $node->{raw} =~ /^(=\w+\s+\w+\s+)/; $node->{brackets} = [$bracket]; } sub parse_begin { my ( $node, $nodes ) = @_; my $foreign; my @raw; while (@$nodes) { $foreign = shift @$nodes; $foreign->is_c_end and last; push @raw, $foreign->{'raw'}; } $node->{'text'} = join '', @raw; my $interpreter = $foreign->{arg}; $interpreter and $interpreter ne $node->{arg} and $node->_warn("Mismatched =begin/=end tags around\n$node->{'text'}"); $node->{type} = 'for'; $node->{brackets} = [ $node->{raw}, $foreign->{raw} ]; } sub set_children { my ( $node, $children ) = @_; $node->{children} = $children; } sub make_sequences { my $node = shift; my $text = $node->{'text'}; my @tokens = split /( [A-Z]<<+\s+ | [A-Z]< | \s+>>+ | > )/x, $text; my $sequences = _parse_text( \@tokens ); $node->{children} = $sequences; } sub _parse_text { my $tokens = shift; my ( @stack, @width ); while (@$tokens) { my $token = shift @$tokens; length $token or next; $token =~ /^[A-Z]letter($token); push @stack, $node; next; }; @width and $token =~ />{$width[-1],}$/ and do { my $width = pop @width; my ( $letter, $interior ) = _pop_sequence( \@stack, $width ); my $node = Pod::Tree::Node->sequence( $letter, $interior ); push @stack, $node; $token =~ s/^\s*>{$width}//; my @tokens = split //, $token; unshift @$tokens, @tokens; next; }; my $node = Pod::Tree::Node->text($token); push @stack, $node; } if (@width) { my @text = map { $_->get_deep_text } @stack; Pod::Tree::Node->_warn("Missing '>' delimiter in\n@text"); } \@stack; } sub _pop_sequence { my ( $stack, $width ) = @_; my ( $node, @interior ); while (@$stack) { $node = pop @$stack; $node->is_letter and $node->{width} == $width and return ( $node, \@interior ); unshift @interior, $node; } my @text = map { $_->get_deep_text } @interior; $node->_warn("Mismatched sequence delimiters around\n@text"); $node = Pod::Tree::Node->letter(' '); $node, \@interior; } sub parse_links { my $node = shift; $node->is_link and $node->_parse_link; my $children = $node->{children}; for my $child (@$children) { $child->parse_links; } } sub _parse_link { my $node = shift; $node->{raw_kids} = $node->clone->{children}; my $children = $node->{children}; my ( $text_kids, $target_kids ) = SplitBar($children); $node->{children} = $text_kids; $node->{'target'} = Pod::Tree::Node->target($target_kids); } sub SplitBar { my $children = shift; my ( @text, @link ); while (@$children) { my $child = shift @$children; $child->is_text or do { push @text, $child; next; }; my ( $text, $link ) = split m(\|), $child->{'text'}, 2; $link and do { push @text, Pod::Tree::Node->text($text) if $text; push @link, Pod::Tree::Node->text($link), @$children; return ( \@text, \@link ); }; push @text, $child; } ( \@text, \@text ); } sub unescape { my $node = shift; my $children = $node->{children}; for my $child (@$children) { $child->unescape; } $node->is_sequence and $node->_unescape_sequence; } sub _unescape_sequence { my $node = shift; for ( $node->{'letter'} ) { /Z/ and $node->force_text(''), last; /E/ and do { my $child = $node->{children}[0]; $child or last; my $text = $child->_unescape_text; $text and $node->force_text($text); last; }; } } sub _unescape_text { my $node = shift; my $text = $node->{'text'}; defined $text ? Pod::Escapes::e2char($text) : "E"; } sub consolidate { my $node = shift; my $old = $node->{children}; $old and @$old or return; my $new = []; push @$new, shift @$old; while (@$old) { if ( $new->[-1]->is_text and $old->[0]->is_text or $new->[-1]->is_verbatim and $old->[0]->is_verbatim or $new->[-1]->is_code and $old->[0]->is_code ) { $new->[-1]{'text'} .= $old->[0]{'text'}; shift @$old; } else { push @$new, shift @$old; } } $node->{children} = $new; for my $child (@$new) { $child->consolidate; } } sub make_lists { my $root = shift; my $nodes = $root->{children}; $root->_make_lists($nodes); } sub _make_lists { my ( $node, $old ) = @_; my $new = []; my $back; while (@$old) { my $child = shift @$old; $child->is_c_over and $child->_make_lists($old); $child->is_c_item and $child->_make_item($old); $child->is_c_back and $back = $child, last; push @$new, $child; } $node->{children} = $new; $node->is_root and return; $node->{type} = 'list'; $node->{back} = $back; $node->_set_list_type; } sub _set_list_type { my $list = shift; my $children = $list->{children}; $list->{list_type} = ''; # -w for my $child (@$children) { $child->{type} eq 'item' or next; $list->{list_type} = $child->{item_type}; last; } } sub _make_item { my ( $item, $old ) = @_; my $siblings = []; while (@$old) { my $sibling = $old->[0]; $sibling->is_c_item and last; $sibling->is_c_back and last; shift @$old; $sibling->is_c_over and do { $sibling->_make_lists($old); }; push @$siblings, $sibling; } $item->{type} = 'item'; $item->{siblings} = $siblings; $item->_set_item_type; } sub _set_item_type { my $item = shift; my $text = $item->{'text'}; $text =~ m(^\s* \* \s*$ )x and $item->{item_type} = 'bullet'; $text =~ m(^\s* \d+ \s*$ )x and $item->{item_type} = 'number'; $item->{item_type} or $item->{item_type} = 'text'; } sub clone { my $node = shift; my $clone = {%$node}; my $children = $node->{children}; $clone->{children} = [ map { $_->clone } @$children ]; bless $clone, ref $node; } my $Indent; my $String; sub dump { my $node = shift; $Indent = 0; $String = ''; $node->_dump; $String; } sub _dump { my $node = shift; my $type = $node->get_type; $String .= ' ' x $Indent . uc $type . " "; for ($type) { /command/ and $String .= $node->_dump_command; /code/ and $String .= $node->_dump_code; /for/ and $String .= $node->_dump_for; /item/ and $String .= $node->_dump_item; /list/ and $String .= $node->_dump_list; /ordinary/ and $String .= "\n"; /root/ and $String .= "\n"; /sequence/ and $String .= $node->_dump_sequence; /text/ and $String .= $node->_dump_text; /verbatim/ and $String .= $node->_dump_verbatim; } $node->_dump_children; $node->_dump_siblings; } sub _dump_command { my $node = shift; my $command = $node->get_command; my $arg = $node->get_arg; "$command $arg\n"; } sub _dump_code { my $node = shift; my $text = _indent( $node->get_text, 3 ); my $block = "\n{\n$text}\n"; _indent( $block, $Indent ); } sub _dump_for { my $node = shift; my $arg = $node->get_arg; my $text = _indent( $node->get_text, $Indent + 3 ); "$arg\n$text\n"; } sub _dump_item { my $node = shift; uc $node->get_item_type . "\n"; } sub _dump_list { my $node = shift; uc $node->get_list_type . "\n"; } sub _dump_sequence { my $node = shift; my $letter = $node->get_letter; my $link = $node->is_link ? $node->_dump_target : ''; "$letter$link\n"; } sub _dump_text { my $node = shift; my $text = $node->get_text; $text =~ s/([\x80-\xff])/sprintf("\\x%02x", ord($1))/eg; my $indent = ' ' x ( $Indent + 5 ); $text =~ s( (?<=\n) (?=.) )($indent)xg; "$text\n"; } sub _dump_verbatim { my $node = shift; "\n" . $node->get_text . "\n"; } sub _dump_target { my $node = shift; my $target = $node->get_target; my $page = $target->{page}; my $section = $target->{section}; " $page / $section"; } sub _dump_children { my $node = shift; my $children = $node->get_children; $children and DumpList( $children, '{', '}' ); } sub _dump_siblings { my $node = shift; my $siblings = $node->get_siblings; $siblings and DumpList( $siblings, '[', ']' ); } sub DumpList { my ( $nodes, $open, $close ) = @_; $String .= ' ' x $Indent . "$open\n"; $Indent += 3; for my $node (@$nodes) { $node->_dump; } $Indent -= 3; $String .= ' ' x $Indent . "$close\n"; } sub _indent { my ( $text, $spaces ) = @_; my $indent = ' ' x $spaces; $text =~ s( (?<=\n) (?=.) )($indent)xg; $indent . $text; } sub _warn { my ( $node, $message ) = @_; my $filename = $node->get_filename; my $tag = $filename ? "in $filename" : $filename; warn "$message $tag\n"; } sub set_filename { my ( $package, $filename ) = @_; $Pod::Tree::Node::filename = $filename; } sub get_filename { $Pod::Tree::Node::filename; } 1 __END__ =head1 NAME Pod::Tree::Node - nodes in a Pod::Tree =head1 SYNOPSIS $node = Pod::Tree::Node->root ( \@paragraphs ); $node = Pod::Tree::Node->code ( $paragraph ); $node = Pod::Tree::Node->verbatim ( $paragraph ); $node = Pod::Tree::Node->command ( $paragraph ); $node = Pod::Tree::Node->ordinary ( $paragraph ); $node = Pod::Tree::Node->letter ( $token ); $node = Pod::Tree::Node->sequence ( $letter, \@children ); $node = Pod::Tree::Node->text ( $text ); $node = Pod::Tree::Node->target ( $target ); $node = Pod::Tree::Node->link ( $node, $page, $section ); $node->is_code and ... $node->is_command and ... $node->is_for and ... $node->is_item and ... $node->is_letter and ... $node->is_list and ... $node->is_ordinary and ... $node->is_pod and ... $node->is_root and ... $node->is_sequence and ... $node->is_text and ... $node->is_verbatim and ... $node->is_link and ... $node->is_c_head1 and ... $node->is_c_head2 and ... $node->is_c_head3 and ... $node->is_c_head4 and ... $node->is_c_cut and ... $node->is_c_pod and ... $node->is_c_over and ... $node->is_c_back and ... $node->is_c_item and ... $node->is_c_for and ... $node->is_c_begin and ... $node->is_c_end and ... $arg = $node->get_arg ; $brackets = $node->get_brackets ; $children = $node->get_children ; $command = $node->get_command ; $domain = $node->get_domain ; $item_type = $node->get_item_type ; $letter = $node->get_letter ; $list_type = $node->get_list_type ; $page = $node->get_page ; $raw = $node->get_raw ; $raw_kids = $node->get_raw_kids ; $section = $node->get_section ; $siblings = $node->get_siblings ; $target = $node->get_target ; $text = $node->get_text ; $type = $node->get_type ; $deep_text = $node->get_deep_text ; $node->force_text($text); $node->force_for; $node->parse_begin (\@nodes); $node->set_children(\@children); $node->make_sequences; $node->parse_links; $node->unescape; $node->consolidate; $node->make_lists; $node->clone; $node->dump; Pod::Tree::Node->set_filename($filename); $filename = $node->get_filename; =head1 REQUIRES Pod::Escapes =head1 DESCRIPTION C objects are nodes in a tree that represents a POD. Applications walk the tree to recover the structure and content of the POD. Methods are provided for =over 4 =item * creating nodes in the tree =item * parsing the POD into nodes =item * returning information about nodes =item * walking the tree =back =head1 TREE STRUCTURE =head2 Root node The tree descends from a single root node; C returns true on this node and no other. $children = $root->get_children returns a reference to an array of nodes. These nodes represent the POD. =head2 Node types For each node, call C to discover the type of the node for $child (@$children) { $type = $child->get_type; } I<$type> will be one of these strings: =over 4 =item 'root' The node is the root of the tree. =item 'code' The node represents a paragraph that is not part of the POD. =item 'verbatim' The node represents a verbatim paragraph. =item 'ordinary' The node represents an ordinary paragraph. =item 'command' The node represents an =command paragraph (but not an =over paragraph). =item 'sequence' The node represents an interior sequence. =item 'target' The node represents the target of a link (An LEE markup). =item 'text' The node represents text that contains no interior sequences. =item 'list' The node represents an =over list. =item 'item' The node represents an item in an =over list. =item 'for' The node represents a =for paragraph, or it represents the paragraphs between =begin/=end commands. =back Here are instructions for walking these node types. =head2 root node Call $children = $node->get_children to get a list of nodes representing the POD. =head2 code nodes A code node contains the text of a paragraph that is not part of the POD, for example, a paragraph that follows an C<=cut> command. Call $text = $node->get_text to recover the text of the paragraph. =head2 verbatim nodes A verbatim node contains the text of a verbatim paragraph. Call $text = $node->get_text to recover the text of the paragraph. =head2 ordinary nodes An ordinary node represents the text of an ordinary paragraph. The text is parsed into a list of text and sequence nodes; these nodes are the children of the ordinary node. Call $children = $node->get_children to get a list of the children. Iterate over this list to recover the text of the paragraph. =head2 command nodes A command node represents an =command paragraph. Call $command = $node->get_command; to recover the name of the command. The name is returned I the equals sign. Z<>=over paragraphs are represented by list nodes, not command nodes; see L, below. The text of a command paragraph is parsed into a list of text and sequence nodes; these nodes are the children of the command node. Call $children = $node->get_children; to get a list of the children. Iterate over this list to recover the text of the paragraph. =head2 sequence nodes A sequence node represents a single interior sequence (a <> markup). Call $node->get_letter to recover the original markup letter. The contents of the markup are parsed into a list of text and sequence nodes; these nodes are the children of the sequence node. Call $node->get_children to recover them. ZEE and EEE markups do not generate sequence nodes; these markups are expanded by C when the tree is built. =head2 target nodes If a sequence node represents a link (an C<< LZ<><> >> markup), then is_link $node returns true and $target = $node->get_target returns a node representing the target of the link. C can represent targets in two I: C and C. The C domain represents the L markups that are described in L. The C domain represents C<< LZ<><> >> markups that contain a URL, e.g. L Call $domain = $target->get_domain to discover the domain of the target. For targets in the POD domain, call $page = $target->get_page; $section = $target->get_section; to recover the man page and section that the link refers to. For targets in the HTTP domain, call $url = $target->get_page; to recover the URL for the link. I<$target> is used only for constructing hyper-links; the text to be displayed for the link is recovered by walking the children of I<$node>, as for any other interior sequence. =head2 text nodes A text node represents text that contains no interior sequences. Call $text = $node->get_text to recover the text. =head2 list nodes A list node represents an =over list. Call $list_type = $node->get_list_type; to discover the type of the list. This will be one of the strings =over 4 =item 'bullet' =item 'number' =item 'text' =back The type of a list is the type of the first item in the list. The children of a list node are item nodes; each item node represents one item in the list. You can call $node->get_arg; to recover the indent value following the =over. =head2 item nodes An item node represents one item in an =over list. Call $item_type = $node->get_item_type; to discover the type of the item. This will be one of the strings shown above for L. Typically, all the items in a list have the same type, but C doesn't assume this. The children of an item node represent the text of the =item paragraph; this is usually of interest only for 'text' items. Call $children = $node->get_children to get a list of the children; these will be sequence and text nodes, as for any other =command paragraph. Each item node also has a list of nodes representing all the paragraphs following it, up to the next =item command, or the end of the list. These nodes are called I of the item node. Call $siblings = $node->get_siblings to get a list of sibling nodes. =head2 for nodes for nodes represent text that is to be passed to an external formatter. Call $formatter = $node->get_arg; to discover the name of the formatter. Call $text = $node->get_text; to obtain the text to be passed to the formatter. This will either be the text of an =for command, or all of the text between =begin and =end commands. =head2 Walking the tree PODs have a recursive structure; therefore, any application that walks a Pod::Tree must also be recursive. See F for an example of the necessary code. =head1 METHODS =head2 Constructors These methods construct C objects. They are used to build trees. They aren't necessary to walk trees. $node = root Pod::Tree::Node \@paragraphs; $node = code Pod::Tree::Node $paragraph; $node = verbatim Pod::Tree::Node $paragraph; $node = command Pod::Tree::Node $paragraph; $node = ordinary Pod::Tree::Node $paragraph; $node = letter Pod::Tree::Node $token; $node = sequence Pod::Tree::Node $letter, \@children; $node = text Pod::Tree::Node $text; $node = target Pod::Tree::Node $target; $node = link Pod::Tree::Node $node, $page, $section; =over 4 =item I<$link> = C->C(I<$node>, I<$page>, I<$section>) Creates a new sequence node representing an C<< LZ<><> >> markup. I<$node> becomes the sole child of the new node. The target of the node is constructed from I<$page> and I<$section>. This method isn't used to parse PODs. It is provided for applications that want to create new links in an existing C structure. =back =head2 Tests These methods return true iff I<$node> has the type indicated by the method name. is_code $node and ... is_command $node and ... is_for $node and ... is_item $node and ... is_letter $node and ... is_link $node and ... is_list $node and ... is_ordinary $node and ... is_pod $node and ... is_root $node and ... is_sequence $node and ... is_text $node and ... is_verbatim $node and ... C returns true for all nodes except code, C<=pod>, and C<=cut> nodes. These methods return true iff I<$node> is a command node, and the command is the one indicated by the method name. is_c_head1 $node and ... is_c_head2 $node and ... is_c_head3 $node and ... is_c_head4 $node and ... is_c_cut $node and ... is_c_pod $node and ... is_c_over $node and ... is_c_back $node and ... is_c_item $node and ... is_c_for $node and ... is_c_begin $node and ... is_c_end $node and ... =head2 Accessors These methods return information about nodes. Most accessors are only relevant for certain types of nodes. =over 4 =item I<$arg> = C I<$node> Returns the argument of I<$node>. This is the number following an =over command, or the name of an external translator for =for, =begin, and =end commands. Only relevant for these four command nodes. =item I<$brackets> = C I<$node> Only relevant for for nodes. If the node represents an =for command, I<@$brackets> is a single-element list. The list element is the text of the =for command and its argument, i.e. the name of the external formatter. If the node represents a =begin/=end construct, I<@$brackets> is a two-element list containing the text of the =begin and =end paragraphs. =item I<$children> = C I<$node> Returns a reference to the list of nodes that are children of I<$node>. May be called on any node. The list may be empty. =item I<$command> = C I<$node> Returns the name of a command, without the equals sign. Only relevant for command nodes. =item I<$domain> = C I<$node> Only relevant for target nodes. Returns the domain of the target. This will be one of the strings =over 4 =item 'HTTP' =item 'POD' =back =item I<$item_type> = C I<$node> Returns the type of an item node. The type will be one of =over 4 =item 'bullet' =item 'number' =item 'text' =back =item I<$letter> = C I<$node> Returns the letter that introduces an interior sequence. Only relevant for sequence nodes. =item I<$list_type> = C I<$node> Returns the type of a list node. The type of a list node is the type of the first item node in the list. =item I<$page> = C I<$node> Only relevant for target nodes. For targets in the C domain, returns the man page that is the target of the link. For targets in the C domain, returns the URL that is the target of the link. =item I<$raw> = C I<$node> Returns the original text of a paragraph. Currently provided for command, verbatim, and ordinary paragraphs. =item I<$raw_kids> = C I<$node> Only provided for LZ<><> sequence nodes. Returns a reference to a list of nodes representing the entire text of the LZ<><> sequence, including any part following a vertical bar (|). The original text of the LZ<><> markup can be reconstructed from this list. =item I<$section> = C I<$node> Only relevant for target nodes in the C domain. Returns the section that is the target of a link. =item I<$siblings> = C I<$node> Returns the siblings of a node. May be called on any node. Only item nodes have siblings. =item I<$target> = C I<$node> Returns the target of a node. Only relevant for sequence nodes that represent links (CE> markups). C returns true on these nodes. =item I<$text> = C I<$node> Returns the text of a node. I<$text> will not contain any interior sequences. Only relevant for text nodes. =item I<$type> = C I<$node> Returns the type of I<$node>. May be called on any node. See L for descriptions of the node types. =item I<$deep_text> = C I<$node> Recursively walks the children of a node, catenates together the text from each node, and returns all that text as a single string. All interior sequence markups are discarded. C is provided as a convenience for applications that want to ignore markups in a POD paragraph. =back =head2 Parsing These methods manipulate the tree while it is being built. They aren't necessary to walk the tree. $node->force_text($text) $node->force_for; $node->parse_begin (\@nodes); $node->set_children(\@children); $node->make_sequences; $node->parse_links; $node->unescape; $node->consolidate; $node->make_lists; =head2 Utility =over 4 =item I<$node>->C Returns a deep copy of a node. Only implemented for C and C nodes. =item I<$node>->C Returns a string containing a pretty-printed representation of the node. Calling C on the root node of a tree will show the entire POD. =item C->C(I<$filename>) Sets the file name to be reported in error messages. =item I<$filename> = $I->C Returns the file name set by C. =back =head1 EXAMPLES The F directory in the C distribution contains examples of PODs, together with dumps of the trees that C constructs for them. The tree for CFC<.pod> is in CFC<.p_exp>. C is a simple example of code that walks a POD tree. F is a skeleton application that walks a POD tree. =head1 NOTES =over 4 =item * There is no provision in L for C<< LZ<><> >> markups to contain URLs, but due to popular demand, this is now supported in C. =back =head1 SEE ALSO perl(1), L> =head1 AUTHOR Steven McDougall, swmcd@world.std.com =head1 COPYRIGHT Copyright (c) 1999-2004 by Steven McDougall. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Pod-Tree-1.31/lib/Pod/Tree/PerlBin.pm0000644000175000017500000001501713433574665016515 0ustar manwarmanwarpackage Pod::Tree::PerlBin; use 5.006; use strict; use warnings; use File::Find; use HTML::Stream; use Pod::Tree; use Pod::Tree::HTML; use Pod::Tree::PerlUtil; our $VERSION = '1.31'; use base qw(Pod::Tree::PerlUtil); sub new { my ( $class, $perl_dir, $html_dir, $link_map, %options ) = @_; my %defaults = ( col_width => 25, bgcolor => '#ffffff', text => '#000000' ); my $options = { %defaults, %options, link_map => $link_map }; my $perl_bin = { perl_dir => $perl_dir, html_dir => $html_dir, bin_dir => 'bin', top_page => 'bin.html', depth => 1, options => $options }; bless $perl_bin, $class; } sub scan { my ( $perl_bin, @dirs ) = @_; $perl_bin->report1("scan"); for my $dir (@dirs) { opendir( DIR, $dir ) or next; # Windows apps sometimes leave non-existant dirs on $PATH for my $file ( readdir(DIR) ) { my $path = "$dir/$file"; -f $path and -x $path and -T $path or next; $perl_bin->scan_file( $dir, $file ); } } $perl_bin->scan_xsubpp; } # A Very Special search for a Very Special executable sub scan_xsubpp { my $perl_bin = shift; my @inc = grep {m(^/)} @INC; # Don't ask. File::Find::find( sub { $perl_bin->_scan_xsubpp }, @inc ) if @inc; } sub _scan_xsubpp { my $perl_bin = shift; /^xsubpp$/ and $perl_bin->scan_file( $File::Find::dir, $_ ); } sub scan_file { my ( $perl_bin, $dir, $file ) = @_; my $source = "$dir/$file"; my $html_dir = $perl_bin->{html_dir}; my $bin_dir = $perl_bin->{bin_dir}; my $link = "$bin_dir/$file"; my $dest = "$html_dir/$link.html"; my ( $name, $description ) = $perl_bin->get_name($source); $name or return; # Translate the first copy found in $PATH $perl_bin->{index}{$name} and return; $perl_bin->report2($source); my $entry = { source => $source, dest => $dest, file => $file, description => $description }; $perl_bin->{index}{$name} = $entry; $perl_bin->{options}{link_map}->add_page( $file, $link ); $perl_bin->{options}{link_map}->add_page( $name, $link ); } sub index { my $perl_bin = shift; $perl_bin->report1("index"); my $html_dir = $perl_bin->{html_dir}; my $bin_dir = $perl_bin->{bin_dir}; my $top_page = $perl_bin->{top_page}; my $dest = "$html_dir/$top_page"; $perl_bin->mkdir("$html_dir/$bin_dir"); my $fh = IO::File->new(">$dest"); defined $fh or die "Pod::Tree::PerlBin::index: Can't open $dest: $!\n"; my $stream = HTML::Stream->new($fh); my $options = $perl_bin->{options}; my $bgcolor = $options->{bgcolor}; my $text = $options->{text}; my $title = "Perl Executables"; $stream->HTML->HEAD; $stream->TITLE->text($title)->_TITLE; $stream->_HEAD->BODY( BGCOLOR => $bgcolor, TEXT => $text ); $stream->H1->t($title)->_H1; $perl_bin->_emit_entries($stream); $stream->_BODY->_HTML; } sub get_top_entry { my $perl_bin = shift; +{ URL => $perl_bin->{top_page}, description => 'Executables' }; } sub _emit_entries { my ( $perl_bin, $stream ) = @_; my $bin_dir = $perl_bin->{bin_dir}; my $index = $perl_bin->{index}; my $options = $perl_bin->{options}; my $col_width = $options->{col_width}; $stream->PRE; for my $name ( sort keys %$index ) { my $entry = $index->{$name}; my $file = $entry->{file}; my $desc = $entry->{description}; my $pad = $col_width - length $name; $stream->A( HREF => "$bin_dir/$file.html" )->t($name)->_A; $pad < 1 and do { $stream->nl; $pad = $col_width; }; $stream->t( ' ' x $pad, $desc )->nl; } $stream->_PRE; } sub translate { my $perl_bin = shift; $perl_bin->report1("translate"); my $index = $perl_bin->{index}; my $options = $perl_bin->{options}; for my $name ( sort keys %$index ) { $perl_bin->report2($name); my $depth = $perl_bin->{depth}; $options->{link_map}->set_depth($depth); my $entry = $index->{$name}; my $source = $entry->{source}; my $dest = $entry->{dest}; my $html = Pod::Tree::HTML->new( $source, $dest, %$options ); $html->translate; } } 1 __END__ =head1 NAME Pod::Tree::PerlBin - translate program PODs to HTML =head1 SYNOPSIS $perl_map = Pod::Tree::PerlMap->new; $perl_bin = Pod::Tree::PerlBin->new($perl_dir, $HTML_dir, $perl_map, %opts); $perl_bin->scan(@path); $perl_bin->index; $perl_bin->translate; $top = $perl_bin->get_top_entry; =head1 DESCRIPTION C translates program PODs to HTML. It searches for programs in a list of directories (typically a PATH), and searches for PODs within the programs. Only text (-T) files are considered. C generates a top-level index of all the program PODs, and writes it to IC. C generates and uses an index of the PODs that it finds to construct HTML links. Other modules can also use this index. =head1 METHODS =over 4 =item I<$perl_bin> = C C I<$perl_dir>, I<$HTML_dir>, I<$perl_map>, I<%options> Creates and returns a new C object. I<$HTML_dir> is the directory where HTML files will be written. I<$perl_map> maps program names to URLs. I<%options> are passed through to C. The I<$perl_dir> argument is included for consistency with the other C modules, but is currently unused. =item I<$perl_bin>->C(I<@path>) Scans all the directories in I<@path> for program PODs. Only text (-T) files are considered. The search does not recurse through subdirectories. Each POD that is located is entered into I<$perl_map>. =item I<$perl_bin>->C Generates a top-level index of all the program PODs, and writes it to IC. =item I<$perl_bin>->C Translates each program POD found by C to HTML. The HTML pages are written to I. =item I<$perl_bin>->C Returns a hash reference of the form { URL => $URL, description => $description } C uses this to build a top-level index of all the Perl PODs. =back =head1 LINKING C expects the second paragraph of the POD to have the form name - description and enters I into I<$perl_map>. To link to a program POD from another POD, write L =head1 REQUIRES 5.005 File::Find HTML::Stream Pod::Tree Pod::Tree::HTML Pod::Tree::PerlUtil =head1 EXPORTS Nothing. =head1 SEE ALSO L>, L>, =head1 AUTHOR Steven McDougall, swmcd@world.std.com =head1 COPYRIGHT Copyright (c) 2000 by Steven McDougall. This module is free software; you can redistribute it and/or modify it under the same terms as Perl. Pod-Tree-1.31/lib/Pod/Tree/BitBucket.pm0000644000175000017500000000022213433574665017026 0ustar manwarmanwarpackage Pod::Tree::BitBucket; use 5.006; use strict; use warnings; our $VERSION = '1.31'; sub new { bless {}, shift } sub AUTOLOAD {shift} 1; Pod-Tree-1.31/lib/Pod/Tree/PerlDist.pm0000644000175000017500000001622313433574665016710 0ustar manwarmanwarpackage Pod::Tree::PerlDist; use 5.006; use strict; use warnings; use HTML::Stream; use Pod::Tree; use Pod::Tree::HTML; use Pod::Tree::PerlUtil; our $VERSION = '1.31'; use base qw(Pod::Tree::PerlUtil); sub new { my ( $class, $perl_dir, $html_dir, $link_map, %options ) = @_; my %defaults = ( bgcolor => '#ffffff', text => '#000000' ); my @stop_base = qw(Configure configpm configure installhtml installman installperl mv-if-diff perlsh); my $options = { %defaults, %options, link_map => $link_map }; my $perl_dist = { perl_dir => $perl_dir, html_dir => $html_dir, top_page => 'dist.html', stop_ext => [qw(SH c diff fixer h pl sym y)], stop_base => [@stop_base], depth => 0, options => $options }; bless $perl_dist, $class; } sub scan { my $perl_dist = shift; $perl_dist->report1("scan"); my $perl_dir = $perl_dist->{perl_dir}; my $html_dir = $perl_dist->{html_dir}; opendir( DIR, $perl_dir ) or die "Can't opendir $perl_dir: $!\n"; my $stop_ext = $perl_dist->{stop_ext}; my %stop_ext = map { $_ => 1 } @$stop_ext; my $stop_base = $perl_dist->{stop_base}; my %stop_base = map { $_ => 1 } @$stop_base; for my $file ( readdir(DIR) ) { -f "$perl_dir/$file" and -T "$perl_dir/$file" or next; my ( $base, $ext ) = split m(\.), $file; $stop_ext{$ext} and next; $stop_base{$base} and next; $perl_dist->report2($file); $perl_dist->scan_file($file); } } sub scan_file { my ( $perl_dist, $file ) = @_; my $perl_dir = $perl_dist->{perl_dir}; my $html_dir = $perl_dist->{html_dir}; my $source = "$perl_dir/$file"; my $dest = "$html_dir/$file.html"; my $entry = { file => $file, source => $source, dest => $dest }; $perl_dist->{index}{$file} = $entry; $perl_dist->{options}{link_map}->add_page( $file, $file ); my ( $base, $ext ) = split m(\.), $file; $base eq 'README' and $ext and $perl_dist->{options}{link_map}->add_page( "perl$ext", $file ); } sub index { my $perl_dist = shift; $perl_dist->report1("index"); my $html_dir = $perl_dist->{html_dir}; my $top_page = $perl_dist->{top_page}; my $dest = "$html_dir/$top_page"; my $fh = IO::File->new(">$dest"); defined $fh or die "Pod::Tree::PerlDist::index: Can't open $dest: $!\n"; my $stream = HTML::Stream->new($fh); my $options = $perl_dist->{options}; my $bgcolor = $options->{bgcolor}; my $text = $options->{text}; my $title = "Perl Distribution Documents"; $stream->HTML->HEAD; $stream->TITLE->text($title)->_TITLE; $stream->_HEAD->BODY( BGCOLOR => $bgcolor, TEXT => $text ); $stream->H1->t($title)->_H1; $perl_dist->_emit_entries($stream); $stream->_BODY->_HTML; } sub get_top_entry { my $perl_dist = shift; +{ URL => $perl_dist->{top_page}, description => 'distribution documents' }; } sub _emit_entries { my ( $perl_dist, $stream ) = @_; my $index = $perl_dist->{index}; my $options = $perl_dist->{options}; $stream->PRE; for my $name ( sort keys %$index ) { $stream->A( HREF => "$name.html" )->t($name)->_A->nl; } $stream->_PRE; } sub translate { my $perl_dist = shift; $perl_dist->report1("translate"); my $depth = $perl_dist->{depth}; my $index = $perl_dist->{index}; $perl_dist->{options}{link_map}->set_depth($depth); for my $name ( sort keys %$index ) { $perl_dist->report2($name); my $entry = $index->{$name}; my $source = $entry->{source}; open( my $FILE, '<', $source ) or die "Pod::Tree::PerlDist::translate: Can't open $source: $!\n"; my @file = <$FILE>; close $FILE; my $translate = ( grep {/^=\w+/} @file ) ? 'translate_pod' : 'translate_text'; $perl_dist->$translate($entry); } } sub translate_pod { my ( $perl_dist, $entry ) = @_; my $source = $entry->{source}; my $dest = $entry->{dest}; my $options = $perl_dist->{options}; my $html = Pod::Tree::HTML->new( $source, $dest, %$options ); $html->translate; } sub translate_text { my ( $perl_dist, $entry ) = @_; my $source = $entry->{source}; my $dest = $entry->{dest}; my $fh = IO::File->new(">$dest"); defined $fh or die "Pod::Tree::PerlDist::translate_text: Can't open $dest: $!\n"; my $stream = HTML::Stream->new($fh); my $options = $perl_dist->{options}; my $bgcolor = $options->{bgcolor}; my $text = $options->{text}; my $title = $entry->{file}; $stream->HTML->HEAD; $stream->TITLE->text($title)->_TITLE; $stream->_HEAD->BODY( BGCOLOR => $bgcolor, TEXT => $text ); $stream->H1->t($title)->_H1; $stream->PRE; open( my $SOURCE, '<', $source ) or die "Pod::Tree::PerlDist::translate_text: Can't open $source: $!\n"; while ( my $line = <$SOURCE> ) { $stream->t($line); } close $SOURCE; $stream->_PRE; $stream->_BODY->_HTML; } 1 __END__ =head1 NAME Pod::Tree::PerlDist - translate Perl distribution documentation to HTML =head1 SYNOPSIS $perl_map = Pod::Tree::PerlMap->new; $perl_dist = Pod::Tree::PerlDist->new( $perl_dir, $HTML_dir, $perl_map, %opts ); $perl_dist->scan; $perl_dist->index; $perl_dist->translate; $top = $perl_dist->get_top_entry; =head1 DESCRIPTION C translates documents in the Perl distribution to HTML. These include F, F, and assored other files that appear in the top level of the Perl source tree. Files that contain PODs are parsed as PODs; files that do not contain PODs are converted to HTML as preformatted text. C generates and uses an index of the files that it finds to construct HTML links. Other modules can also use this index. =head1 METHODS =over 4 =item I<$perl_dist> = C C I<$perl_dir>, I<$HTML_dir>, I<$perl_map>, I<%options> Creates and returns a new C object. I<$perl_dir> is the root of the Perl source tree. I<$HTML_dir> is the directory where HTML files will be written. I<$perl_map> maps file names to URLs. I<%options> are passed through to C. =item I<$perl_dist>->C Scans the top level of the Perl source tree for documentation files. Files that do not generally contain user-level documentation, such as source files, are ignored. The search does not recurse through subdirectories. Each file that is located is entered into I<$perl_map>. =item I<$perl_dist>->C Generates a top-level index of all the distribution documents, and writes it to IC. =item I<$perl_dist>->C Translates each distribution document found by C to HTML. The HTML pages are written to I. =item I<$perl_dist>->C Returns a hash reference of the form { URL => $URL, description => $description } C uses this to build a top-level index of all the Perl PODs. =back =head1 LINKING C indexes files by their name. To link to a file named F write L =head1 REQUIRES 5.005; HTML::Stream; Pod::Tree; Pod::Tree::HTML; Pod::Tree::PerlUtil; =head1 EXPORTS Nothing. =head1 SEE ALSO L>, L>, =head1 AUTHOR Steven McDougall, swmcd@world.std.com =head1 COPYRIGHT Copyright (c) 2000 by Steven McDougall. This module is free software; you can redistribute it and/or modify it under the same terms as Perl. Pod-Tree-1.31/lib/Pod/Tree/PerlTop.pm0000644000175000017500000001306113433574665016544 0ustar manwarmanwarpackage Pod::Tree::PerlTop; use 5.006; use strict; use warnings; our $VERSION = '1.31'; use Pod::Tree::HTML; use Pod::Tree::PerlUtil; use Pod::Tree::HTML::PerlTop; use base qw(Pod::Tree::PerlUtil); sub new { my ( $class, $perl_dir, $html_dir, $link_map, %options ) = @_; my %defaults = ( bgcolor => '#ffffff', text => '#000000' ); my $options = { %defaults, %options, link_map => $link_map }; my $pod_src = -d "$perl_dir/pod" ? 'pod' # for building the doc set from a Perl distribution : 'lib/pod'; # for building the doc set from a Windows installation my $perl_top = { perl_dir => $perl_dir, html_dir => $html_dir, index => 'index.html', pod_src => 'pod', pod_dst => 'pod', page => 'perl', options => $options }; bless $perl_top, $class; } sub index { my ( $perl_top, @translators ) = @_; $perl_top->report1("index"); my @entries = map { $_->get_top_entry } @translators; my $html_dir = $perl_top->{html_dir}; my $dest = "$html_dir/index.html"; my $fh = IO::File->new(">$dest"); defined $fh or die "Pod::Tree::PerlTop::index: Can't open $dest: $!\n"; my $stream = HTML::Stream->new($fh); my $options = $perl_top->{options}; my $bgcolor = $options->{bgcolor}; my $text = $options->{text}; my $title = "Perl Documentation"; $stream->HTML->HEAD; $stream->TITLE->text($title)->_TITLE; $stream->_HEAD->BODY( BGCOLOR => $bgcolor, TEXT => $text ); $stream->H1->t($title)->_H1; $perl_top->_emit_entries( $stream, @entries ); $stream->_BODY->_HTML; } sub _emit_entries { my ( $perl_top, $stream, @entries ) = @_; $stream->UL; for my $entry (@entries) { $stream->LI->A( HREF => $entry->{URL} )->t( $entry->{description} )->_A->_LI; } $stream->_UL; } sub translate { my $perl_top = shift; $perl_top->report1("translate"); my $perl_dir = $perl_top->{perl_dir}; my $options = $perl_top->{options}; $options->{link_map}->set_depth(1); my $html_dir = $perl_top->{html_dir}; my $pod_src = $perl_top->{pod_src}; my $pod_dst = $perl_top->{pod_dst}; my $page = $perl_top->{page}; my $source = "$perl_dir/$pod_src/$page.pod"; my $dest = "$html_dir/$pod_dst/$page.html"; my $html = Pod::Tree::HTML::PerlTop->new( $source, $dest, %$options ); my $links = $perl_top->_get_links; $html->set_links($links); $html->translate; } sub get_top_entry { my $perl_top = shift; my $pod_dst = $perl_top->{pod_dst}; my $page = $perl_top->{page}; +{ URL => "$pod_dst/$page.html", description => 'perl(1)' }; } sub _get_links { my $perl_top = shift; my $links = {}; $perl_top->_get_pod_links($links); $perl_top->_get_dist_links($links); $links; } sub _get_pod_links { my ( $perl_top, $links ) = @_; my $perl_dir = $perl_top->{perl_dir}; my $pod_src = $perl_top->{pod_src}; my $dir = "$perl_dir/$pod_src"; opendir( DIR, $dir ) or die "Pod::Tree::PerlTop::get_pod_links: Can't opendir $dir: $!\n"; my @files = readdir(DIR); closedir(DIR); my @pods = grep {m( \.pod$ )x} @files; my @others = grep { $_ ne 'perl.pod' } @pods; for my $other (@others) { $other =~ s( \.pod$ )()x; $links->{$other} = $other; } } sub _get_dist_links { my ( $perl_top, $links ) = @_; my $dir = $perl_top->{perl_dir}; opendir( DIR, $dir ) or die "Pod::Tree::PerlTop::get_dist_links: Can't opendir $dir: $!\n"; my @files = readdir(DIR); closedir(DIR); my @README = grep {/^README/} @files; for my $file (@README) { my ( $base, $ext ) = split m(\.), $file; $links->{"perl$ext"} = "../$file"; } } 1 __END__ =head1 NAME Pod::Tree::PerlTop - generate a top-level index for Perl PODs =head1 SYNOPSIS $perl_map = Pod::Tree::PerlMap->new; $perl_top = Pod::Tree::PerlTop->new( $perl_dir, $HTML_dir, $perl_map, %opts ); $perl_top->index(@translators); $perl_top->translate; $top = $perl_top->get_top_entry; =head1 DESCRIPTION C generates a top-level index for Perl PODs. It also translates F to F The translator is specially hacked to insert links into the big verbatim paragraph that lists all the other Perl PODs. =head1 METHODS =over 4 =item I<$perl_top> = C C I<$perl_dir>, I<$HTML_dir>, I<$perl_map>, I<%options> Creates and returns a new C object. I<$perl_dir> is the root of the Perl source tree. I<$HTML_dir> is the directory where HTML files will be written. I<$perl_map> maps POD names to URLs. C uses it to resolve links in the F page. I<%options> are passed through to C. =item I<$perl_top>->C(I<@translators>) Generates a top-level index of all the PODs. The index is written to IC. I<@translators> is a list of other C translator objects. C makes a C call on each of them to obtain URLs and descriptions of the pages that it links to. =item I<$perl_top>->C Translates the F file to HTML. The HTML page is written to IC =item I<$perl_top>->C Returns a hash reference of the form { URL => $URL, description => $description } C uses this to build a top-level index of all the Perl PODs. =back =head1 REQUIRES 5.005; Pod::Tree::HTML; Pod::Tree::PerlUtil; =head1 EXPORTS Nothing. =head1 SEE ALSO L>, L>, =head1 AUTHOR Steven McDougall, swmcd@world.std.com =head1 COPYRIGHT Copyright (c) 2000 by Steven McDougall. This module is free software; you can redistribute it and/or modify it under the same terms as Perl. Pod-Tree-1.31/lib/Pod/Tree/PerlMap.pm0000644000175000017500000000642413433574665016524 0ustar manwarmanwarpackage Pod::Tree::PerlMap; use 5.006; use strict; use warnings; our $VERSION = '1.31'; sub new { my ($class) = @_; my $perl_map = { prefix => '' }; bless $perl_map, $class; } sub set_depth { my ( $perl_map, $depth ) = @_; $perl_map->{prefix} = '../' x $depth; } sub add_page { my ( $perl_map, $page, $file ) = @_; $perl_map->{page}{$page} = $file; } sub add_func { my ( $perl_map, $func, $file ) = @_; $perl_map->{func}{$func} = $file; } sub force_func { my ( $perl_map, $force_func ) = @_; $perl_map->{force_func} = $force_func; } sub map { my ( $perl_map, $base, $page, $section ) = @_; # print "map $base, $page, $section ->"; my $prefix = $perl_map->{prefix}; my $force_func = $perl_map->{force_func}; my $func = ( split m(\s+), $section )[0]; # e.g. L<"eval BLOCK"> my $file = $perl_map->{func}{$func}; if ( ( $page eq 'perlfunc' or $page eq '' and $force_func ) and $file ) { $page = $prefix . 'pod/func/' . $file; $section = ''; } elsif ( $perl_map->{page}{$page} ) { $page = $prefix . $perl_map->{page}{$page}; } # print "$base, $page, $section\n"; ( $base, $page, $section ); } 1 __END__ =head1 NAME Pod::Tree::PerlMap - map names to URLs =head1 SYNOPSIS $perl_map = new Pod::Tree::PerlMap; $perl_map->add_page ($name, $file); $perl_map->add_func ($func, $file); $perl_map->force_func(0); $perl_map->force_func(1); $perl_map->set_depth ($depth); ($base, $page, $section) = $perl_map->map($base, $page, $section); =head1 DESCRIPTION C maps LEE markups to URLs. The C translators make entries in the map. C uses the map to translate links before it emits them. =head1 METHODS =over 4 =item I<$perl_map>->C(I<$name>, I<$file>) Map I<$name> to I<$file>. I<$name> is the name of a POD, as used in LEE markups. I<$file> is the path to the HTML file that is the target of the link. =item I<$perl_map>->C(I<$func>, I<$file>) Maps I<$func> to I<$file>. I<$func> is the name of a function described in F. I<$file> is the name of the HTML file where it is described. =item I<$perl_map>->C(I<$state>) Controls interpretation of links of the form LEfuncE. If I<$state> is true, calls to C will interpret LEfuncE as LEperlfunc/funcE. If I<$state> is false, calls to C will interpret LEfuncE normally. =item I<$perl_map>->C(I<$depth>) Informs I<$perl_map> of the depth of the referring page in the HTML directory tree. I<$perl_map> needs to know this so that it can construct relative links. =item (I<$base>, I<$page>, I<$section>) = I<$perl_map>->C(I<$base>, I<$page>, I<$section>) Remaps a link. I<$base> is the base URL for the HTML page, if any. I<$page> is the page given in an LEE markup. I<$section> is the section given in the LEE markup, if any. C returns a new I<$base>, I<$page>, and I<$section> that can be used to construct a link to the HTML page. =back =head1 REQUIRES Nothing. =head1 EXPORTS Nothing. =head1 AUTHOR Steven McDougall, swmcd@world.std.com =head1 COPYRIGHT Copyright (c) 2000 by Steven McDougall. This module is free software; you can redistribute it and/or modify it under the same terms as Perl. Pod-Tree-1.31/lib/Pod/Tree/Pod.pm0000644000175000017500000001452013433574665015702 0ustar manwarmanwar# Copyright (c) 2000-2003 by Steven McDougall. This module is free # software; you can redistribute it and/or modify it under the same # terms as Perl itself. package Pod::Tree::Pod; use 5.006; use strict; use warnings; our $VERSION = '1.31'; use IO::File; use Pod::Tree; sub new { my ( $class, $tree, $dest ) = @_; defined $dest or die "Pod::Tree::Pod::new: not enough arguments\n"; my $file = _resolve_dest($dest); my $pod = { tree => $tree, root => $tree->get_root, file => $file, interior => 0, link => 0 }; bless $pod, $class; } sub _resolve_dest { my $dest = shift; ref $dest and return $dest; my $fh = IO::File->new; $fh->open(">$dest") or die "Pod::Tree::Pod::new: Can't open $dest: $!\n"; $fh; } sub translate { my $pod = shift; my $root = $pod->{root}; $pod->_emit_children($root); } sub _emit_children { my ( $pod, $node ) = @_; my $children = $node->get_children; for my $child (@$children) { $pod->_emit_node($child); } } sub _emit_siblings { my ( $pod, $node ) = @_; my $siblings = $node->get_siblings; for my $sibling (@$siblings) { $pod->_emit_node($sibling); } } sub _emit_node { my ( $pod, $node ) = @_; my $type = $node->{type}; for ($type) { /code/ and $pod->_emit_code($node); /command/ and $pod->_emit_command($node); /for/ and $pod->_emit_for($node); /item/ and $pod->_emit_item($node); /list/ and $pod->_emit_list($node); /ordinary/ and $pod->_emit_ordinary($node); /sequence/ and $pod->_emit_sequence($node); /text/ and $pod->_emit_text($node); /verbatim/ and $pod->_emit_verbatim($node); } } sub _emit_code { my ( $pod, $node ) = @_; my $file = $pod->{file}; my $text = $node->get_text; $file->print($text); } sub _emit_command { my ( $pod, $node ) = @_; my $file = $pod->{file}; my $raw = $node->get_raw; $file->print($raw); } sub _emit_for { my ( $pod, $node ) = @_; my $file = $pod->{file}; my $brackets = $node->get_brackets; $file->print( $brackets->[0] ); $file->print( $node->get_text ); $file->print( $brackets->[1] ) if $brackets->[1]; } sub _emit_item { my ( $pod, $node ) = @_; my $file = $pod->{file}; $file->print("=item "); $pod->_emit_children($node); $pod->_emit_siblings($node); } sub _emit_list { my ( $pod, $node ) = @_; my $file = $pod->{file}; my $over = $node->get_raw; $file->print($over); $pod->_emit_children($node); my $back = $node->get_back; $back and $file->print( $back->get_raw ); } sub _emit_ordinary { my ( $pod, $node ) = @_; $pod->_emit_children($node); } sub _emit_sequence { my ( $pod, $node ) = @_; $pod->{interior}++; for ( $node->get_letter ) { /I|B|C|E|F|S|X/ and $pod->_emit_element($node), last; /L/ and $pod->_emit_link($node), last; } $pod->{interior}--; } sub _emit_element { my ( $pod, $node ) = @_; my $letter = $node->get_letter; my $file = $pod->{file}; $file->print("$letter<"); $pod->_emit_children($node); $file->print(">"); } sub _emit_link { my ( $pod, $node ) = @_; my $file = $pod->{file}; $file->print("L<"); my $children = $node->get_raw_kids; for my $child (@$children) { $pod->_emit_node($child); } $file->print(">"); } sub _emit_link_hide { my ( $pod, $node ) = @_; my $file = $pod->{file}; my $target = $node->get_target; my $page = $target->get_page; my $section = $target->get_section; my $slash = $section ? '/' : ''; my $link = "$page$slash$section"; if ( $link eq $node->get_deep_text ) { $file->print("L<"); $pod->_emit_children($node); $file->print(">"); } else { $pod->{link}++; $file->print("L<"); $pod->_emit_children($node); $page = $pod->_escape($page); $section = $pod->_escape($section); $file->print("|$page$slash$section>"); $pod->{link}--; } } sub _emit_text { my ( $pod, $node ) = @_; my $file = $pod->{file}; my $text = $node->get_text; $text = $pod->_escape($text); $file->print($text); } sub _escape { my ( $pod, $text ) = @_; $text =~ s/^=(\w)/=Z<>$1/; if ( $pod->{interior} ) { $text =~ s/([A-Z])/g; $text =~ s/>/E/g; } if ( $pod->{link} ) { $text =~ s(\|)(E)g; $text =~ s(/)(E)g; } $text =~ s/([\x80-\xff])/sprintf("E<%d>", ord($1))/eg; $text; } sub _emit_verbatim { my ( $pod, $node ) = @_; my $file = $pod->{file}; my $text = $node->get_text; $file->print($text); } 1 __END__ =head1 NAME Pod::Tree::Pod - Convert a Pod::Tree back to a POD =head1 SYNOPSIS use Pod::Tree::Pod; $tree = Pod::Tree->new; $dest = IO::File->new; $dest = "file.pod"; $pod = Pod::Tree::Pod->new($tree, $dest); $pod->translate; =head1 DESCRIPTION C converts a Pod::Tree back to a POD. The destination is fixed when the object is created. The C method does the actual translation. For convenience, Pod::Tree::Pod can write the POD to a variety of destinations. The C method resolves the I<$dest> argument. =head2 Destination resolution C can write HTML to either of 2 destinations. C resolves I<$dest> by checking these things, in order: =over 4 =item 1 If I<$dest> is a reference, then it is taken to be an C object that is already open on the file where the POD will be written. =item 2 If I<$dest> is not a reference, then it is taken to be the name of the file where the POD will be written. =back =head1 METHODS =over 4 =item I<$pod> = C C I<$tree>, I<$dest> Creates a new C object. I<$tree> is a C object that represents a POD. I<$pod> writes the POD to I<$dest>. See L for details. =item I<$pod>->C Writes the text of the POD. This method should only be called once. =back =head1 DIAGNOSTICS =over 4 =item C (F) C called with fewer than 2 arguments. =item C (F) The destination file couldn't be opened. =back =head1 NOTES =over 4 =item * The destination doesn't actually have to be an C object. It may be any object that has a C method. =back =head1 SEE ALSO perl(1), L>, L> =head1 AUTHOR Steven McDougall, swmcd@world.std.com =head1 COPYRIGHT Copyright (c) 2000-2003 by Steven McDougall. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Pod-Tree-1.31/lib/Pod/Tree/StrStream.pm0000644000175000017500000000054513433574665017106 0ustar manwarmanwarpackage Pod::Tree::StrStream; use 5.006; use strict; use warnings; our $VERSION = '1.31'; sub new { my ( $class, $ref ) = @_; if ($ref) { return bless $ref, $class; } else { my $st = ''; return bless \$st, $class; } } sub print { my $st = shift; $$st .= join( '', @_ ); } sub get { my $st = shift; my $s = $$st; $$st = ''; $s; } 1; Pod-Tree-1.31/lib/Pod/Tree/HTML.pm0000644000175000017500000006311213433574665015725 0ustar manwarmanwarpackage Pod::Tree::HTML; use 5.006; use strict; use warnings; # Copyright (c) 1999-2007 by Steven McDougall. This module is free # software; you can redistribute it and/or modify it under the same # terms as Perl itself. use HTML::Stream; use IO::File; use IO::String; use Pod::Tree; use Text::Template; use Pod::Tree::BitBucket; use Pod::Tree::StrStream; use Pod::Tree::HTML::LinkMap; use constant BGCOLOR => '#ffffff'; use constant TEXT => '#000000'; our $VERSION = '1.31'; sub new { my ( $class, $source, $dest, %options ) = @_; defined $dest or die "Pod::Tree::HTML::new: not enough arguments\n"; my $tree = _resolve_source($source); my ( $fh, $stream ) = _resolve_dest( $dest, $tree, \%options ); my $options = { bgcolor => BGCOLOR, depth => 0, hr => 1, link_map => Pod::Tree::HTML::LinkMap->new(), text => TEXT, toc => 1, }; my $HTML = { tree => $tree, root => $tree->get_root, stream => $stream, fh => $fh, text_method => 'text', options => $options, }; bless $HTML, $class; $HTML->set_options(%options); $HTML; } sub _resolve_source { my $source = shift; my $ref = ref $source; local *isa = \&UNIVERSAL::isa; isa( $source, 'Pod::Tree' ) and return $source; my $tree = Pod::Tree->new; not $ref and $tree->load_file($source); isa( $source, 'IO::File' ) and $tree->load_fh($source); $ref eq 'SCALAR' and $tree->load_string($$source); $ref eq 'ARRAY' and $tree->load_paragraphs($source); $tree->loaded or die "Pod::Tree::HTML::_resolve_source: Can't load POD from $source\n"; $tree; } sub _resolve_dest { my ( $dest, $tree, $options ) = @_; $tree->has_pod or $options->{empty} or return ( undef, Pod::Tree::BitBucket->new ); local *isa = \&UNIVERSAL::isa; local *can = \&UNIVERSAL::can; isa( $dest, 'HTML::Stream' ) and return ( undef, $dest ); isa( $dest, 'IO::File' ) and return ( $dest, HTML::Stream->new($dest) ); can( $dest, 'print' ) and return ( $dest, HTML::Stream->new($dest) ); if ( ref $dest eq 'SCALAR' ) { my $fh = IO::String->new($$dest); return ( $fh, HTML::Stream->new($fh) ); } if ( ref $dest eq '' and $dest ) { my $fh = IO::File->new; $fh->open( $dest, '>' ) or die "Pod::Tree::HTML::new: Can't open $dest: $!\n"; return ( $fh, HTML::Stream->new($fh) ); } die "Pod::Tree::HTML::_resolve_dest: Can't write HTML to $dest\n"; } sub set_options { my ( $html, %options ) = @_; my ( $key, $value ); while ( ( $key, $value ) = each %options ) { $html->{options}{$key} = $value; } } sub get_options { my ( $html, @options ) = @_; map { $html->{options}{$_} } @options; } sub get_stream { shift->{stream} } sub translate { my ( $html, $template ) = @_; if ($template) { $html->_template($template); } else { $html->_translate; } } sub _translate { my $html = shift; my $stream = $html->{stream}; my $bgcolor = $html->{options}{bgcolor}; my $text = $html->{options}{text}; my $title = $html->_make_title; my $base = $html->{options}{base}; my $css = $html->{options}{css}; $stream->HTML->HEAD; defined $title and $stream->TITLE->text($title)->_TITLE; defined $base and $stream->BASE( href => $base ); defined $css and $stream->LINK( href => $css, type => "text/css", rel => "stylesheet" ); $stream->_HEAD->BODY( BGCOLOR => $bgcolor, TEXT => $text ); $html->emit_toc; $html->emit_body; $stream->nl->_BODY->_HTML; } sub _template { my ( $html, $tSource ) = @_; my $fh = $html->{fh}; my $sStream = Pod::Tree::StrStream->new; $html->{stream} = HTML::Stream->new($sStream); our $bgcolor = $html->{options}{bgcolor}; our $text = $html->{options}{text}; our $title = $html->_make_title; our $base = $html->{options}{base}; our $css = $html->{options}{css}; $html->emit_toc; our $toc = $sStream->get; $html->emit_body; our $body = $sStream->get; my $template = Text::Template->new( SOURCE => $tSource ) or die "Can't create Text::Template object: $Text::Template::ERROR\n"; $template->fill_in( OUTPUT => $fh ) or die $Text::Template::ERROR; } sub _make_title { my $html = shift; my $title = $html->{options}{title}; defined $title and return $title; my $children = $html->{root}->get_children; my $node1; my $i = 0; for my $child (@$children) { $child->is_pod or next; $i++ and $node1 = $child; $node1 and last; } $node1 or return undef; ##no critic (ProhibitExplicitReturnUndef) my $text = $node1->get_deep_text; ($title) = split m(\s+-), $text; $title or return undef; ##no critic (ProhibitExplicitReturnUndef) $title =~ s(\s+$)(); $title; } sub emit_toc { my $html = shift; $html->{options}{toc} or return; my $root = $html->{root}; my $nodes = $root->get_children; my @nodes = @$nodes; $html->_emit_toc_1( \@nodes ); $html->{options}{hr} > 0 and $html->{stream}->HR; } sub _emit_toc_1 { my ( $html, $nodes ) = @_; my $stream = $html->{stream}; $stream->UL; while (@$nodes) { my $node = $nodes->[0]; $node->is_c_head2 and $html->_emit_toc_2($nodes), next; $node->is_c_head1 and $html->_emit_toc_item($node); shift @$nodes; } $stream->_UL; } sub _emit_toc_2 { my ( $html, $nodes ) = @_; my $stream = $html->{stream}; $stream->UL; while (@$nodes) { my $node = $nodes->[0]; $node->is_c_head1 and last; $node->is_c_head2 and $html->_emit_toc_item($node); shift @$nodes; } $stream->_UL; } sub _emit_toc_item { my ( $html, $node ) = @_; my $stream = $html->{stream}; my $target = $html->_make_anchor($node); $stream->LI->A( HREF => "#$target" ); $html->_emit_children($node); $stream->_A; } sub emit_body { my $html = shift; my $root = $html->{root}; $html->_emit_children($root); } sub _emit_children { my ( $html, $node ) = @_; my $children = $node->get_children; for my $child (@$children) { $html->_emit_node($child); } } sub _emit_siblings { my ( $html, $node ) = @_; my $siblings = $node->get_siblings; if ( @$siblings == 1 and $siblings->[0]{type} eq 'ordinary' ) { # don't put

around a single ordinary paragraph $html->_emit_children( $siblings->[0] ); } else { for my $sibling (@$siblings) { $html->_emit_node($sibling); } } } sub _emit_node { my ( $html, $node ) = @_; my $type = $node->{type}; for ($type) { /command/ and $html->_emit_command($node); /for/ and $html->_emit_for($node); /item/ and $html->_emit_item($node); /list/ and $html->_emit_list($node); /ordinary/ and $html->_emit_ordinary($node); /sequence/ and $html->_emit_sequence($node); /text/ and $html->_emit_text($node); /verbatim/ and $html->_emit_verbatim($node); } } my %HeadTag = ( head1 => { 'open' => 'H1', 'close' => '_H1', level => 1 }, head2 => { 'open' => 'H2', 'close' => '_H2', level => 2 }, head3 => { 'open' => 'H3', 'close' => '_H3', level => 3 }, head4 => { 'open' => 'H4', 'close' => '_H4', level => 4 } ); sub _emit_command { my ( $html, $node ) = @_; my $stream = $html->{stream}; my $command = $node->get_command; my $head_tag = $HeadTag{$command}; $head_tag or return; my $anchor = $html->_make_anchor($node); $html->_emit_hr( $head_tag->{level} ); my $tag; $tag = $head_tag->{'open'}; $stream->$tag()->A( NAME => $anchor ); $html->_emit_children($node); $tag = $head_tag->{'close'}; $stream->_A->$tag(); } sub _emit_hr { my ( $html, $level ) = @_; $html->{options}{hr} > $level or return; $html->{skip_first}++ or return; $html->{stream}->HR; } sub _emit_for { my ( $html, $node ) = @_; my $interpreter = lc $node->get_arg; my $emit = "_emit_for_$interpreter"; $html->$emit($node) if $html->can($emit); } sub _emit_for_html { my ( $html, $node ) = @_; my $stream = $html->{stream}; $stream->P; $stream->io->print( $node->get_text ); $stream->_P; } sub _emit_for_image { my ( $html, $node ) = @_; my $stream = $html->{stream}; my $link = $node->get_text; $link =~ s(\s+$)(); $stream->IMG( src => $link ); } sub _emit_item { my ( $html, $node ) = @_; my $stream = $html->{stream}; my $item_type = $node->get_item_type; for ($item_type) { /bullet/ and do { $stream->LI(); $html->_emit_siblings($node); $stream->_LI(); }; /number/ and do { $stream->LI(); $html->_emit_siblings($node); $stream->_LI(); }; /text/ and do { my $anchor = $html->_make_anchor($node); $stream->DT->A( NAME => "$anchor" ); $html->_emit_children($node); $stream->_A->_DT->DD; $html->_emit_siblings($node); $stream->_DD; }; } } my %ListTag = ( bullet => { 'open' => 'UL', 'close' => '_UL' }, number => { 'open' => 'OL', 'close' => '_OL' }, text => { 'open' => 'DL', 'close' => '_DL' } ); sub _emit_list { my ( $html, $node ) = @_; my ( $list_tag, $tag ); # to quiet -w, see beloew my $stream = $html->{stream}; my $list_type = $node->get_list_type; $list_type and $list_tag = $ListTag{$list_type}; $list_tag and $tag = $list_tag->{'open'}; $tag and $stream->$tag(); $html->_emit_children($node); $list_tag and $tag = $list_tag->{'close'}; $tag and $stream->$tag(); } sub _emit_ordinary { my ( $html, $node ) = @_; my $stream = $html->{stream}; $stream->P; $html->_emit_children($node); $stream->_P; } sub _emit_sequence { my ( $html, $node ) = @_; for ( $node->get_letter ) { /I|B|C|F/ and $html->_emit_element($node), last; /S/ and $html->_emit_nbsp($node), last; /L/ and $html->_emit_link($node), last; /X/ and $html->_emit_index($node), last; /E/ and $html->_emit_entity($node), last; } } my %ElementTag = ( I => { 'open' => 'I', 'close' => '_I' }, B => { 'open' => 'B', 'close' => '_B' }, C => { 'open' => 'CODE', 'close' => '_CODE' }, F => { 'open' => 'I', 'close' => '_I' } ); sub _emit_element { my ( $html, $node ) = @_; my $letter = $node->get_letter; my $stream = $html->{stream}; my $tag; $tag = $ElementTag{$letter}{'open'}; $stream->$tag(); $html->_emit_children($node); $tag = $ElementTag{$letter}{'close'}; $stream->$tag(); } sub _emit_nbsp { my ( $html, $node ) = @_; my $old_method = $html->{text_method}; $html->{text_method} = 'text_nbsp'; $html->_emit_children($node); $html->{text_method} = $old_method; } sub _emit_link { my ( $html, $node ) = @_; my $stream = $html->{stream}; my $target = $node->get_target; my $domain = $target->get_domain; my $method = "make_${domain}_URL"; my $url = $html->$method($target); $stream->A( HREF => $url ); $html->_emit_children($node); $stream->_A; } sub make_POD_URL { my ( $html, $target ) = @_; my $link_map = $html->{options}{link_map}; return $link_map->url( $html, $target ) if $link_map->can("url"); $html->make_mapped_URL($target); } sub make_mapped_URL { my ( $html, $target ) = @_; my $link_map = $html->{options}{link_map}; my $base = $html->{options}{base} || ''; my $page = $target->get_page; my $section = $target->get_section; my $depth = $html->{options}{depth}; ( $base, $page, $section ) = $link_map->map( $base, $page, $section, $depth ); $base =~ s(/$)(); $page .= '.html' if $page; my $fragment = $html->escape_2396($section); my $url = $html->assemble_url( $base, $page, $fragment ); $url; } sub make_HTTP_URL { my ( $html, $target ) = @_; $target->get_page; } sub _emit_index { my ( $html, $node ) = @_; my $stream = $html->{stream}; my $anchor = $html->_make_anchor($node); $stream->A( NAME => $anchor )->_A; } sub _emit_entity { my ( $html, $node ) = @_; my $stream = $html->{stream}; my $entity = $node->get_deep_text; $stream->ent($entity); } sub _emit_text { my ( $html, $node ) = @_; my $stream = $html->{stream}; my $text = $node->get_text; my $text_method = $html->{text_method}; $stream->$text_method($text); } sub _emit_verbatim { my ( $html, $node ) = @_; my $stream = $html->{stream}; my $text = $node->get_text; $text =~ s(\n\n$)(); $stream->PRE->text($text)->_PRE; } sub _make_anchor { my ( $html, $node ) = @_; my $text = $node->get_deep_text; $text =~ s( \s*\n\s*/ )( )xg; # close line breaks $text =~ s( ^\s+ | \s+$ )()xg; # clip leading and trailing WS $html->escape_2396($text); } sub bin { oct '0b' . join '', @_ } my @LinkFormat = ( sub { my ( $b, $p, $f ) = @_; "" }, sub { my ( $b, $p, $f ) = @_; "#$f" }, sub { my ( $b, $p, $f ) = @_; "$p" }, sub { my ( $b, $p, $f ) = @_; "$p#$f" }, sub { my ( $b, $p, $f ) = @_; "$b/" }, sub { my ( $b, $p, $f ) = @_; "#$f" }, sub { my ( $b, $p, $f ) = @_; "$b/$p" }, sub { my ( $b, $p, $f ) = @_; "$b/$p#$f" } ); sub assemble_url { my ( $html, $base, $page, $fragment ) = @_; my $i = bin map { length($_) ? 1 : 0 } ( $base, $page, $fragment ); my $url = $LinkFormat[$i]( $base, $page, $fragment ); $url; } sub escape_2396 { my ( $html, $text ) = @_; $text =~ s(([^\w\-.!~*'()]))(sprintf("%%%02x", ord($1)))eg; $text; } __END__ =head1 NAME Pod::Tree::HTML - Generate HTML from a Pod::Tree =head1 SYNOPSIS use Pod::Tree::HTML; $source = Pod::Tree->new(%options); $source = "file.pod"; $source = IO::File->new; $source = \$pod; $source = \@pod; $dest = HTML::Stream->new; $dest = IO::File->new; $dest = "file.html"; $html = Pod::Tree::HTML->new($source, $dest, %options); $html->set_options(%options); @values = $html->get_options(@keys); $html->translate; $html->translate($template); $html->emit_toc; $html->emit_body; $fragment = $html->escape_2396 ($section); $url = $html->assemble_url($base, $page, $fragment); =head1 REQUIRES C, C =head1 DESCRIPTION C reads a POD and translates it to HTML. The source and destination are fixed when the object is created. Options are provided for controlling details of the translation. The C method does the actual translation. For convenience, C can read PODs from a variety of sources, and write HTML to a variety of destinations. The C method resolves the I<$source> and I<$dest> arguments. C can also use C to fill in an HTML template file. =head2 Source resolution C can obtain a POD from any of 5 sources. C resolves I<$source> by checking these things, in order: =over 4 =item 1 If I<$source> C C, then the POD is taken from that tree. =item 2 If I<$source> is not a reference, then it is taken to be the name of a file containing a POD. =item 3 If I<$source> C C, then it is taken to be an C object that is already open on a file containing a POD. =item 4 If I<$source> is a SCALAR reference, then the text of the POD is taken from that scalar. =item 5 if I<$source> is an ARRAY reference, then the paragraphs of the POD are taken from that array. =back If I<$source> isn't any of these things, C Cs. =head2 Destination resolution C can write HTML to any of 5 destinations. C resolves I<$dest> by checking these things, in order: =over 4 =item 1 If I<$dest> C C, then C writes HTML to that stream. =item 2 If I<$dest> C C, then C writes HTML to that file. =item 3 If I<$dest> has a C method, then C passes HTML to that method. =item 4 If I<$dest> is a SCALAR reference, then C writes HTML to that scalar. =item 5 If I<$dest> is a string, then C writes HTML to the file with that name. =back If I<$dest> isn't any of these things, C Cs. =head1 METHODS =over 4 =item I<$html> = C C I<$source>, I<$dest>, I<%options> Creates a new C object. I<$html> reads a POD from I<$source>, and writes HTML to I<$dest>. See L and L for details. Options controlling the translation may be passed in the I<%options> hash. See L for details. =item I<$html>->C(I<%options>) Sets options controlling the translation. See L for details. =item I<@values> = I<$html>->C(I<@keys>) Returns the current values of the options specified in I<@keys>. See L for details. =item I<$html>->C =item I<$html>->C(I<$template>) Translates the POD to HTML. This method should only be called once. In the second form, I<$template> is the name of a file containing a template. The template will be filled in by the C module. Here is a minimal template, showing example usage of all the variables that are set by C. {$title} {$toc} {$body} The program fragments in the template are evaulted in the C package. Any variables that you set in this package will be available to your template. When a template is used, the destination must not be an C object. C doesn't return anything. The first form always returns. The second form Cs if there is an error creating or filling in the template. =item I<$html>->C =item I<$html>->C Emits the table of contents and body of the HTML document. These methods are called automatically by C. They are exposed in the API for applications that wish to embed the HTML inside a larger document. =back =head2 Utility methods These methods are provided for implementors who write their own link mapper objects. =over 4 =item I<$fragment> = I<$html>->C(I<$section>) Escapes I<$section> according to RFC 2396. For example, the section some section is returned as some%20section =item I<$url> = I<$html>->C(I<$base>, I<$page>, I<$fragment>) Assembles I<$base>, I<$page>, and I<$fragment> into a URL, of the form $base/$page#$fragment Attempts to construct a valid URL, even if some of I<$base>, I<$page>, and I<$fragment> are empty. =back =head1 OPTIONS =over 4 =item C => I<$url> Specifies a base URL for relative HTML links. =item C => I<#rrggbb> Set the background color to I<#rrggbb>. Default is white. =item C => I<$url> Specifies a Cascading Style Sheet for the generated HTML page. =item C => I<$depth> Specifies the depth of the generated HTML page in a directory tree. See L for details. =item C => C<1> Causes the C method to emit an HTML file, even if the POD is empty. If this option is not provided, then no HTML file is created for empty PODs. =item C
=> I<$level> Controls the profusion of horizontal lines in the output, as follows: $level horizontal lines 0 none 1 between TOC and body 2 after each =head1 3 after each =head1 and =head2 Default is level 1. =item C => I<$link_map> Sets the link mapper. See L for details. =item C => I<#rrggbb> Set the text color to I<#rrggbb>. Default is black. =item C => I<title> Set the page title to I<title>. If no C<title> option is given, C<Pod::Tree::HTML> will attempt construct a title from the second paragrah of the POD. This supports the following style: =head1 NAME ls - list contents of directory =item C<toc> => [C<0>|C<1>] Includes or omits the table of contents. Default is to include the TOC. =back =head1 LINKS and TARGETS C<Pod::Tree::HTML> automatically generates HTML destination anchors for all =headI<n> command paragraphs, and for text items in =over lists. The text of the paragraph becomes the C<name> attribute of the anchor. Markups are ignored and the text is escaped according to RFC 2396. For example, the paragraph =head1 C<Foo> Bar is translated to <h1><a name="Foo%20Bar"><code>Foo</code> Bar</a></h1> To link to a heading, simply give the text of the heading in an C<< LZ<><> >> markup. The text must match exactly; markups may vary. Either of these would link to the heading shown above L</C<Foo> Bar> L</Foo Bar> To generate destination anchors in other places, use the index (C<< XZ<><> >>) markup We can link to X<this text> this text. and link to it as usual L</this text> uses the index markup. Earlier versions of this module also emitted the content of the XZ<><> markup as visible text. However, L<perlpod> now specifies that XZ<><> markups render as an empty string, so C<Pod::Tree::HTML> has been changed to do that. =head1 LINK MAPPING The POD specification provides the C<< LZ<><> >> markup to link from one document to another. HTML provides anchors (C<< <a href=""></a> >>) for the same purpose. Obviously, a POD2HTML translator should convert the first to the second. In general, this is a hard problem. In particular, the POD format is not powerful enough to support the kind of hyper-linking that people want in a complex documentation system. Rather than try to be all things to all people, C<Pod::Tree::HTML> uses a I<link mapper> object to translate the target of a POD link to a URL. The default link mapper does a simple translation, described below. If you don't like the default translation, you can provide your own link mapper with the L<< C<link_map> => I<$link_map> >> option. =head2 Default The default link mapper obtains the I<page> and I<section> from the target. It translates C<::> sequences in the I<page> to C</>, and returns a URL of the form [C<../>...][I<page>C<.html>][C<#>I<section>] If the L<< C<depth> => I<$depth> >> option is given, a corresponding number of C<../> sequences are prepended to I<page>. This is a relative URL, so it will be interpreted relative to the L<< C<base> => I<$url> >> option, if any. =head2 Custom To use your own link mapper, create a link mapper object and provide it to C<Pod::Tree::HTML> with the C<link_map> option sub MyMapper::new { bless {}, shift } sub MyMapper::url { my($mapper, $html, $target) = @_; ... return $url; } $mapper = MyMapper->new; $html = Pod::Tree::HTML->new(link_map => $mapper); Your object should implement one method =over 4 =item I<$url> = I<$mapper>->C<url>(I<$html>, I<$target>) When I<$html>->C<translate>() encounters an C<< LZ<><> >> markup, it calls I<$mapper>->C<url>. I<$html> is the C<Pod::Tree::HTML> object itself. I<$target> is a C<Pod::Tree::Node> object representing the the target of the link. See L<Pod::Tree::Node/target nodes> for information on interpreting I<$target>. The C<url> method must return a string, which will be emitted as the value of the C<href> attribute of an HTML anchor: C<< <a href=" >>I<$url>C<< "> >>...C<< </a> >> C<Pod:Tree:HTML> provides the C<escape_2396> and C<assemble_url> methods for convenience in implementing link mappers. =back If the link mapper does not provide a C<url> method, C<Pod::Tree::HTML> will call C<map> =over 4 =item (I<$base>, I<$page>, I<$section>) = I<$mapper>-E<gt>C<map>(I<$base>, I<$page>, I<$section>, I<$depth>); Where =over 4 =item I<$base> is the URL given in the C<base> option. =item I<$page> is the man page named in the LE<lt>E<gt> markup. =item I<$section> is the man page section given in the LE<lt>E<gt> markup. =item I<$depth> is the value of the C<depth> option. =back The C<map> method may perform arbitrary mappings on its arguments. C<Pod::Tree::HTML> takes the returned values and constructs a URL of the form [I<$base>/][I<$page>C<.html>][C<#>I<$fragment>] =back The C<map> method is =over 4 =item * deprecated =item * less flexible than the C<url> method =item * supported for backwards compatibility with older versions of C<Pod::Tree::HTML> =back =head1 DIAGNOSTICS =over 4 =item C<Pod::Tree::HTML::new: not enough arguments> (F) C<new> called with fewer than 2 arguments. =item C<Pod::Tree::HTML::new: Can't load POD from $source> (F) C<new> couldn't resolve the I<$source> argument. See L</Source resolution> for details. =item C<Pod::Tree::HTML::new: Can't write HTML to $dest> (F) C<new> couldn't resolve the I<$dest> argument. See L</Destination resolution> for details. =item C<Pod::Tree::HTML::new: Can't open $dest: $!> (F) The destination file couldn't be opened. =back =head1 SEE ALSO perl(1), L<C<Pod::Tree>>, L<C<Pod::Tree::Node>>, L<C<Text::Template>> =head1 AUTHOR Steven McDougall, swmcd@world.std.com =head1 COPYRIGHT Copyright (c) 1999-2009 by Steven McDougall. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pod-Tree-1.31/lib/Pod/Tree/PerlUtil.pm��������������������������������������������������������������0000644�0001750�0001750�00000003531�13433574665�016720� 0����������������������������������������������������������������������������������������������������ustar �manwar��������������������������manwar�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������package Pod::Tree::PerlUtil; use 5.006; use strict; use warnings; our $VERSION = '1.31'; sub mkdir { my ( $translator, $dir ) = @_; -d $dir or CORE::mkdir $dir, oct(755) or die "Pod::Tree::PerlUtil::mkdir: Can't mkdir $dir: $!\n"; } sub report1 { my ( $translator, $routine ) = @_; $translator->{options}{v} < 1 and return; my $package = ref $translator; my $name = "${package}::$routine"; my $pad = 60 - length $name; print STDERR $name, ' ' x $pad, "\n"; } sub report2 { my ( $translator, $page ) = @_; my $verbosity = $translator->{options}{v}; $verbosity == 2 and do { my $pad = 60 - length $page; print STDERR $page, ' ' x $pad, "\r"; }; $verbosity == 3 and print STDERR "$page\n"; } sub get_name { my ( $node, $source ) = @_; my $tree = Pod::Tree->new; $tree->load_file($source); my $children = $tree->get_root->get_children; my @pod = grep { $_->is_pod } @$children; my $node1 = $pod[1]; $node1 or return (); my $text = $node1->get_deep_text; $text =~ s(\s+)( )g; $text =~ s(^ )(); $text =~ s( $)(); my ( $name, $description ) = split m(\s+-+\s+), $text, 2; $name or return (); # empty!!! if ( $name =~ /\s/ and not $description ) { $description = $name; my @description = split ' ', $description; if ( @description > 1 and $description[0] =~ /::/ ) { $name = shift @description; # guess $description = join ' ', @description; } else # desperation { my @source = split m(/), $source; $name = pop @source; } } ( $name, $description ); } sub get_description { my ( $node, $source ) = @_; my ( $name, $description ) = $node->get_name($source); $description; } 1 __END__ Copyright (c) 2000 by Steven McDougall. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. �����������������������������������������������������������������������������������������������������������������������������������������������������������������������Pod-Tree-1.31/Makefile.PL���������������������������������������������������������������������������0000644�0001750�0001750�00000004441�13400731633�014366� 0����������������������������������������������������������������������������������������������������ustar �manwar��������������������������manwar�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������use 5.006; use strict; use warnings; use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. my $prereq_pm = { 'File::Find' => 1, 'HTML::Stream' => 1.49, 'IO::File' => 1, 'IO::String' => 1, 'Pod::Escapes' => 1.02, 'Text::Template' => 1, }; for my $interesting_module (qw( Perl::Tidy Code::TidyAll )) { eval "require $interesting_module"; if (!$@) { $prereq_pm->{$interesting_module} ||= 0; } } my %config = ( NAME => 'Pod::Tree', VERSION_FROM => 'lib/Pod/Tree.pm', # finds $VERSION DISTNAME => 'Pod-Tree', ( $] >= 5.005 ? ( ABSTRACT_FROM => 'lib/Pod/Tree.pm', AUTHOR => 'Steven McDougall (swmcd@world.std.com)' ) : () ), ( $ExtUtils::MakeMaker::VERSION >= 6.3002 ? ( 'LICENSE' => 'perl' ) : () ), clean => { FILES => "Pod-Tree-* t/pod2html.d/*.html* t/pods2html.d/A t/pods2html.d/html_act* t/pods2html.d/podR/HTML t/*/*.act lib/Pod/Tree/*~" }, dist => { COMPRESS => 'gzip --best', SUFFIX => '.gz' }, EXE_FILES => [qw(mod2html podtree2html pods2html perl2html)], PREREQ_PM => $prereq_pm, ( eval { ExtUtils::MakeMaker->VERSION(6.46) } ? ( META_MERGE => { 'meta-spec' => { version => 2 }, resources => { repository => { type => 'git', url => 'http://github.com/manwar/Pod-Tree.git', web => 'http://github.com/manwar/Pod-Tree', }, bugtracker => { web => 'http://github.com/manwar/Pod-Tree/issues', }, homepage => 'http://metacpan.org/pod/Pod::Tree', }, } ) : () ) ); my %test_requires = ( 'Test::More' => 1, 'Test::Compile' => '1.2.1', 'Path::Tiny' => '0.105', ); if ( eval { ExtUtils::MakeMaker->VERSION(6.64) } ) { $config{TEST_REQUIRES} = \%test_requires; } else { $config{BUILD_REQUIRES} = \%test_requires; } WriteMakefile(%config); �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pod-Tree-1.31/ToDo����������������������������������������������������������������������������������0000644�0001750�0001750�00000000235�13377746260�013220� 0����������������������������������������������������������������������������������������������������ustar �manwar��������������������������manwar�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������t/template.t add tests for the new destinations perl2html - template support? mod2html - program to generate a properly linked tree of module pods in HTML �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pod-Tree-1.31/README��������������������������������������������������������������������������������0000644�0001750�0001750�00000004070�13377746260�013311� 0����������������������������������������������������������������������������������������������������ustar �manwar��������������������������manwar�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pod::Tree - Tree-based POD parser DESCRIPTION Modules Pod::Tree parses a POD into a static syntax tree. Applications walk the tree to recover the structure and content of the POD. Pod::Tree::HTML walks a Pod::Tree and translates it to HTML. Pod::Tree::Pod walks a Pod::Tree and translates it back to POD. Pod::Tree::Perl* translate the PODs in the Perl distribution to HTML. Executables podtree2html translates a POD file to an HTML file. pods2html walks a directory tree, translates all the PODs that it finds into HTML files, and puts the HTML files into a parallel directory tree. perl2html translates the PODs in the Perl distribution to HTML PREREQUISITES Perl 5 File::Find HTML::Stream IO::File IO::String Pod::Escapes Text::Template HOW TO BUILD AND INSTALL perl Makefile.PL make make test make install You may see a message like Warning: prerequisite HTML::Stream 1.49 not found. You can ignore this, provided that you actually have HTML::Stream 1.49 or later installed. TODO See the ToDo and ToDo.Not files. ACKNOWLEDGMENTS <crazyinsomniac@yahoo.com> <joenio@cpan.org> Paul Bettinger <paul@n8geil.de> Sean M. Burke <sburke@spinn.net> Brad Choate <brad@bradchoate.com> Havard Eidnes <he@NetBSD.org> Rudi Farkas <rudif@bluemail.ch> Paul Gibeault <pagibeault@micron.com> Jay Hannah <jhannah@omnihotels.com> Martin Hans <mah@oticon.dk> Paul Hawkins <phawkins@datajunction.com> Jost Krieger <Jost.Krieger@ruhr-uni-bochum.de> Marc A. Lehmann <pcg@goof.com> Jonas Liljegren <jonas@jonas.rit.se> Thomas Linden <tom@co.daemon.de> Johan Lindstrom <johanl@bahnhof.se> Terry Luedtke <terry_luedtke@nlm.nih.gov> Rob Napier <rnapier@employees.org> Kate L Pugh <kake@earth.li> Christopher Shalah <trance@drizzle.com> Blair Sutton <bsdz@numeninest.com> Johan Vromans <JVromans@Squirrel.nl> COPYRIGHT Copyright (c) 1999-2010 by Steven McDougall. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pod-Tree-1.31/perl2html�����������������������������������������������������������������������������0000755�0001750�0001750�00000006752�13377746260�014301� 0����������������������������������������������������������������������������������������������������ustar �manwar��������������������������manwar�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/local/bin/perl use 5.006; use strict; use warnings; use Config; use Getopt::Long; use Pod::Tree::PerlBin; use Pod::Tree::PerlDist; use Pod::Tree::PerlFunc; use Pod::Tree::PerlLib; use Pod::Tree::PerlMap; use Pod::Tree::PerlPod; use Pod::Tree::PerlTop; my %Opts; $Opts{toc} = 1; my $ok = GetOptions( \%Opts, "v:i", "toc!", "hr:i", "bgcolor:s", "text:s" ); $ok or die "Bad command line options\n"; my ( $Perl_Dir, $HTML_Dir ) = @ARGV; $HTML_Dir or die "perl2html Perl_Dir HTML_Dir\n"; $Perl_Dir =~ s( /$ )()x; $HTML_Dir =~ s( /$ )()x; $| = 1; umask 0022; -d $HTML_Dir or mkdir $HTML_Dir, 0777 or die "Can't mkdir $HTML_Dir: $!\n"; my ($Perl_Map); my ( $Perl_Bin, $Perl_Dist, $Perl_Func, $Perl_Lib, $Perl_Pod, $Perl_Top ); $Perl_Map = Pod::Tree::PerlMap->new; $Perl_Bin = Pod::Tree::PerlBin->new( $Perl_Dir, $HTML_Dir, $Perl_Map, %Opts ); $Perl_Dist = Pod::Tree::PerlDist->new( $Perl_Dir, $HTML_Dir, $Perl_Map, %Opts ); $Perl_Func = Pod::Tree::PerlFunc->new( $Perl_Dir, $HTML_Dir, $Perl_Map, %Opts ); $Perl_Lib = Pod::Tree::PerlLib->new( $Perl_Dir, $HTML_Dir, $Perl_Map, %Opts ); $Perl_Pod = Pod::Tree::PerlPod->new( $Perl_Dir, $HTML_Dir, $Perl_Map, %Opts ); $Perl_Top = Pod::Tree::PerlTop->new( $Perl_Dir, $HTML_Dir, $Perl_Map, %Opts ); $Perl_Pod->scan; $Perl_Bin->scan( split /$Config{path_sep}/, $ENV{PATH} ); $Perl_Dist->scan; $Perl_Func->scan; $Perl_Lib->scan(@INC); $Perl_Bin->index; $Perl_Dist->index; $Perl_Func->index; $Perl_Lib->index; $Perl_Pod->index; $Perl_Top->index( $Perl_Top, $Perl_Pod, $Perl_Lib, $Perl_Bin, $Perl_Dist ); $Perl_Bin->translate; $Perl_Dist->translate; $Perl_Func->translate; $Perl_Lib->translate; $Perl_Pod->translate; $Perl_Top->translate; __END__ =head1 NAME perl2html - generate Perl documentation in HTML =head1 SYNOPSIS B<perl2html> [B<-->[B<no>]B<toc>] [B<--hr> I<level>] [B<--bgcolor> B<#>I<rrggbb>] [B<--text> B<#>I<rrggbb>] [B<--v> I<verbosity>] I<PerlDir> I<HTMLDir> =head1 DESCRIPTION B<perl2html> translates Perl documentation to HTML. I<PerlDir> is the root of the Perl source tree. The HTML pages are organized into a directory tree rooted at I<HTMLDir>. A top-level index is written to I<HTMLDir>C</index.html> In addition to the Perl sources, B<perl2html> searches C<@INC> for module PODs, and C<$ENV{PATH}> for program PODS. All the HTML pages are created world-readable. I<Perldir> and I<HTMLDir> must be absolute path names. =head1 OPTIONS =over 4 =item C<-->[C<no>]C<toc> Includes or omits a table of contents in each page. Default is to include the TOC. =item C<--hr> I<level> Controls the profusion of horizontal lines in the output, as follows: level horizontal lines 0 none 1 between TOC and body 2 after each =head1 3 after each =head1 and =head2 Default is level 1. =item C<--bgcolor> I<#rrggbb> Set the background color to I<#rrggbb>. Default is off-white. =item C<--text> I<#rrggbb> Set the text color to I<#rrggbb>. Default is black. =item C<--v> I<verbosity> Verbosity level: 0, 1, 2, 3 =back =head1 REQUIRES Perl 5 L<C<Getopt::Long>>, =head1 SEE ALSO L<C<pods2html>>, L<C<Pod::Tree>>, L<C<Pod::Tree::HTML>>, L<C<Pod::Tree::PerlBin>>, L<C<Pod::Tree::PerlDist>>, L<C<Pod::Tree::PerlFunc>>, L<C<Pod::Tree::PerlLib>>, L<C<Pod::Tree::PerlMap>>, L<C<Pod::Tree::PerlPod>>, L<C<Pod::Tree::PerlTop>> =head1 AUTHOR Steven McDougall, swmcd@world.std.com =head1 COPYRIGHT Copyright 2000 by Steven McDougall. This program is free software; you can redistribute it and/or modify it under the same terms as Perl. ����������������������Pod-Tree-1.31/.perltidyrc���������������������������������������������������������������������������0000644�0001750�0001750�00000000153�13377746260�014611� 0����������������������������������������������������������������������������������������������������ustar �manwar��������������������������manwar�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������-pbp -nst -et=4 --maximum-line-length=120 # Break a line after opening/before closing token. -vt=0 -vtc=0 ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pod-Tree-1.31/META.json�����������������������������������������������������������������������������0000664�0001750�0001750�00000003230�13433752154�014041� 0����������������������������������������������������������������������������������������������������ustar �manwar��������������������������manwar�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������{ "abstract" : "Create a static syntax tree for a POD", "author" : [ "Steven McDougall (swmcd@world.std.com)" ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Pod-Tree", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "Code::TidyAll" : "0", "File::Find" : "1", "HTML::Stream" : "1.49", "IO::File" : "1", "IO::String" : "1", "Perl::Tidy" : "0", "Pod::Escapes" : "1.02", "Text::Template" : "1" } }, "test" : { "requires" : { "Path::Tiny" : "0.105", "Test::Compile" : "v1.2.1", "Test::More" : "1" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "http://github.com/manwar/Pod-Tree/issues" }, "homepage" : "http://metacpan.org/pod/Pod::Tree", "repository" : { "type" : "git", "url" : "http://github.com/manwar/Pod-Tree.git", "web" : "http://github.com/manwar/Pod-Tree" } }, "version" : "1.31", "x_serialization_backend" : "JSON::PP version 4.00" } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pod-Tree-1.31/pods2html�����������������������������������������������������������������������������0000755�0001750�0001750�00000015735�13377746260�014305� 0����������������������������������������������������������������������������������������������������ustar �manwar��������������������������manwar�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/local/bin/perl use 5.006; use strict; use warnings; use File::Find; use File::Path; use Getopt::Long; use HTML::Stream; use IO::File; use Pod::Tree::HTML; use File::Spec; my %Options = ( bgcolor => '#ffffff', text => '#000000', hr => 1, toc => 1 ); my $ok = GetOptions( \%Options, "base:s", "css:s", "bgcolor:s", "empty", "index:s", "module", "text:s", "toc!", "hr:i", "variables:s" ); $ok or die "Bad command line options\n"; my %Index; my @Dirs; my ( $PodDir, $HTMLDir, $Template, @Variables ) = @ARGV; $HTMLDir or die "pods2html PodDir HTMLDir\n"; $PodDir = canonpath File::Spec $PodDir; $HTMLDir = rel2abs File::Spec $HTMLDir; mkpath($HTMLDir); do $Options{variables} if $Options{variables}; for (@Variables) { chomp; my ( $name, $value ) = split /=/, $_, 2; $name =~ s(^\$)(); ${ $Pod::Tree::HTML::{$name} } = $value; } umask 0022; find( { wanted => \&Translate, no_chdir => 1 }, $PodDir ); Index() if $Options{index}; Cleanup() unless $Options{empty}; sub Translate { -d and &Translate_Dir; -f and &Translate_POD; } sub MkDir { my $dir = shift; -d $dir and return; mkdir $dir, 0755 or die "Can't mkdir $dir: $!\n"; push @Dirs, $dir; } sub Translate_Dir { my $dir = $File::Find::name; if ( $HTMLDir eq rel2abs File::Spec $dir) { $File::Find::prune = 1; return; } if ( $Options{module} and ( m(/t$) or m(/blib$) ) ) { $File::Find::prune = 1; return; } $dir =~ s/^\Q$PodDir/$HTMLDir/o; -d $dir or MkDir $dir; print "$File::Find::name\n"; } sub Translate_POD { m( \.(pm|pod)$ )x or return; my $source = $File::Find::name; Hidden($source) and return; print "$source\n"; my $dest = $source; $dest =~ s/^\Q$PodDir/$HTMLDir/o; $dest =~ s( \.\w+$ )(.html)x; my $depth = Depth($source); my $pod = $source; $pod =~ s(^\Q$PodDir\E/)(); $pod =~ s( \.\w+$ )()x; $Index{$pod} = 1; my $html = Pod::Tree::HTML->new( $source, $dest, %Options ); $html->set_options( depth => $depth ); $html->translate($Template); } sub Hidden { my $source = shift; $source =~ m(\.pm$) or return 0; $source =~ s(\.pm$)(.pod); -e $source; } sub Depth { my $source = shift; my $tree = Pod::Tree->new; $tree->load_file($source); my $children = $tree->get_root->get_children; my @pod = grep { $_->is_pod } @$children; my $node1 = $pod[1]; $node1 or return ''; my $text = $node1->get_deep_text; my ($name) = split m(\s+-+\s+), $text; $name =~ s(^\s+)(); my @name = split /::/, $name; @name - 1; } sub Index { my $index = "$HTMLDir/index.html"; my $fh = IO::File->new(">$index"); defined $fh or die "Can't open $index: $!\n"; my $stream = HTML::Stream->new($fh); my $title = $Options{index}; my $bgcolor = $Options{bgcolor}; my $text = $Options{text}; $stream->HTML->HEAD; $stream->TITLE->text($title)->_TITLE; $stream->_HEAD->BODY( BGCOLOR => $bgcolor, TEXT => $text ); $stream->H1->t($title)->_H1; Emit_Entries($stream); $stream->_BODY->_HTML; } sub Emit_Entries { my $stream = shift; $stream->UL; for my $entry ( sort keys %Index ) { $stream->LI->A( HREF => "$entry.html" )->t($entry)->_A->_LI; } $stream->_UL; } sub Cleanup { while (@Dirs) { my $dir = pop @Dirs; rmdir $dir; # does nothing unless $dir is empty } } __END__ =head1 NAME pods2html - translate a tree of PODs to HTML =head1 SYNOPSIS C<pods2html> [C<--base> I<url>] [C<--css> I<url>] [C<--empty>] [C<--index> I<title>] [C<--module>] [C<-->[C<no>]C<toc>] [C<--hr> I<level>] [C<--bgcolor> I<#rrggbb>] [C<--text> I<#rrggbb>] [C<--variables> I<values.pl>] I<PODdir> I<HTMLdir> [F<template> [I<variable>=I<value> ...]] =head1 DESCRIPTION C<pods2html> finds all the F<.pod> and F<.pm> files in the directory tree rooted at I<PODdir>. It translates each POD to HTML, and writes it to a parallel directory tree rooted at I<HTMLdir> It makes the HTML files world-readable. If a F<template> file is provided, then F<template> will be filled in by the C<Text::Template> module and written to F<dest>. Here is a minimal template, showing all the variables that are set by C<pods2html>. <html> <head> <base href="{$base}"> <link href="{$css}" rel="stylesheet" type="text/css"> <title>{$title} {$toc} {$body} If the C<--variables> option is provided, then the file I will be executed with a C call before the template is filled in. I may contain arbitrary Perl code. The program fragments in the template are evaulted in the C package. Any variables that I sets in this package will be available to the template. Additional scalar variables may be set on the command line with the I=I syntax. Variables set on the command line override variables set in I. =head1 OPTIONS =over 4 =item C<--base> I Specifies a base URL for HTML links. =item C<--css> I Specifies a Cascanding Style Sheet for the generated HTML pages. Here are example rules for all the different HTML elements that may appear in a POD. a:link { background: #ff8080 } body { background: #f0f0f0 } code { background: #c0ffc0 } dd { background: #ffffe0 } dl { background: #fffff0 } dt { background: #ffffc0 } h1 { background: #ffc0c0 } h2 { background: #ffe0e0 } hr { background: #ff0000; height: 5px } i { background: #ffc0c0 } li { background: #e0e0e0 } ol { background: #fff0ff } p { background: #f0f0ff } pre { background: #f0fff0 } ul { background: #f0ffff } =item C<--empty> Creates HTML files for empty PODs. If this option is not provided, then no HTML file is created for empty PODs. =item C<--index> I Writes an index of all the HTML files to I<HTMLDir>F</index.html>. I<title> is used as the title of the index page. =item C<--module> Ignores files in directories named F<t/> and F<blib/>. Useful for translating PODs in a module development directory. =item C<-->[C<no>]C<toc> Includes or omits the table of contents. Default is to include the TOC. =item C<--hr> I<level> Controls the profusion of horizontal lines in the output, as follows: level horizontal lines 0 none 1 between TOC and body 2 after each =head1 3 after each =head1 and =head2 Default is level 1. =item C<--bgcolor> I<#rrggbb> Set the background color to I<#rrggbb>. Default is white. =item C<--text> I<#rrggbb> Set the text color to I<#rrggbb>. Default is black. =back =head1 REQUIRES L<C<Pod::Tree::HTML>>, L<C<HTML::Stream>> =head1 BUGS The recursion check doesn't work on Win32. This means that the program will enter an infinite recursion if I<HTMLdir> is a subdirectory of I<PODdir>. =head1 SEE ALSO L<C<pod2html>>, L<C<Pod::Tree::HTML>> =head1 AUTHOR Steven McDougall, <swmcd@world.std.com> =head1 COPYRIGHT Copyright (c) 1999-2010 by Steven McDougall. This program is free software; you can redistribute it and/or modify it under the same terms as Perl. �����������������������������������Pod-Tree-1.31/skeleton������������������������������������������������������������������������������0000644�0001750�0001750�00000004410�13377746260�014176� 0����������������������������������������������������������������������������������������������������ustar �manwar��������������������������manwar�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������use strict; sub WalkTree { my $tree = shift; # a Pod::Tree object my $root = $tree->get_root; # the root node of the tree WalkNode($root); } sub WalkNode { my $node = shift; my $type = $node->get_type; for ($type) { /root/ and WalkRoot ($node), last; /verbatim/ and WalkVerbatim($node), last; /ordinary/ and WalkOrdinary($node), last; /command/ and WalkCommand ($node), last; /sequence/ and WalkSequence($node), last; /text/ and WalkText ($node), last; /list/ and WalkList ($node), last; /item/ and WalkItem ($node), last; /for/ and WalkFor ($node), last; } } sub WalkRoot { my $node = shift; WalkChildren($node); } sub WalkVerbatim { my $node = shift; my $text = $node->get_text; } sub WalkOrdinary { my $node = shift; WalkChildren($node); } sub WalkCommand { my $node = shift; my $command = node->get_command; WalkChildren($node); } sub WalkSequence { my $node = shift; my $letter = node->get_letter; is_link $node and do { my $target = $node->get_target; my $page = $target->get_page; my $section = $target->get_section; }; WalkChildren($node); } sub WalkText { my $node = shift; my $text = $node->get_text; } sub WalkList { my $node = shift; my $indent = $node->get_arg; my $list_type = $node->get_list_type; for ($list_type) { /bullet/ and last; /number/ and last; /text/ and last; } WalkChildren($node); # text of the =over paragraph WalkSiblings($node); # items in the list } sub WalkItem { my $node = shift; my $item_type = $node->get_list_type; for ($item_type) # could be different from $list_type { /bullet/ and last; /number/ and last; /text/ and last; } WalkChildren($node); # text of the =item paragraph } sub WalkFor { my $node = shift; my $formatter = $node->get_arg; my $text = $node->get_text; } sub WalkChildren { my $node = shift; my $children = $node->get_children; for my $child (@$children) { WalkNode($child); } } sub WalkSiblings { my $node = shift; my $siblings = $node->get_siblings; for my $sibling (@$siblings) { WalkNode($sibling); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pod-Tree-1.31/ToDo.Not������������������������������������������������������������������������������0000644�0001750�0001750�00000003047�13377746260�013763� 0����������������������������������������������������������������������������������������������������ustar �manwar��������������������������manwar�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Things I can't/don't want to do 1. Make pods2html emit a frameset with the index in one frame and the POD in the other. This is an easy hack on pods2html for anyone who wants it. If people want lots of hacks like this, it might be worth adding hooks to pods2html to support them. 2. Remove the ($] >= 5.005 ? key from Makefile.PL I had a complaint that this syntax breaks on Cygwin, but I can no longer contact the person who reported it to confirm the problem. 3. Generate an index and TOC in the sytle of Marek::Pod::Html This is - beyond the scope of POD - beyond the scope of Pod::Tree 4. XHTML support I've had a request for XHTML compliance. I thought this would be easy - downcase all the tags - maybe a few other tweaks However, Pod::Tree::HTML uses HTML::Stream to emit the HTML, so doing this means either hacking or replacing that module. I don't want to do the first, and the second is a big job. 5. Solaris problem A test failure on Solaris that I don't understand and probably can't reproduce. This may be another example of the $Config{perlpath} vs. perl problem. 6. Complaint of -w warnings on empty paragraphs I can't reproduce this, and I haven't been able to contact the reporter. 7. HTML classes for CSS I have a request to specify HTML classes to support CSS. It's not hard to do, but it bulks up both the code and the generated HTML, and it isn't clear that it gains anything. Style sheets can use HTML element names as selectors. POD is so simple that I don't think there are any HTML elements that are used in more than one context. �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pod-Tree-1.31/podtree2html��������������������������������������������������������������������������0000755�0001750�0001750�00000007733�13377746260�015001� 0����������������������������������������������������������������������������������������������������ustar �manwar��������������������������manwar�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/local/bin/perl use 5.006; use strict; use warnings; use Getopt::Long; use Pod::Tree::HTML; my %Options; $Options{toc} = 1; my $ok = GetOptions( \%Options, "base:s", "css:s", "toc!", "hr:i", "bgcolor:s", "text:s", "variables:s" ); $ok or die "Bad command line options\n"; umask 0022; @ARGV < 2 and die "podtree2html PODfile HTMLfile [templateFile]\n"; my ( $source, $dest, $template, @variables ) = @ARGV; my $html = Pod::Tree::HTML->new( $source, $dest ); $html->set_options(%Options); do $Options{variables} if $Options{variables}; for (@variables) { chomp; my ( $name, $value ) = split /=/, $_, 2; $name =~ s(^\$)(); ${ $Pod::Tree::HTML::{$name} } = $value; } $html->translate($template); __END__ =head1 NAME podtree2html - translate a POD to HTML =head1 SYNOPSIS C<podtree2html> [C<--base> I<url>] [C<--css> I<url>] [C<-->[C<no>]C<toc>] [C<--hr> I<level>] [C<--bgcolor> I<#rrggbb>] [C<--text> I<#rrggbb>] [C<--variables> I<values.pl>] F<source> F<dest> [F<template>] [I<variable>=I<value> ...]] =head1 DESCRIPTION C<podtree2html> reads the POD in file F<source>, translates it to HTML, and writes it to file F<dest>. F<dest> is created world-readable. If a F<template> file is provided, then F<template> will be filled in by the C<Text::Template> module and written to F<dest>. Here is a minimal template, showing all the variables that are set by C<podtree2html>. <html> <head> <base href="{$base}"> <link href="{$css}" rel="stylesheet" type="text/css"> <title>{$title} {$toc} {$body} If the C<--variables> option is provided, then the file I will be executed with a C call before the template is filled in. I may contain arbitrary Perl code. The program fragments in the template are evaulted in the C package. Any variables that I sets in this package will be available to the template. Additional scalar variables may be set on the command line with the I=I syntax. Do not prefix I with a C<$> sigil. Variables set on the command line override variables set in I. =head1 OPTIONS =over 4 =item C<--base> I Translate CE> sequences into HTML links relative to I. =item C<--css> I Specifies a Cascanding Style Sheet for the generated HTML page. Here are example rules for all the different HTML elements that may appear in a POD. a:link { background: #ff8080 } body { background: #f0f0f0 } code { background: #c0ffc0 } dd { background: #ffffe0 } dl { background: #fffff0 } dt { background: #ffffc0 } h1 { background: #ffc0c0 } h2 { background: #ffe0e0 } hr { background: #ff0000; height: 5px } i { background: #ffc0c0 } li { background: #e0e0e0 } ol { background: #fff0ff } p { background: #f0f0ff } pre { background: #f0fff0 } ul { background: #f0ffff } =item C<-->[C]C Includes or omits the table of contents. Default is to include the TOC. =item C<--hr> I Controls the profusion of horizontal lines in the output, as follows: level horizontal lines 0 none 1 between TOC and body 2 after each =head1 3 after each =head1 and =head2 Default is level 1. =item C<--bgcolor> I<#rrggbb> Set the background color to I<#rrggbb>. Default is white. =item C<--text> I<#rrggbb> Set the text color to I<#rrggbb>. Default is black. =item C<--variables> I Execute the file I with a C call before filling in I