Skip to content

Commit 2ae4408

Browse files
committed
Fix bold text with **
1 parent 2624501 commit 2ae4408

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

source/R/habitatauteurs_from_docx.R

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ library(jsonlite)
99
# however, they do not allow to keep the labels that the bib items already have.
1010

1111
drive_auth()
12+
2
1213

1314
#download the docx files from google drive
1415
folder <- "https://drive.google.com/drive/folders/10cZDtfWFMglGF4ICvBzv6HXkfsqT3eP1"
@@ -59,13 +60,21 @@ for (hoofdstuk in c("zilt", "kustduin", "water", "heide", "gras", "veen",
5960
paragrafen[!(paragrafen %in% rmd$sec_h1)],
6061
collapse = ", ")))
6162
for (x in paragrafen) {
62-
rmd_select(rmd, by_section(x)) %>%
63+
txt <- rmd_select(rmd, by_section(x)) %>%
6364
rmd_select(has_type("rmd_markdown")) %>% # do not print the headers, only the text
64-
as_document() %>%
65+
as_document()
66+
txt <- txt %>%
6567
str_replace_all(fixed("\\@"), "@") %>%
68+
str_replace_all(fixed("\\*"), "*") %>%
69+
str_replace_all(fixed("\\[!ht\\]"), "[!ht]") %>%
6670
str_replace_all(fixed("\\[@"), regex("[@")) %>%
6771
str_replace_all("\\\\]", "]") %>%
6872
str_replace_all("\\{.mark\\}", "") %>%#this text appears when the text background is not white in the docx
73+
str_replace_all("\\\\~", "~") %>%
74+
str_replace_all("\\\\`", "`") %>%
75+
str_replace_all(fixed("\\|"), "|") %>%
76+
str_replace_all(fixed("\\\\"), "\\")
77+
txt %>%
6978
writeLines(useBytes = TRUE,
7079
con = find_root_file("source/bookdown/habitatauteurs_paragrafen",
7180
sprintf("%s_%s.md",hoofdstuk,x),

0 commit comments

Comments
 (0)