Browse Source

Always use Unix-style newlines

Attempts to address #39 by removing Windows-style
carriage return early in the process.
testing-framework
Noam Ross Noam Ross 1 year ago
parent
commit
6af00c3761
4 changed files with 6 additions and 5 deletions
  1. +1
    -1
      R/dedoc.R
  2. +2
    -2
      R/preprocessor.R
  3. +2
    -1
      R/redoc.R
  4. +1
    -1
      R/stri-utils.R

+ 1
- 1
R/dedoc.R View File

@@ -310,7 +310,7 @@ convert_docx_to_md <- function(docx,
filter_opts <- character(0)
from_format <- "docx"
}
other_opts <- c("--standalone")
other_opts <- c("--standalone", "--eol=lf")
opts <- c(filter_opts, track_opts, wrap_opts, other_opts)
md_tmp <- tempfile(fileext = ".md")
pandoc_convert(docx,


+ 2
- 2
R/preprocessor.R View File

@@ -20,7 +20,7 @@
#' @importFrom yaml write_yaml
#' @export
#' @examples
#'
#'
#' make_preknitter(wrappers = list(htmlcommentwrap, latexwrap))
make_preknitter <- function(wrappers = list()) {
pre_knit <- function(input, ...) {
@@ -28,7 +28,7 @@ make_preknitter <- function(wrappers = list()) {
pre_knit_input <- get("knit_input", envir = render_env)
intermediates_loc <- get("intermediates_loc", envir = render_env)

rmd_text <- readfile(input)
rmd_text <- normalize_newlines(readfile(input))
rmd <- wrap_code(rmd_text, wrappers = wrappers)

codefile <- intermediates_loc(


+ 2
- 1
R/redoc.R View File

@@ -52,7 +52,8 @@ redoc <- function(highlight_outputs = TRUE, wrap = 80,
"--lua-filter",
system.file("lua-filters", "protect-empty.lua",
package = "redoc"
)
),
"--eol=lf"
)
)



+ 1
- 1
R/stri-utils.R View File

@@ -75,7 +75,7 @@ insert_at_prior_empty_line <- function(text, insertion, line) {
}

normalize_newlines <- function(text) {
stri_replace_all_fixed(text, c("\r\n", "\n\r", "\r"), "\n",
stri_replace_all_fixed(text, c("\r\n"), "\n",
vectorize_all = FALSE
)
}


Loading…
Cancel
Save