Skip to content

Commit 62bf6bd

Browse files
authored
Fix pagination LBT01 issue count (#292)
Fixes #291
1 parent e6779f6 commit 62bf6bd

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

R/pagination.R

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ paginate_to_mpfs <- function(obj,
10921092
return(mpfs)
10931093
}
10941094

1095-
if (!is.null(page_num) && (length(prov_footer(obj)) == 0 || !any(grepl(page_num, prov_footer(obj), fixed = TRUE)))) {
1095+
if (!is.null(page_num)) {
10961096
# Only adding a line for pagination -> lpp - 1 would have worked too
10971097
prov_footer(obj) <- c(prov_footer(obj), page_num)
10981098
}
@@ -1149,7 +1149,7 @@ paginate_to_mpfs <- function(obj,
11491149
col_gap = col_gap
11501150
)
11511151
}
1152-
## this MUST alsways return a list, inluding list(obj) when
1152+
## this MUST always return a list, including list(obj) when
11531153
## no forced pagination is needed! otherwise stuff breaks for things
11541154
## based on s3 classes that are lists underneath!!!
11551155
fpags <- do_forced_paginate(obj)
@@ -1161,16 +1161,21 @@ paginate_to_mpfs <- function(obj,
11611161
## but we will if we ever allow force_paginate to do horiz
11621162
## pagination.
11631163
if (length(fpags) > 1) {
1164-
deep_pag <- lapply(
1165-
fpags, paginate_to_mpfs,
1164+
# Correction for case we are entering here (page_by?)
1165+
if (!is.null(page_num)) {
1166+
prov_footer(obj) <- head(prov_footer(obj), -1)
1167+
fpags <- do_forced_paginate(obj)
1168+
}
1169+
deep_pag <- paginate_to_mpfs( # what about the other parameters?
1170+
fpags,
11661171
pg_size_spec = pg_size_spec,
11671172
colwidths = colwidths,
11681173
min_siblings = min_siblings,
11691174
nosplitin = nosplitin,
11701175
verbose = verbose,
11711176
page_num = page_num
11721177
)
1173-
return(unlist(deep_pag, recursive = FALSE))
1178+
return(deep_pag)
11741179
} else if (has_page_title(fpags[[1]])) {
11751180
obj <- fpags[[1]]
11761181
}

0 commit comments

Comments
 (0)