From 1b8821713d86cca9e56542fc9bf3f0db1ecc6888 Mon Sep 17 00:00:00 2001 From: "K. Andrew Parker" Date: Tue, 22 Sep 2020 15:34:57 -0400 Subject: [PATCH 1/8] bare 'null' and %bullet warnings from PGML --- macros/PGML.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/PGML.pl b/macros/PGML.pl index 8e5da3e404..9a1da7a841 100644 --- a/macros/PGML.pl +++ b/macros/PGML.pl @@ -274,7 +274,7 @@ sub ForceBreak { sub Par { my $self = shift; my $token = shift; - $self->End(null, shift); + $self->End("null", shift); $self->Item("par",$token,{noIndent => 1}); $self->{atLineStart} = $self->{ignoreNL} = 1; $self->{indent} = $self->{actualIndent} = 0; @@ -1092,7 +1092,7 @@ sub Align { "\n"; } -my %bullet = ( +our %bullet = ( bullet => 'ul type="disc"', numeric => 'ol type="1"', alpha => 'ol type="a"', @@ -1366,7 +1366,7 @@ sub Align { return "\n" . $self->string($item); } -my %bullet = ( +our %bullet = ( bullet => 'ul', numeric => 'ol label="1."', alpha => 'ol label="a."', From b33f3af8ef9b57302d42e947f5bc1d7a7bbe576e Mon Sep 17 00:00:00 2001 From: "K. Andrew Parker" Date: Tue, 22 Sep 2020 15:35:36 -0400 Subject: [PATCH 2/8] Subroutine TEX redefined Conflicts: macros/PGbasicmacros.pl --- macros/PGbasicmacros.pl | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/macros/PGbasicmacros.pl b/macros/PGbasicmacros.pl index c88e878a5f..199c66ddc8 100644 --- a/macros/PGbasicmacros.pl +++ b/macros/PGbasicmacros.pl @@ -1416,15 +1416,17 @@ =head2 Display Macros =cut -sub TEX { - my ($tex, $html ) = @_; - MODES(TeX => $tex, HTML => $html, HTML_tth => $html, HTML_dpng => $html); -} -sub M3 { - my($tex, $l2h, $html) = @_; - MODES(TeX => $tex, Latex2HTML => $l2h, HTML => $html, HTML_tth => $html, HTML_dpng => $html); -} +#sub TEX { +# my ($tex, $html ) = @_; +# MODES(TeX => $tex, HTML => $html, HTML_tth => $html, HTML_dpng => $html); +#} + + +#sub M3 { +# my($tex,$l2h,$html) = @_; +# MODES(TeX => $tex, Latex2HTML => $l2h, HTML => $html, HTML_tth => $html, HTML_dpng => $html); +#} # MODES() is now table driven our %DISPLAY_MODE_FAILOVER = ( From 0a950279c609f8ecaa7601ecb19f2e1f6d9145f1 Mon Sep 17 00:00:00 2001 From: "K. Andrew Parker" Date: Tue, 22 Sep 2020 15:37:52 -0400 Subject: [PATCH 3/8] all TeX calls should return string --- macros/contextFraction.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/contextFraction.pl b/macros/contextFraction.pl index fd85418503..d2e5b70293 100644 --- a/macros/contextFraction.pl +++ b/macros/contextFraction.pl @@ -905,7 +905,7 @@ sub string { sub TeX { my $self = shift; my $equation = shift; my $prec = shift; my ($a,$b) = @{$self->{data}}; my $n = ""; - return $a if $b == 1; + return "$a" if $b == 1; if ($self->getFlagWithAlias("showMixedNumbers","showProperFractions") && CORE::abs($a) > $b) {$n = int($a/$b); $a = CORE::abs($a) % $b; $n .= " " unless $a == 0} my $s = ""; ($a,$s) = (-$a,"-") if $a < 0; From 3cac8b75065daca10f2f7561ec4d1913b419bde6 Mon Sep 17 00:00:00 2001 From: drdrew42 Date: Fri, 18 Dec 2020 10:06:55 -0500 Subject: [PATCH 4/8] undef replaces 'null bareword' --- macros/PGML.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/PGML.pl b/macros/PGML.pl index 9a1da7a841..14cb0c140b 100644 --- a/macros/PGML.pl +++ b/macros/PGML.pl @@ -274,7 +274,7 @@ sub ForceBreak { sub Par { my $self = shift; my $token = shift; - $self->End("null", shift); + $self->End(undef, shift); $self->Item("par",$token,{noIndent => 1}); $self->{atLineStart} = $self->{ignoreNL} = 1; $self->{indent} = $self->{actualIndent} = 0; From 9adf5c7c01360e606d274e68f9e7fa9149d573b0 Mon Sep 17 00:00:00 2001 From: drdrew42 Date: Fri, 18 Dec 2020 10:13:21 -0500 Subject: [PATCH 5/8] remove duplicate TEX macro + deprecation comment --- macros/PGbasicmacros.pl | 8 -------- 1 file changed, 8 deletions(-) diff --git a/macros/PGbasicmacros.pl b/macros/PGbasicmacros.pl index 199c66ddc8..e77d29548c 100644 --- a/macros/PGbasicmacros.pl +++ b/macros/PGbasicmacros.pl @@ -1410,19 +1410,11 @@ =head2 Display Macros Latex2HTML => "output this in Latex2HTML mode", ) - TEX (tex_version, html_version) #obsolete - M3 (tex_version, latex2html_version, html_version) #obsolete =cut -#sub TEX { -# my ($tex, $html ) = @_; -# MODES(TeX => $tex, HTML => $html, HTML_tth => $html, HTML_dpng => $html); -#} - - #sub M3 { # my($tex,$l2h,$html) = @_; # MODES(TeX => $tex, Latex2HTML => $l2h, HTML => $html, HTML_tth => $html, HTML_dpng => $html); From ce346b3f8352c58193ea153d02442e1151fb2caf Mon Sep 17 00:00:00 2001 From: drdrew42 Date: Fri, 18 Dec 2020 10:29:00 -0500 Subject: [PATCH 6/8] break circular reference in PGresource --- lib/PGresource.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/PGresource.pm b/lib/PGresource.pm index 8f318cd616..2d35fdb943 100644 --- a/lib/PGresource.pm +++ b/lib/PGresource.pm @@ -17,6 +17,7 @@ package PGresource; use strict; use Exporter; +use Scalar::Util; use UUID::Tiny ':std'; use PGcore; our @ISA= qw( PGcore ) ; @@ -60,6 +61,7 @@ sub new { %options, }; bless $self, $class; + Scalar::Util::weaken($self->{parent_alias}); $self->warning_message( "PGresource must be called with an alias object") unless ref($parent_alias) =~ /PGalias/; $self->warning_message( "PGresource must be called with a name" ) unless $id; $self->warning_message( "PGresource must be called with a type") unless $type; @@ -114,4 +116,4 @@ sub fileName { $self->{id} = $fileName if $fileName; $self->{id}; } -1; \ No newline at end of file +1; From acd69d763063cf4ef936fef94a1aff8a94be6eed Mon Sep 17 00:00:00 2001 From: drdrew42 Date: Fri, 18 Dec 2020 10:30:00 -0500 Subject: [PATCH 7/8] roll back overzealous code removal --- macros/PGbasicmacros.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/macros/PGbasicmacros.pl b/macros/PGbasicmacros.pl index e77d29548c..31a1549deb 100644 --- a/macros/PGbasicmacros.pl +++ b/macros/PGbasicmacros.pl @@ -1415,10 +1415,10 @@ =head2 Display Macros =cut -#sub M3 { -# my($tex,$l2h,$html) = @_; -# MODES(TeX => $tex, Latex2HTML => $l2h, HTML => $html, HTML_tth => $html, HTML_dpng => $html); -#} +sub M3 { + my($tex,$l2h,$html) = @_; + MODES(TeX => $tex, Latex2HTML => $l2h, HTML => $html, HTML_tth => $html, HTML_dpng => $html); +} # MODES() is now table driven our %DISPLAY_MODE_FAILOVER = ( From 74ca76291bbf8f481944212e141bb61fbb875cc8 Mon Sep 17 00:00:00 2001 From: drdrew42 Date: Fri, 18 Dec 2020 11:34:46 -0500 Subject: [PATCH 8/8] standardize TeX() and string() outputs --- macros/contextFraction.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/contextFraction.pl b/macros/contextFraction.pl index d2e5b70293..bdb4b59df4 100644 --- a/macros/contextFraction.pl +++ b/macros/contextFraction.pl @@ -894,12 +894,12 @@ sub isReduced { sub string { my $self = shift; my $equation = shift; my $prec = shift; my ($a,$b) = @{$self->{data}}; my $n = ""; - return $a if $b == 1; + return "$a" if $b == 1; if ($self->getFlagWithAlias("showMixedNumbers","showProperFractions") && CORE::abs($a) > $b) {$n = int($a/$b); $a = CORE::abs($a) % $b; $n .= " " unless $a == 0} $n .= "$a/$b" unless $a == 0 && $n ne ''; $n = "($n)" if defined $prec && $prec >= 1; - return $n; + return "$n"; } sub TeX { @@ -912,7 +912,7 @@ sub TeX { $n .= ($self->{isHorizontal} ? "$s$a/$b" : "${s}{\\textstyle\\frac{$a}{$b}}") unless $a == 0 && $n ne ''; $n = "\\left($n\\right)" if defined $prec && $prec >= 1; - return $n; + return "$n"; } sub pdot {