package LaTeX::Doc; use strict; use warnings; use utf8; my $rcsid = '$Id: LaTeX.pm,v 1.6 2007/09/16 18:54:42 pippijn Exp $'; use Text::Wrap; use base "Pod::POM::View"; sub view_pod { my ($self, $item) = @_; $item->content->present ($self) } sub view_head1 { my ($self, $item) = @_; my $content; if ($item->title =~ /\|/) { my @cmds = split /\|/, $item->title; for my $cmd (@cmds) { my @content = ("\\chapter[$cmd]{$cmd}\n", '\label{', $item->title->present ($self), "}\n", '\index{', $item->title->present ($self), "}\n\n", $item->content->present ($self), "\n\n"); $content .= join "", @content; $content =~ s/\$CMD/$cmd/g; } } else { my $cmd = $item->title->present ($self); my @content = ("\\chapter[$cmd]{$cmd}\n", '\label{', $item->title->present ($self), "}\n", '\index{', $item->title->present ($self), "}\n\n", $item->content->present ($self), "\n\n"); $content = join "", @content } main::latexise (\$content); main::delatexise (\$content) } sub view_head2 { my ($self, $item) = @_; '\section*{', $item->title->present ($self), "}\n", $item->content->present ($self) } sub view_head3 { my ($self, $item) = @_; '\subsection*{', $item->title->present ($self), "}\n", $item->content->present ($self) } sub view_head4 { my ($self, $item) = @_; '\subsubsection*{', $item->title->present ($self), "}\n", $item->content->present ($self) } sub view_for { my ($self, $item) = @_; my $text = $item->text; $text =~ s/X<([^>]+)>/<$1>/g; $text =~ s/S<([^>]+)>/[$1]/g; for ($item->format) { /^date/ and return ("\\begin{description}\n\n\\item[{\\textsf{$text}}]\n\n", "\n\n\\end{description}\n\n"); return ("\\begin{description}\n\n\\item[{\\textsf{", $item->format, "}}]\n\n", "$text\n\n\\end{description}\n\n"); } } sub view_textblock { my ($self, $item) = @_; "$item\n\n" } sub view_verbatim { my ($self, $item) = @_; $Text::Wrap::columns = 74; $item = wrap ('', '', $item); $item =~ s/\n([^ ])/\n $1/g; "\\begin{verbatim}\n$item\n\\end{verbatim}\n\n" }; sub view_over { my ($self, $item) = @_; "\\begin{description}\n", $item->content->present ($self), "\\end{description}\n" } sub view_seq_entity { for ($_[1]) { /xa9/ and return '\copyright '; } } sub view_seq_code { "\\textit{$_[1]}" } sub view_seq_link { my ($self, $item) = @_; my ($title, $link) = split '\|', $item, 2; #"\\href{$link}{$title}" "\\underline{$title}" } sub view_item { my ($self, $item) = @_; my $title; if ($item->title =~ /^Ltitle =~ /L<(.+)>/; $title = $self->view_seq_link ($title); } else { $title = $item->title; } $title eq "*" ? ("\\item[\\hspace{1.4em}-]\n\n", $item->content->present ($self), "\n\n") : ("\\item[{\\textsf{$title}}] \\mbox{}\n\n", $item->content->present ($self), "\n\n") } 1; package LaTeX::Help; use strict; use warnings; use utf8; use base "Pod::POM::View"; sub view_pod { my ($self, $item) = @_; $item->content->present ($self) } sub view_head1 { my ($self, $item) = @_; my $content; if ($item->title =~ /\|/) { my @cmds = split /\|/, $item->title; for my $cmd (@cmds) { my @content = ("\\section{$cmd}\n", '\label{', $item->title->present ($self), "}\n", '\index{', $item->title->present ($self), "}\n\n", $item->content->present ($self), "\n\n"); $content .= join "", @content; $content =~ s/\$CMD/$cmd/g; } } else { my $cmd = $item->title->present ($self); my @content = ("\\section{$cmd}\n", '\label{', $item->title->present ($self), "}\n", '\index{', $item->title->present ($self), "}\n\n", $item->content->present ($self), "\n\n"); $content = join "", @content } main::latexise (\$content); main::delatexise (\$content) } sub view_head2 { my ($self, $item) = @_; '\subsection*{', $item->title->present ($self), "}\n", $item->content->present ($self) } sub view_for { my ($self, $item) = @_; my $text = $item->text; $text =~ s/X<([^>]+)>/<$1>/g; $text =~ s/S<([^>]+)>/[$1]/g; "\\begin{description}\n\n\\item[{\\textsf{", $item->format, "}}]\n\n", "$text\n\n\\end{description}\n\n" } sub view_textblock { "$_[1]\n\n" } sub view_seq_index { "<$_[1]>" } sub view_seq_bold { "\\textbf{$_[1]}" } sub view_seq_space { "[$_[1]]" } sub view_verbatim { "\\begin{verbatim}\n$_[1]\n\\end{verbatim}" } sub view_seq_code { "\\textit{$_[1]}" } sub view_seq_link { "\\underline{$_[1]}" } =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 version 3 or later. =cut 1