Skip to content

Commit

Permalink
escape html in raw text
Browse files Browse the repository at this point in the history
Fixes #143.
P.S.: Please bump version bug counter when merging (I think that is more consistent than bumping versions inside PRs, which may not be aware of other PRs).
  • Loading branch information
hlageek committed May 19, 2024
1 parent 4d105d6 commit ca8372d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/mod_document_code_utils_document_code.R
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ load_doc_to_display <- function(pool,
blend_colors,
code_names)
)

content_df <- coded_segments %>%
dplyr::filter(segment_start <= segment_end) %>% # patch for failing calculate_code_overlap() function in case of identical code positions
dplyr::mutate(code_id = as.character(code_id)) %>%
Expand Down Expand Up @@ -363,11 +363,11 @@ load_doc_to_display <- function(pool,
content_df$position_end,
content_df$tag),
~paste0(..3,
substr(
htmltools::htmlEscape(substr(

raw_text,
..1,
..2))),
..2)))),
collapse = "") %>%
stringr::str_replace_all("[\\n\\r]",
"<span class='br'>\\&#8203</span></p><p class='docpar'>")
Expand All @@ -379,7 +379,7 @@ load_doc_to_display <- function(pool,
df_non_coded <- paste0(
"<article><p class='document_par'>",

raw_text %>%
htmltools::htmlEscape(raw_text) %>%
stringr::str_replace_all("[\\n\\r]",
"<span class='br'>\\&#8203</span></p><p class='docpar'>"),

Expand Down

0 comments on commit ca8372d

Please sign in to comment.