Skip to content

Commit

Permalink
Fix reference chapter location. Problem reported by @ToonHub
Browse files Browse the repository at this point in the history
  • Loading branch information
ThierryO committed Dec 13, 2023
1 parent d13ce58 commit 62d8f20
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions R/pdf_report.R
Expand Up @@ -191,11 +191,11 @@ pdf_report <- function(

# move appendix after bibliography
appendix <- grep("\\\\appendix", text)
startbib <- grep("\\\\hypertarget\\{refs\\}\\{\\}", text) # nolint: absolute_path_linter, line_length_linter.
startbib <- grep("\\\\phantomsection\\\\label\\{refs\\}", text) # nolint: absolute_path_linter, line_length_linter.

Check warning on line 194 in R/pdf_report.R

View check run for this annotation

Codecov / codecov/patch

R/pdf_report.R#L194

Added line #L194 was not covered by tests
if (length(startbib)) {
if (length(appendix)) {
text <- c(
text[1:(appendix - 1)], # mainmatter
head(text, appendix - 1), # mainmatter

Check warning on line 198 in R/pdf_report.R

View check run for this annotation

Codecov / codecov/patch

R/pdf_report.R#L198

Added line #L198 was not covered by tests
"\\chapter*{\\bibname}",
"\\addcontentsline{toc}{chapter}{\\bibname}",
text[startbib], # bibliography
Expand All @@ -204,18 +204,18 @@ pdf_report <- function(
"",
text[(startbib + 2):(length(text) - 1)],
text[(appendix):(startbib - 1)], # appendix
text[length(text)] # backmatter
tail(text, 1) # backmatter

Check warning on line 207 in R/pdf_report.R

View check run for this annotation

Codecov / codecov/patch

R/pdf_report.R#L207

Added line #L207 was not covered by tests
)
} else {
text <- c(
text[1:(startbib - 1)], # mainmatter
head(text, startbib - 1), # mainmatter

Check warning on line 211 in R/pdf_report.R

View check run for this annotation

Codecov / codecov/patch

R/pdf_report.R#L211

Added line #L211 was not covered by tests
"\\chapter*{\\bibname}",
"\\addcontentsline{toc}{chapter}{\\bibname}",
text[startbib], # bibliography
"",
text[startbib + 1],
"",
text[(startbib + 2):length(text)]
tail(text, -startbib - 1)

Check warning on line 218 in R/pdf_report.R

View check run for this annotation

Codecov / codecov/patch

R/pdf_report.R#L218

Added line #L218 was not covered by tests
)
}
}
Expand Down

0 comments on commit 62d8f20

Please sign in to comment.