diff --git a/R/package.R b/R/package.R index 47f19f3f2..6747f92f7 100644 --- a/R/package.R +++ b/R/package.R @@ -196,7 +196,7 @@ read_meta <- function(path, check_path = TRUE, call = caller_env()) { # (<>) Parser error: <> yaml_err <- conditionMessage(e) # extract parsing error from original error (i.e. remove the path) - parsing_error <- sub("[^\\)]+\\)", "", yaml_err) + parsing_error <- sub("[^\\)]+\\)\\s", "", yaml_err) # Extract path from original error path_yaml <- regmatches(yaml_err, m = regexpr("\\(([^\\)]+)\\)", yaml_err)) path_yaml <- gsub("\\(([^\\)]+)\\)", "\\1", path_yaml) diff --git a/tests/testthat/_snaps/package.md b/tests/testthat/_snaps/package.md index 00cf48f8e..01fdc3913 100644 --- a/tests/testthat/_snaps/package.md +++ b/tests/testthat/_snaps/package.md @@ -27,6 +27,6 @@ Condition Error: x Could not parse the config file. - ! Parser error: while parsing a block mapping at line 1, column 1 did not find expected key at line 9, column 3 + ! Parser error: while parsing a block mapping at line 1, column 1 did not find expected key at line 9, column 3 i Edit 'assets/bad-yaml/_pkgdown.yml' to fix the problem.