Skip to content

Commit

Permalink
fix: broken internal links in PDF file
Browse files Browse the repository at this point in the history
fix #632
  • Loading branch information
davidgohel committed Aug 4, 2024
1 parent c085b4e commit 93f0f39
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: flextable
Title: Functions for Tabular Reporting
Version: 0.9.7.004
Version: 0.9.7.005
Authors@R: c(
person("David", "Gohel", , "[email protected]", role = c("aut", "cre")),
person("ArData", role = "cph"),
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
- fix caption issue that came with no version of bookdown (issue #645),
'bookdown' management of caption has been simplified.
- fix vertical overlapping lines with grid output (issue #644)
- fix broken internal links in PDF file, probably due to a change in knitr or
rmarkdown (issue #632)

# flextable 0.9.6

Expand Down
3 changes: 2 additions & 1 deletion R/runs_as_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ runs_as_latex <- function(x, chunk_data = information_data_chunk(x), ls_df = NUL

dat[runs_types_lst$is_text == TRUE, c("txt") := list(sanitize_latex_str(.SD$txt))]
dat[runs_types_lst$is_equation == TRUE, c("txt") := list(paste0("$", .SD$eq_data, "$"))]
dat[runs_types_lst$is_hlink, c("txt") := list(paste0("\\href{", sanitize_latex_str(.SD$url), "}{", .SD$txt, "}"))]
dat[runs_types_lst$is_hlink & grepl("^#", dat$url), c("txt") := list(paste0("\\hyperref[", gsub("^#", "", .SD$url), "]{", .SD$txt, "}"))]
dat[runs_types_lst$is_hlink & !grepl("^#", dat$url), c("txt") := list(paste0("\\href{", sanitize_latex_str(.SD$url), "}{", .SD$txt, "}"))]
dat[runs_types_lst$is_raster == TRUE, c("txt", "left", "right") := list(img_to_latex(.SD$img_data, .SD$width, .SD$height), "", "")]
dat[runs_types_lst$is_word_field == TRUE, c("left", "right", "txt") := list("", "", "")]
dat[runs_types_lst$is_soft_return == TRUE, c("txt") := list("\\linebreak ")]
Expand Down

0 comments on commit 93f0f39

Please sign in to comment.