mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 06:18:47 +02:00
Properly detect and handle requests for multi-page --svg or --eps output.
All checks were successful
Remind unit tests / tests (push) Successful in 42s
All checks were successful
Remind unit tests / tests (push) Successful in 42s
This commit is contained in:
@@ -257,6 +257,7 @@ if ($settings->{ps} && $settings->{landscape}) {
|
||||
}
|
||||
|
||||
my $warned = 0;
|
||||
my $index = 0;
|
||||
while(1) {
|
||||
if ($settings->{ps}) {
|
||||
$surface->dsc_begin_page_setup();
|
||||
@@ -277,14 +278,8 @@ while(1) {
|
||||
}
|
||||
last;
|
||||
}
|
||||
if (($settings->{eps} || $settings->{svg}) && $done_one) {
|
||||
if (!$warned) {
|
||||
print STDERR "WARNING: --eps and --svg can only output one page; ignoring subsequent\nmonths in a multi-month calendar.\n";
|
||||
$warned = 1;
|
||||
}
|
||||
next;
|
||||
}
|
||||
$obj->render($cr, $settings);
|
||||
$index++;
|
||||
$obj->render($cr, $settings, $index, -1);
|
||||
$done_one = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -468,6 +468,14 @@ sub render
|
||||
{
|
||||
my ($self, $cr, $settings, $index, $total) = @_;
|
||||
|
||||
if ($settings->{svg} || $settings->{eps}) {
|
||||
if ($index > 1) {
|
||||
if ($index == 2) {
|
||||
print STDERR "WARNING: --svg/--eps can only output one page; ignoring subsequent\nmonths in a multi-month calendar.\n";
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
$self->setup_daymap($settings);
|
||||
$self->{horiz_lines} = [];
|
||||
$cr->set_line_cap('square');
|
||||
@@ -1011,20 +1019,10 @@ as were read from the C<remind -ppp> stream
|
||||
sub render
|
||||
{
|
||||
my ($self, $cr, $settings) = @_;
|
||||
my $done = 0;
|
||||
my $warned = 0;
|
||||
my $index = 0;
|
||||
my $total = scalar(@{$self->{entries}});
|
||||
|
||||
foreach my $e (@{$self->{entries}}) {
|
||||
if ($settings->{svg} && $done) {
|
||||
if (!$warned) {
|
||||
print STDERR "WARNING: --svg can only output one page; ignoring subsequent\nmonths in a multi-month calendar.\n";
|
||||
$warned = 1;
|
||||
}
|
||||
next;
|
||||
}
|
||||
$done = 1;
|
||||
$index++;
|
||||
$e->render($cr, $settings, $index, $total);
|
||||
}
|
||||
@@ -1042,6 +1040,15 @@ Remind::PDF::Weekly - render a weekly calendar
|
||||
sub render
|
||||
{
|
||||
my ($self, $cr, $settings, $index, $total) = @_;
|
||||
if ($settings->{svg} || $settings->{eps}) {
|
||||
if ($index > $settings->{weeks_per_page}) {
|
||||
if ($index == $settings->{weeks_per_page}+1) {
|
||||
print STDERR "WARNING: --svg/--eps can only output one page; ignoring subsequent pages.\n";
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$settings->{numbers_on_left} = 1;
|
||||
# Set up bounding box
|
||||
if ($settings->{weeks_per_page} == 1) {
|
||||
|
||||
Reference in New Issue
Block a user