ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/doc/lib/PodHelp.pm
Revision: 1.1
Committed: Sat Jul 21 01:25:40 2007 UTC (19 years, 3 months ago) by pippijn
Branch: MAIN
Log Message:
reworked documentation system

File Contents

# User Rev Content
1 pippijn 1.1 package PodHelp;
2    
3     use strict;
4     use warnings;
5     use utf8;
6    
7     use base "Pod::POM::View";
8    
9     our $subdir;
10    
11     sub view_pod {
12     my ($self, $item) = @_;
13     mkdir "help";
14     mkdir "help/$subdir";
15     $item->content->present ($self)
16     }
17    
18     sub view_head1 {
19     my ($self, $item) = @_;
20     my $file;
21     if ($item->title =~ /\|/) {
22     my @cmds = split /\|/, $item->title;
23     for my $cmd (@cmds) {
24     my $content = "Help for \002$cmd\002:\n" . $item->content->present ($self);
25     $content =~ s/\$CMD/$cmd/g;
26     $file = "help/$subdir/" . lc $cmd;
27     $file =~ s/ /_/g;
28     open my $fh, ">", $file;
29     print $fh $content;
30     close $fh;
31     }
32     } else {
33     $file = "help/$subdir/" . lc $item->title;
34     $file =~ s/ /_/g;
35     open my $fh, ">", $file;
36     print $fh "Help for \002", $item->title->present ($self), "\002\n",
37     $item->content->present ($self);
38     close $fh
39     }
40     }
41    
42     sub view_head2 {
43     my ($self, $item) = @_;
44     "\n", $item->title->present ($self), ":",
45     $item->content->present ($self);
46     }
47    
48     sub view_seq_index { "<$_[1]>" }
49     sub view_seq_bold { "\002$_[1]\002" }
50     sub view_seq_space { "[$_[1]]" }
51     sub view_verbatim { "\n$_[1]" }
52     sub view_textblock { "\n$_[1]\n" }
53    
54     sub view_for {
55     my ($self, $item) = @_;
56     my $format = $item->format;
57     my $text = $item->text;
58     $text =~ s/X<([^>]+)>/<$1>/g;
59     $text =~ s/S<([^>]+)>/[$1]/g;
60    
61     "\n$format $text\n"
62     }
63    
64     1;