Skip to content

Commit

Permalink
Adds option to use rmdfiltr's doi2bib filter.
Browse files Browse the repository at this point in the history
  • Loading branch information
crsh committed Oct 11, 2024
1 parent bf3961d commit c26b20a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ inst/doc

.vscode
.luarc.json

/.luarc.json
8 changes: 8 additions & 0 deletions R/apa6_formats.R
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ apa6_pdf <- function(
on.exit(close(output_file_connection))
writeLines(output_text, output_file_connection, useBytes = TRUE)

if(isTRUE(metadata$doi_citations)) {
rmdfiltr::replace_doi_citations(input_file, metadata$bibliography)
}

# Apply bookdown postprocesser and pass format options
bookdown_post_processor <- bookdown::pdf_document2()$post_processor
pp_env <- environment(bookdown_post_processor)
Expand Down Expand Up @@ -377,6 +381,10 @@ pdf_pre_processor <- function(metadata, input_file, runtime, knit_meta, files_di
)
csl_specified <- is.null(args)

if(isTRUE(metadata$doi_citations)) {
args <- rmdfiltr::add_doi2cite_filter(args)
}

## Set ampersand filter
if((is.null(metadata$replace_ampersands) || metadata$replace_ampersands)) {
if(csl_specified) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
\makeatletter
\xapptocmd\appendix
{\xapptocmd\section
{\addcontentsline{toc}{section}{\appendixname\ifoneappendix\else~\theappendix\fi\\: #1}}
{\addcontentsline{toc}{section}{\appendixname\ifoneappendix\else~\theappendix\fi: #1}}
{}{\InnerPatchFailed}%
}
{}{\PatchFailed}
\makeatother

0 comments on commit c26b20a

Please sign in to comment.