Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PG warnings cleanup and minor contextFraction issue #513

Merged
merged 8 commits into from
Feb 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/PGresource.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package PGresource;
use strict;
use Exporter;
use Scalar::Util;
use UUID::Tiny ':std';
use PGcore;
our @ISA= qw( PGcore ) ;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -114,4 +116,4 @@ sub fileName {
$self->{id} = $fileName if $fileName;
$self->{id};
}
1;
1;
6 changes: 3 additions & 3 deletions macros/PGML.pl
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ sub ForceBreak {

sub Par {
my $self = shift; my $token = shift;
$self->End(null, shift);
$self->End(undef, shift);
drdrew42 marked this conversation as resolved.
Show resolved Hide resolved
$self->Item("par",$token,{noIndent => 1});
$self->{atLineStart} = $self->{ignoreNL} = 1;
$self->{indent} = $self->{actualIndent} = 0;
Expand Down Expand Up @@ -1092,7 +1092,7 @@ sub Align {
"</div>\n";
}

my %bullet = (
our %bullet = (
bullet => 'ul type="disc"',
numeric => 'ol type="1"',
alpha => 'ol type="a"',
Expand Down Expand Up @@ -1366,7 +1366,7 @@ sub Align {
return "<!-- PTX:WARNING: PGML wanted to " . $item->{align} . " align here. -->\n" . $self->string($item);
}

my %bullet = (
our %bullet = (
bullet => 'ul',
numeric => 'ol label="1."',
alpha => 'ol label="a."',
Expand Down
8 changes: 1 addition & 7 deletions macros/PGbasicmacros.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1410,19 +1410,13 @@ =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 {
drdrew42 marked this conversation as resolved.
Show resolved Hide resolved
my ($tex, $html ) = @_;
MODES(TeX => $tex, HTML => $html, HTML_tth => $html, HTML_dpng => $html);
}

sub M3 {
my($tex, $l2h, $html) = @_;
my($tex,$l2h,$html) = @_;
taniwallach marked this conversation as resolved.
Show resolved Hide resolved
MODES(TeX => $tex, Latex2HTML => $l2h, HTML => $html, HTML_tth => $html, HTML_dpng => $html);
}

Expand Down
8 changes: 4 additions & 4 deletions macros/contextFraction.pl
Original file line number Diff line number Diff line change
Expand Up @@ -894,25 +894,25 @@ 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 {
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}
dpvc marked this conversation as resolved.
Show resolved Hide resolved
my $s = ""; ($a,$s) = (-$a,"-") if $a < 0;
$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 {
Expand Down