| 1 |
pippijn |
1.1 |
package PodHelp; |
| 2 |
|
|
|
| 3 |
|
|
use strict; |
| 4 |
|
|
use warnings; |
| 5 |
|
|
use utf8; |
| 6 |
|
|
|
| 7 |
pippijn |
1.6 |
my $rcsid = '$Id: PodHelp.pm,v 1.5 2007-08-28 17:08:06 pippijn Exp $'; |
| 8 |
pippijn |
1.2 |
|
| 9 |
pippijn |
1.1 |
use base "Pod::POM::View"; |
| 10 |
|
|
|
| 11 |
|
|
our $subdir; |
| 12 |
|
|
|
| 13 |
|
|
sub view_pod { |
| 14 |
|
|
my ($self, $item) = @_; |
| 15 |
|
|
mkdir "help"; |
| 16 |
|
|
mkdir "help/$subdir"; |
| 17 |
|
|
$item->content->present ($self) |
| 18 |
|
|
} |
| 19 |
|
|
|
| 20 |
|
|
sub view_head1 { |
| 21 |
|
|
my ($self, $item) = @_; |
| 22 |
|
|
my $file; |
| 23 |
|
|
if ($item->title =~ /\|/) { |
| 24 |
|
|
my @cmds = split /\|/, $item->title; |
| 25 |
|
|
for my $cmd (@cmds) { |
| 26 |
|
|
my $content = "Help for \002$cmd\002:\n" . $item->content->present ($self); |
| 27 |
|
|
$content =~ s/\$CMD/$cmd/g; |
| 28 |
|
|
$file = "help/$subdir/" . lc $cmd; |
| 29 |
|
|
$file =~ s/ /_/g; |
| 30 |
|
|
open my $fh, ">", $file; |
| 31 |
|
|
print $fh $content; |
| 32 |
|
|
close $fh; |
| 33 |
|
|
} |
| 34 |
|
|
} else { |
| 35 |
|
|
$file = "help/$subdir/" . lc $item->title; |
| 36 |
|
|
$file =~ s/ /_/g; |
| 37 |
|
|
open my $fh, ">", $file; |
| 38 |
|
|
print $fh "Help for \002", $item->title->present ($self), "\002\n", |
| 39 |
pippijn |
1.5 |
$item->content->present ($self); |
| 40 |
pippijn |
1.1 |
close $fh |
| 41 |
|
|
} |
| 42 |
|
|
} |
| 43 |
|
|
|
| 44 |
|
|
sub view_head2 { |
| 45 |
|
|
my ($self, $item) = @_; |
| 46 |
|
|
"\n", $item->title->present ($self), ":", |
| 47 |
|
|
$item->content->present ($self); |
| 48 |
|
|
} |
| 49 |
|
|
|
| 50 |
|
|
sub view_seq_index { "<$_[1]>" } |
| 51 |
|
|
sub view_seq_bold { "\002$_[1]\002" } |
| 52 |
|
|
sub view_seq_space { "[$_[1]]" } |
| 53 |
|
|
sub view_verbatim { "\n$_[1]" } |
| 54 |
|
|
sub view_textblock { "\n$_[1]\n" } |
| 55 |
|
|
|
| 56 |
|
|
sub view_for { |
| 57 |
|
|
my ($self, $item) = @_; |
| 58 |
|
|
my $format = $item->format; |
| 59 |
|
|
my $text = $item->text; |
| 60 |
|
|
$text =~ s/X<([^>]+)>/<$1>/g; |
| 61 |
|
|
$text =~ s/S<([^>]+)>/[$1]/g; |
| 62 |
|
|
|
| 63 |
|
|
"\n$format $text\n" |
| 64 |
|
|
} |
| 65 |
|
|
|
| 66 |
pippijn |
1.3 |
=head1 AUTHOR |
| 67 |
|
|
|
| 68 |
|
|
Copyright © 2007 Pippijn van Steenhoven |
| 69 |
|
|
|
| 70 |
|
|
=head1 LICENSE |
| 71 |
|
|
|
| 72 |
|
|
This library is free software, you can redistribute it and/or modify |
| 73 |
pippijn |
1.6 |
it under the terms of the GNU General Public License version 3 or later. |
| 74 |
pippijn |
1.3 |
|
| 75 |
|
|
=cut |
| 76 |
|
|
|
| 77 |
|
|
1 |