Skip to content

Commit

Permalink
Improve issue build page number updating
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchelloharawild committed Sep 28, 2023
1 parent 1c24ded commit 89b67fc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,18 @@ update_front_matter <- function(yml, file) {
input <- xfun::read_utf8(file)
front_matter_delimiters <- grep("^(---|\\.\\.\\.)\\s*$", input)

body <- if (front_matter_delimiters[2] == length(input)) {
character()
} else {
input[(front_matter_delimiters[2]+1):length(input)]
}

xfun::write_utf8(
c(
"---",
yaml::as.yaml(yml),
"---",
"",
input[(front_matter_delimiters[2]+1):length(input)]
body
),
file
)
Expand Down

0 comments on commit 89b67fc

Please sign in to comment.