Skip to content

Commit

Permalink
change regex to find first YAML header in file
Browse files Browse the repository at this point in the history
  • Loading branch information
petzi53 committed May 9, 2023
1 parent 4924e6b commit 927391a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# quartopost 0.2.2

* Find the first YAML header to prevent that YAML from R code example is taken


# quartopost 0.2.1

* Resolved bug to find YAML header
Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ get_cat <- function() {
# read file contents into list variable
for (i in 1:length(fp)) {
f_list[i] <- readr::read_file(fp[i]) |>
stringr::str_extract(stringr::regex("^---[\\s\\S]*^---\\n", multiline = TRUE))
stringr::str_extract(stringr::regex("^---[\\s\\S]*?^---\\n", multiline = TRUE))
}

# extract yaml content
Expand Down

0 comments on commit 927391a

Please sign in to comment.