From 927391a1dc2e193e17942994ba31b5fdcee9d177 Mon Sep 17 00:00:00 2001 From: petzi53 Date: Tue, 9 May 2023 14:47:37 +0200 Subject: [PATCH] change regex to find first YAML header in file --- NEWS.md | 5 +++++ R/utils.R | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 7707e24..720f2ce 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 diff --git a/R/utils.R b/R/utils.R index aab795a..9ebc9c7 100644 --- a/R/utils.R +++ b/R/utils.R @@ -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