diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Pod/Perldoc')
-rw-r--r-- | Master/tlpkg/tlperl/lib/Pod/Perldoc/BaseTo.pm | 3 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/Pod/Perldoc/GetOptsOO.pm | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/Pod/Perldoc/ToANSI.pm | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/Pod/Perldoc/ToChecker.pm | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/Pod/Perldoc/ToMan.pm | 37 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/Pod/Perldoc/ToNroff.pm | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/Pod/Perldoc/ToPod.pm | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/Pod/Perldoc/ToRtf.pm | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTerm.pm | 49 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/Pod/Perldoc/ToText.pm | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTk.pm | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/Pod/Perldoc/ToXml.pm | 2 |
12 files changed, 65 insertions, 42 deletions
diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/BaseTo.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/BaseTo.pm index 5bf8a936a78..b216d426114 100644 --- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/BaseTo.pm +++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/BaseTo.pm @@ -3,7 +3,7 @@ use strict; use warnings; use vars qw($VERSION); -$VERSION = '3.19'; +$VERSION = '3.23'; use Carp qw(croak carp); use Config qw(%Config); @@ -33,6 +33,7 @@ BEGIN { *is_linux = $^O eq 'linux' ? \&TRUE : \&FALSE unless defined &is_linux; *is_hpux = $^O =~ m/hpux/ ? \&TRUE : \&FALSE unless defined &is_hpux; *is_openbsd = $^O =~ m/openbsd/ ? \&TRUE : \&FALSE unless defined &is_openbsd; + *is_bitrig = $^O =~ m/bitrig/ ? \&TRUE : \&FALSE unless defined &is_bitrig; } sub _perldoc_elem { diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/GetOptsOO.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/GetOptsOO.pm index 0355f8f3ca2..3f4e218a946 100644 --- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/GetOptsOO.pm +++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/GetOptsOO.pm @@ -2,7 +2,7 @@ package Pod::Perldoc::GetOptsOO; use strict; use vars qw($VERSION); -$VERSION = '3.19'; +$VERSION = '3.23'; BEGIN { # Make a DEBUG constant ASAP *DEBUG = defined( &Pod::Perldoc::DEBUG ) diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToANSI.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToANSI.pm index c6534bd4cf6..f0ecbced987 100644 --- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToANSI.pm +++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToANSI.pm @@ -4,7 +4,7 @@ use warnings; use parent qw(Pod::Perldoc::BaseTo); use vars qw($VERSION); -$VERSION = '3.19'; +$VERSION = '3.23'; sub is_pageable { 1 } sub write_with_binmode { 0 } diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToChecker.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToChecker.pm index 6f8d12c1120..8bff3381201 100644 --- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToChecker.pm +++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToChecker.pm @@ -4,7 +4,7 @@ use warnings; use vars qw(@ISA); use vars qw($VERSION); -$VERSION = '3.19'; +$VERSION = '3.23'; # Pick our superclass... # diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToMan.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToMan.pm index 225a78618d5..1080dbd93e0 100644 --- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToMan.pm +++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToMan.pm @@ -5,7 +5,7 @@ use warnings; use parent qw(Pod::Perldoc::BaseTo); use vars qw($VERSION); -$VERSION = '3.19'; +$VERSION = '3.23'; use File::Spec::Functions qw(catfile); use Pod::Man 2.18; @@ -63,7 +63,7 @@ sub init { sub _roffer_candidates { my( $self ) = @_; - if( $self->is_openbsd ) { qw( mandoc groff nroff ) } + if( $self->is_openbsd || $self->is_bitrig ) { qw( mandoc groff nroff ) } else { qw( groff nroff mandoc ) } } @@ -136,7 +136,7 @@ sub _get_columns { sub _get_podman_switches { my( $self ) = @_; - my @switches = grep !m/^_/s, keys %$self; + my @switches = map { $_, $self->{$_} } grep !m/^_/s, keys %$self; # There needs to be a cleaner way to handle setting # the UTF-8 flag, but for now, comment out this @@ -212,37 +212,16 @@ sub _have_groff_with_utf8 { sub _have_mandoc_with_utf8 { my( $self ) = @_; - return 0 unless $self->_is_mandoc; - my $roffer = $self->__nroffer; - - my $minimum_mandoc_version = '1.11'; - - my $version_string = `$roffer -V`; - my( $version ) = $version_string =~ /mandoc ((\d+)\.(\d+))/; - $self->debug( "Found mandoc $version\n" ); - - # is a string comparison good enough? - if( $version lt $minimum_mandoc_version ) { - $self->warn( - "You have an older mandoc." . - " Update to version $minimum_mandoc_version for better Unicode support.\n" . - "If you don't upgrade, wide characters may come out oddly.\n" . - "Your results still might be odd. If you have groff, that's even better.\n" - ); - } - - $version ge $minimum_mandoc_version; + $self->_is_mandoc and not system 'mandoc -Tlocale -V > /dev/null 2>&1'; } sub _collect_nroff_switches { my( $self ) = shift; - my @render_switches = $self->_is_mandoc ? qw(-mandoc) : qw(-man); - - push @render_switches, $self->_get_device_switches; + my @render_switches = ('-man', $self->_get_device_switches); # Thanks to Brendan O'Dea for contributing the following block - if( $self->_is_roff and $self->is_linux and -t STDOUT and my ($cols) = $self->_get_columns ) { + if( $self->_is_roff and -t STDOUT and my ($cols) = $self->_get_columns ) { my $c = $cols * 39 / 40; $cols = $c > $cols - 2 ? $c : $cols -2; push @render_switches, '-rLL=' . (int $c) . 'n' if $cols > 80; @@ -263,7 +242,7 @@ sub _get_device_switches { if( $self->_is_nroff ) { qw() } elsif( $self->_have_groff_with_utf8 ) { qw(-Kutf8 -Tutf8) } elsif( $self->_is_ebcdic ) { qw(-Tcp1047) } - elsif( $self->_have_mandoc_with_utf8 ) { qw(-Tutf8) } + elsif( $self->_have_mandoc_with_utf8 ) { qw(-Tlocale) } elsif( $self->_is_mandoc ) { qw() } else { qw(-Tlatin1) } } @@ -314,7 +293,7 @@ sub _filter_through_nroff { # Eliminate whitespace $switches =~ s/\s//g; - # Then seperate the switches with a zero-width positive + # Then separate the switches with a zero-width positive # lookahead on the dash. # # See: diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToNroff.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToNroff.pm index 4f720e7f0e6..9777581db23 100644 --- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToNroff.pm +++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToNroff.pm @@ -4,7 +4,7 @@ use warnings; use parent qw(Pod::Perldoc::BaseTo); use vars qw($VERSION); -$VERSION = '3.19'; +$VERSION = '3.23'; # This is unlike ToMan.pm in that it emits the raw nroff source! diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToPod.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToPod.pm index 7083ae67b36..97185bbb42d 100644 --- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToPod.pm +++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToPod.pm @@ -4,7 +4,7 @@ use warnings; use parent qw(Pod::Perldoc::BaseTo); use vars qw($VERSION); -$VERSION = '3.19'; +$VERSION = '3.23'; sub is_pageable { 1 } sub write_with_binmode { 0 } diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToRtf.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToRtf.pm index 6e190f73a27..588405715bb 100644 --- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToRtf.pm +++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToRtf.pm @@ -4,7 +4,7 @@ use warnings; use parent qw( Pod::Simple::RTF ); use vars qw($VERSION); -$VERSION = '3.19'; +$VERSION = '3.23'; sub is_pageable { 0 } sub write_with_binmode { 0 } diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTerm.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTerm.pm index f8d9349d10a..693b52a9059 100644 --- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTerm.pm +++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTerm.pm @@ -3,7 +3,7 @@ use strict; use warnings; use vars qw($VERSION); -$VERSION = '3.19'; +$VERSION = '3.23'; use parent qw(Pod::Perldoc::BaseTo); @@ -18,13 +18,56 @@ sub indent { shift->_perldoc_elem('indent' , @_) } sub loose { shift->_perldoc_elem('loose' , @_) } sub quotes { shift->_perldoc_elem('quotes' , @_) } sub sentence { shift->_perldoc_elem('sentence', @_) } -sub width { shift->_perldoc_elem('width' , @_) } +sub width { + my $self = shift; + $self->_perldoc_elem('width' , @_) || + $self->_get_columns_from_manwidth || + $self->_get_columns_from_stty || + $self->_get_default_width; +} + +sub _get_stty { `stty -a` } + +sub _get_columns_from_stty { + my $output = $_[0]->_get_stty; + + if( $output =~ /\bcolumns\s+(\d+)/ ) { return $1; } + elsif( $output =~ /;\s*(\d+)\s+columns;/ ) { return $1; } + else { return 0 } + } + +sub _get_columns_from_manwidth { + my( $self ) = @_; + + return 0 unless defined $ENV{MANWIDTH}; + + unless( $ENV{MANWIDTH} =~ m/\A\d+\z/ ) { + $self->warn( "Ignoring non-numeric MANWIDTH ($ENV{MANWIDTH})\n" ); + return 0; + } + + if( $ENV{MANWIDTH} == 0 ) { + $self->warn( "Ignoring MANWIDTH of 0. Really? Why even run the program? :)\n" ); + return 0; + } + + if( $ENV{MANWIDTH} =~ m/\A(\d+)\z/ ) { return $1 } + + return 0; + } + +sub _get_default_width { + 76 + } + sub new { return bless {}, ref($_[0]) || $_[0] } sub parse_from_file { my $self = shift; + $self->{width} = $self->width(); + my @options = map {; $_, $self->{$_} } grep !m/^_/s, @@ -34,7 +77,7 @@ sub parse_from_file { defined(&Pod::Perldoc::DEBUG) and Pod::Perldoc::DEBUG() and print "About to call new Pod::Text::Termcap ", - $Pod::Text::VERSION ? "(v$Pod::Text::VERSION) " : '', + $Pod::Text::VERSION ? "(v$Pod::Text::Termcap::VERSION) " : '', "with options: ", @options ? "[@options]" : "(nil)", "\n"; ; diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToText.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToText.pm index 530bdee7ad0..07f44cd5630 100644 --- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToText.pm +++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToText.pm @@ -3,7 +3,7 @@ use strict; use warnings; use vars qw($VERSION); -$VERSION = '3.19'; +$VERSION = '3.23'; use parent qw(Pod::Perldoc::BaseTo); diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTk.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTk.pm index deed6b3ff15..627289e88a1 100644 --- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTk.pm +++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToTk.pm @@ -3,7 +3,7 @@ use strict; use warnings; use vars qw($VERSION); -$VERSION = '3.19'; +$VERSION = '3.23'; use parent qw(Pod::Perldoc::BaseTo); diff --git a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToXml.pm b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToXml.pm index f85f01eb7bd..5c86b3ebda1 100644 --- a/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToXml.pm +++ b/Master/tlpkg/tlperl/lib/Pod/Perldoc/ToXml.pm @@ -6,7 +6,7 @@ use vars qw($VERSION); use parent qw( Pod::Simple::XMLOutStream ); use vars qw($VERSION); -$VERSION = '3.19'; +$VERSION = '3.23'; sub is_pageable { 0 } sub write_with_binmode { 0 } |