R/remove_blank_line_dups.R
remove_blank_line_dups.Rd
This function removes blank line duplicates (e.g., a ""
line, followed by
another ""
line) from a file.
It can also remove blank lines at the top or bottom of the file, and remove blank lines around a text block.
remove_blank_line_dups(
file,
remove_caps = TRUE,
block_fix = TRUE,
block_start_pattern = "<!-- badges: start -->",
block_end_pattern = "<!-- badges: end -->"
)
A string indicating a file path.
A logical
flag indicating if the function
should remove blank lines at the top and bottom of the file.
A logical
flag indicating if the function
should fix blank lines around a text block
A string indicating the start of the text block.
A string indicating the end of text block.
An invisible NULL
. This function don't aim to return values.
file <- tempfile()
writeLines(c("", "line 1", "", "", "line 2", "", "", "line 3", ""), file)
remove_blank_line_dups(file)
readLines(file)
#> [1] "line 1" "" "line 2" "" "line 3"
#> [1] "line 1" "" "line 2" "" "line 3" # Expected