| 1 | package Pod::PalmDoc; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use vars qw($text $doc $doc_text @ISA $VERSION @EXPORT); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | require Exporter; | ||
| 7 | |||
| 8 | 1 | ▶ | use Pod::Parser; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 0 | ▶ | use Palm::PalmDoc '0.0.6'; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 10 | @ISA = qw(Exporter Pod::Parser); | ||
| 11 | |||
| 12 | @EXPORT = qw(); | ||
| 13 | |||
| 14 | $VERSION = '0.0.2'; | ||
| 15 | |||
| 16 | $doc = Palm::PalmDoc->new(); | ||
| 17 | |||
| 18 | sub command { | ||
| 19 | my ($parser, $command, $paragraph, $line_num) = @_; | ||
| 20 | $paragraph .= "\n" unless substr($paragraph, -1) eq "\n"; | ||
| 21 | $paragraph .= "\n" unless substr($paragraph, -2) eq "\n\n"; | ||
| 22 | $text .= $paragraph; | ||
| 23 | } | ||
| 24 | |||
| 25 | sub verbatim { | ||
| 26 | my ($parser, $paragraph, $line_num) = @_; | ||
| 27 | $text .= $paragraph; | ||
| 28 | } | ||
| 29 | |||
| 30 | sub textblock { | ||
| 31 | my ($parser, $paragraph, $line_num) = @_; | ||
| 32 | $text .= $paragraph; | ||
| 33 | } | ||
| 34 | |||
| 35 | sub interior_sequence { | ||
| 36 | my ($parser, $seq_command, $seq_argument) = @_; | ||
| 37 | return "$seq_command<$seq_argument>"; | ||
| 38 | } | ||
| 39 | |||
| 40 | sub title { | ||
| 41 | my $parser = shift; | ||
| 42 | if (@_) | ||
| 43 | { $doc->title(shift); } | ||
| 44 | } | ||
| 45 | |||
| 46 | sub compress { | ||
| 47 | my $parser = shift; | ||
| 48 | if (@_) | ||
| 49 | { $doc->compression(shift); } | ||
| 50 | } | ||
| 51 | |||
| 52 | sub begin_pod { | ||
| 53 | my $parser = shift; | ||
| 54 | $doc->outfile($parser->output_file()) if $parser->output_file(); | ||
| 55 | } | ||
| 56 | |||
| 57 | sub end_pod { | ||
| 58 | my $parser = shift; | ||
| 59 | $doc->body($text) if $text; | ||
| 60 | $doc->write_text if $doc->outfile; | ||
| 61 | my $fhandle = $parser->output_handle(); | ||
| 62 | print $fhandle $doc->pdb_header, $doc->body if $fhandle; | ||
| 63 | } | ||
| 64 | |||
| 65 | 1; | ||
| 66 | __END__ | ||