From 377339d7f59384144287fa55715cc15ca3a95b99 Mon Sep 17 00:00:00 2001 From: sbreitbart-NOAA Date: Tue, 17 Dec 2024 10:43:25 -0500 Subject: [PATCH 1/2] added first draft of new FSC-specific citations --- R/create_citation.R | 66 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 10 deletions(-) diff --git a/R/create_citation.R b/R/create_citation.R index 2fa97df9..d58b537f 100644 --- a/R/create_citation.R +++ b/R/create_citation.R @@ -121,26 +121,72 @@ create_citation <- function( title, ". ", off_title, ", ", "CITY, STATE. " ) - } else if (office != "SEFSC") { + + } else if (office == "AFSC") { + cit <- paste0( + "{{< pagebreak >}} \n", + "\n", + "Please cite this publication as: \n", + "\n", + author_list, ". ", year, ". ", + title, + ". North Pacific Fishery Management Council, Anchorage, AK. Available from ", + "https://www.npfmc.org/library/safe-reports/" + ) + + } else if (office == "NWFSC") { + cit <- paste0( + "{{< pagebreak >}} \n", + "\n", + "Please cite this publication as: \n", + "\n", + author_list, ". ", title, ".", year, + ". Prepared by ... . XX p." + ) + + } else if (office == "PIFSC") { + cit <- paste0( + "{{< pagebreak >}} \n", + "\n", + "Please cite this publication as: \n", + "\n", + author_list, ". ", year, ". ", + title, ". NOAA Tech. Memo. [TECH MEMO NUMBER]", + ", ", "XX p." + ) + + } else if (office == "SEFSC") { cit <- paste0( - "{{< pagebreak >}} \n", + "'{{< pagebreak >}}' \n", "\n", "Please cite this publication as: \n", "\n", - author_list, ". ", year, ". ", - title, ". ", off_title, ", ", - loc_city, ", ", loc_state, ". " + "SEDAR. ", year, ". ", title, ". ", + "SEDAR, North Charleston SC. XX pp. ", + "available online at: http://sedarweb.org/" ) - } else { + + } else if (office == "SWFSC") { + cit <- paste0( + "{{< pagebreak >}} \n", + "\n", + "Please cite this publication as: \n", + "\n", + author_list, ", ", year, ". ", title, + ". Pacific Fishery Management Council, Portland, OR. Available from https://www.pcouncil.org/stock-assessments-and-fishery-evaluation-safe-documents/." + ) + + } else { # this includes NEFSC cit <- paste0( - "'{{< pagebreak >}}' \n", + "{{< pagebreak >}} \n", "\n", "Please cite this publication as: \n", "\n", - "SEDAR. ", year, ". ", title, - "SEDAR, North Charleston SC. XXpp. ", - "available online at: http://sedarweb.org/" + author_list, ". ", year, ". ", + title, ". ", off_title, ", ", + loc_city, ", ", loc_state, ". " ) + } # Add citation as .qmd to add into template From de47142b0ac083325347f915a91088575c79db83 Mon Sep 17 00:00:00 2001 From: sbreitbart-NOAA Date: Tue, 17 Dec 2024 13:01:38 -0500 Subject: [PATCH 2/2] Bracketed information that must be added by authors into citation. Updated test to work with new citation style. --- R/create_citation.R | 10 +++++----- tests/testthat/test-create_citation.R | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/R/create_citation.R b/R/create_citation.R index d58b537f..f3454e44 100644 --- a/R/create_citation.R +++ b/R/create_citation.R @@ -117,9 +117,9 @@ create_citation <- function( "\n", "Please cite this publication as: \n", "\n", - "AUTHOR NAME. YEAR. ", + "[AUTHOR NAME]. [YEAR]. ", title, ". ", off_title, ", ", - "CITY, STATE. " + "[CITY], [STATE]. " ) } else if (office == "AFSC") { @@ -141,7 +141,7 @@ create_citation <- function( "Please cite this publication as: \n", "\n", author_list, ". ", title, ".", year, - ". Prepared by ... . XX p." + ". Prepared by [COMMITTEE]. [XX] p." ) } else if (office == "PIFSC") { @@ -152,7 +152,7 @@ create_citation <- function( "\n", author_list, ". ", year, ". ", title, ". NOAA Tech. Memo. [TECH MEMO NUMBER]", - ", ", "XX p." + ", ", "[XX] p." ) } else if (office == "SEFSC") { @@ -162,7 +162,7 @@ create_citation <- function( "Please cite this publication as: \n", "\n", "SEDAR. ", year, ". ", title, ". ", - "SEDAR, North Charleston SC. XX pp. ", + "SEDAR, North Charleston SC. [XX] pp. ", "available online at: http://sedarweb.org/" ) diff --git a/tests/testthat/test-create_citation.R b/tests/testthat/test-create_citation.R index 42e432cb..6cdbb77b 100644 --- a/tests/testthat/test-create_citation.R +++ b/tests/testthat/test-create_citation.R @@ -1,4 +1,4 @@ -test_that("citaiton generated properly for SWFSC", { +test_that("citation generated properly for SWFSC", { fxn_test <- create_citation( author = c( "Peter T. Kuriyama", @@ -10,6 +10,6 @@ test_that("citaiton generated properly for SWFSC", { year = 2024, office = "SWFSC" ) - expected_output <- "{{< pagebreak >}} \n\nPlease cite this publication as: \n\nKuriyama, P.T., C.Allen Akselrud, J.P. Zwolinski, K.T. Hill. 2024. Check. NOAA Fisheries Science Center, La Jolla, CA. " + expected_output <- "{{< pagebreak >}} \n\nPlease cite this publication as: \n\nKuriyama, P.T., C.Allen Akselrud, J.P. Zwolinski, K.T. Hill, 2024. Check. Pacific Fishery Management Council, Portland, OR. Available from https://www.pcouncil.org/stock-assessments-and-fishery-evaluation-safe-documents/." expect_equal(fxn_test, expected_output) })