X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FPod%2FLaTeX.pm;h=c909d21f35d9c76edeba17fb32d7769276a754f7;hb=22d4bb9ccb8701e68f9243547d7e3a3c55f70908;hp=8adb58921c77801459a1762d8ea11951778b7cbb;hpb=4b19af017623bfa3bb72bb164598a517f586e0d3;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Pod/LaTeX.pm b/lib/Pod/LaTeX.pm index 8adb589..c909d21 100644 --- a/lib/Pod/LaTeX.pm +++ b/lib/Pod/LaTeX.pm @@ -36,7 +36,7 @@ use Carp; use vars qw/ $VERSION %HTML_Escapes @LatexSections /; -$VERSION = '0.52'; +$VERSION = '0.53'; # Definitions of =headN -> latex mapping @LatexSections = (qw/ @@ -57,6 +57,8 @@ $VERSION = '0.52'; 'lt' => '$<$', # ' left chevron, less-than 'gt' => '$>$', # ' right chevron, greater-than 'quot' => '"', # double quote + 'sol' => '/', + 'verbar' => '$|$', "Aacute" => "\\'{A}", # capital A, acute accent "aacute" => "\\'{a}", # small a, acute accent @@ -675,7 +677,7 @@ pushed onto this stack. When the list context ends, it is popped from the stack. The array will be empty if no lists are active. -Returns array of list information in array context +Returns array of list information in list context Returns array ref in scalar context =cut @@ -952,6 +954,9 @@ sub verbatim { # Clean trailing space $paragraph =~ s/\s+$//; + # Clean tabs + $paragraph =~ s/\t/ /g; + $self->_output('\begin{verbatim}' . "\n$paragraph\n". '\end{verbatim}'."\n"); } } @@ -1248,7 +1253,7 @@ sub add_item { $paragraph =~ s/^\s+//; my $type; - if ($paragraph eq '*') { + if (substr($paragraph, 0,1) eq '*') { $type = 'itemize'; } elsif ($paragraph =~ /^\d/) { $type = 'enumerate'; @@ -1264,10 +1269,21 @@ sub add_item { my $type = $self->lists->[-1]->type; if ($type eq 'description') { + # Handle long items - long items do not wrap + if (length($paragraph) < 40) { + # A real description list item + $self->_output("\\item[$paragraph] \\mbox{}"); + } else { + # The item is now simply bold text + $self->_output(qq{\\item \\textbf{$paragraph}}); + } - $self->_output("\\item[$paragraph] \\mbox{}"); } else { - $self->_output('\item '); + # If the item was '* Something' we still need to write + # out the something + my $extra_info = $paragraph; + $extra_info =~ s/^\*\s*//; + $self->_output("\\item $extra_info"); } # Store the item name in the object. Required so that @@ -1392,6 +1408,8 @@ Special characters and the C equivalents are: & \& \ $\backslash$ ^ \^{} + ~ \~{} + | $|$ =cut @@ -1412,6 +1430,12 @@ sub _replace_special_chars { # Replace ^ characters with \^{} so that $^F works okay $paragraph =~ s/(\^)/\\$1\{\}/g; + # Replace tilde (~) with \texttt{\~{}} + $paragraph =~ s/~/\\texttt\{\\~\{\}\}/g; + + # Replace | with $|$ + $paragraph =~ s'\|'$|$'g; + # Now add the dollars around each \backslash $paragraph =~ s/(\\backslash)/\$$1\$/g; @@ -1560,7 +1584,7 @@ under the same terms as Perl itself. =head1 REVISION -$Id: LaTeX.pm,v 1.4 2000/05/16 01:26:55 timj Exp $ +$Id: LaTeX.pm,v 1.6 2000/08/21 09:05:03 timj Exp $ =end __PRIVATE__