Skip to content

Commit

Permalink
Merge pull request #68 from forked-packages/master
Browse files Browse the repository at this point in the history
Prevent from duplicated entries and some encoding issues
  • Loading branch information
crsh authored Jun 4, 2020
2 parents 2fcab5f + 13e903b commit 59afc70
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions R/insert_citation.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 59afc70

Please sign in to comment.