From 82ec4eacc70657b02dd84a9e73bcc9e99b3fba29 Mon Sep 17 00:00:00 2001 From: Trevor Riley <89118428+TNRiley@users.noreply.github.com> Date: Fri, 24 May 2024 08:59:26 -0400 Subject: [PATCH] Update export.R Improved output readability of export_ris function by replacing print with cat for final mapping display. --- R/export.R | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/R/export.R b/R/export.R index e05c0bc..7ff4362 100644 --- a/R/export.R +++ b/R/export.R @@ -99,16 +99,19 @@ export_ris <- function(x, filename = "output.ris", user_mapping = NULL) { } } - # Print the final mapping and ask the user if they want to proceed - print(default_mapping) - proceed <- readline("Do you want to proceed with this mapping? (yes/no): ") - - if (tolower(proceed) == "yes") { - # Currently, write_refs does not accept tibbles, thus converted - write_refs(as.data.frame(x), file = filename) - } else { - message("Export cancelled. Please modify your user_mapping argument and try again.") - } +# Print the final mapping and ask the user if they want to proceed +cat("\nFinal Mapping:\n") +for (field in names(default_mapping)) { + cat(field, ":", default_mapping[[field]], "\n") +} + +proceed <- readline("Do you want to proceed with this mapping? (yes/no): ") + +if (tolower(proceed) == "yes") { + # Currently, write_refs does not accept tibbles, thus converted + write_refs(as.data.frame(citations), file = filename) +} else { + message("Export cancelled. Please modify your user_mapping argument and try again.") }