package PodHTML; use strict; use warnings; use utf8; my $rcsid = '$Id: PodHTML.pm,v 1.5 2007/08/28 17:08:06 pippijn Exp $'; use base "Pod::POM::View"; our $subdir; our $dir; our $menu; sub view_pod { my ($self, $item) = @_; $item->content->present ($self) } sub view_head1 { my ($self, $item) = @_; my $file; if ($item->title =~ /\|/) { my @cmds = split /\|/, $item->title; for my $cmd (@cmds) { my $content = "$cmd\n\n" . $item->content->present ($self); $content =~ s/\$CMD/$cmd/g; $file = "$dir/$subdir/" . lc $cmd . ".tt"; $file =~ s/ /_/g; open my $fh, ">", $file; print $fh $content; close $fh; } } else { if ($subdir) { $file = "$dir/$subdir/" . lc $item->title . ".tt"; } else { $file = "$dir/" . lc $item->title . ".tt"; } $file =~ s/ /_/g; open my $fh, ">", $file; my $content = $item->title->present ($self) . "\n\n" . $item->content->present ($self); print $fh $content; close $fh; } my $name = $file; $name =~ s/$dir\/\w+\/(.+)\.tt/$1/; $name =~ s/_/ /g; my $svs; if ($subdir) { $svs = $subdir; } else { $svs = $dir; } $svs =~ s/serv/Serv/; $svs = ucfirst $svs; $file =~ s/$dir/../; $file =~ s/\.tt$//; $menu->{$svs}->[($#{$menu->{$svs}}) + 1] = { href => "$file.html", title => uc $name, }; } sub view_head2 { my ($self, $item) = @_; '
\n$item" } sub view_over { my ($self, $item) = @_; "
$_[1]
" } sub view_seq_index { "<$_[1]>" } sub view_seq_space { "[$_[1]]" } sub view_for { my ($self, $item) = @_; my $format = $item->format; my $text = $item->text; $text =~ s/X<([^>]+)>/<$1>/g; $text =~ s/S<([^>]+)>/[$1]/g; "$format $text" } sub xmlise { my ($self, $text) = @_; $$text =~ s/>/>/; $$text =~ s/</; $$text } =head1 AUTHOR Copyright © 2007 Pippijn van Steenhoven =head1 LICENSE This library is free software, you can redistribute it and/or modify it under the terms of the GNU General Public License. =cut 1