diff --git a/NEWS.md b/NEWS.md index fa0d230..32f6f29 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# citr 0.3.3 + +- Prevented from duplicated file names which resulted in duplicated bibliography entries in the add-in (@GegznaV, #67, #68) +- Argument `encoding = getOption("citr.encoding")` is passed to `readLines()` in `insert_citation()` (@GegznaV, #68) + + # citr 0.3.2 - Fixed bug related to use of absolute file paths that caused errors finding the bibliography files (reported by @bblodfon and @neurotroph, #52) diff --git a/R/insert_citation.R b/R/insert_citation.R index 86c6249..675e2ea 100644 --- a/R/insert_citation.R +++ b/R/insert_citation.R @@ -104,7 +104,7 @@ insert_citation <- function( stop("More than one parent document found. See getOption('citr.parent_documents').") } - parent_document <- readLines(parents_path[parents], warn = FALSE) + parent_document <- readLines(parents_path[parents], warn = FALSE, encoding = getOption("citr.encoding")) parent_yaml_delimiters <- grep("^(---|\\.\\.\\.)\\s*$", parent_document) yaml_bib_file <- get_bib_from_yaml( @@ -795,7 +795,7 @@ get_bib_from_yaml <- function(yaml_delimiters, file_contents, rmd_path, bib_file file.path(rmd_path, yaml::yaml.load(yaml_front_matter)$bibliography) , tools::file_path_as_absolute ) - c(bib_file, absolute_bib_file) + unique(c(bib_file, absolute_bib_file)) } else { NULL }