From af9884d5eea45caae8a9412ce373048c29e742cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20N=C3=BCst?= Date: Fri, 6 Dec 2024 12:48:38 +0100 Subject: [PATCH] do not put md hyperlink in JSON output, tests for rendering --- DESCRIPTION | 2 +- NAMESPACE | 2 + R/register.R | 20 +++++--- R/utils_download_certs.R | 8 ++- R/utils_preprocess_register.R | 20 ++++++-- R/utils_render_cert_htmls.R | 49 +++++++++++-------- R/utils_render_cert_md.R | 5 ++ R/utils_render_register_general.r | 6 +-- R/utils_render_register_htmls.R | 4 +- R/utils_render_register_json.R | 12 ++--- R/utils_render_register_mds.R | 17 ++++--- R/utils_render_table_non_registers.R | 2 +- inst/extdata/config.R | 16 ++++-- inst/extdata/templates/cert/template_base.md | 2 +- .../templates/cert/template_no_cert.md | 2 +- inst/tinytest/config/render_html.R | 1 + inst/tinytest/register/short.csv | 4 ++ inst/tinytest/test_render_html.R | 23 +++++++++ inst/tinytest/test_render_json.R | 38 ++++++++++++++ inst/tinytest/test_render_md.R | 16 ++++++ man/add_cert_links.Rd | 6 +-- ..._to_jpeg.Rd => convert_cert_pdf_to_png.Rd} | 8 +-- man/register_render.Rd | 5 +- man/render_register.Rd | 2 +- 24 files changed, 196 insertions(+), 74 deletions(-) create mode 100644 inst/tinytest/config/render_html.R create mode 100644 inst/tinytest/register/short.csv create mode 100644 inst/tinytest/test_render_html.R create mode 100644 inst/tinytest/test_render_json.R create mode 100644 inst/tinytest/test_render_md.R rename man/{convert_cert_pdf_to_jpeg.Rd => convert_cert_pdf_to_png.Rd} (82%) diff --git a/DESCRIPTION b/DESCRIPTION index bbe8476..7423fe0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: codecheck Title: Helper Functions for CODECHECK Project -Version: 0.11.5 +Version: 0.11.6 Authors@R: c(person(given = "Stephen", family = "Eglen", diff --git a/NAMESPACE b/NAMESPACE index 92bb135..ec2f7d7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -18,6 +18,7 @@ export(register_render) export(set_zenodo_certificate) export(upload_zenodo_metadata) export(validate_codecheck_yml) +import(dplyr) import(jsonlite) importFrom(R.cache,addMemoization) importFrom(R.cache,getCacheRootPath) @@ -28,6 +29,7 @@ importFrom(httr,http_error) importFrom(httr,http_status) importFrom(httr,status_code) importFrom(httr,write_disk) +importFrom(jsonlite,fromJSON) importFrom(knitr,kable) importFrom(osfr,osf_download) importFrom(osfr,osf_ls_files) diff --git a/R/register.R b/R/register.R index 8ec602b..09686e2 100644 --- a/R/register.R +++ b/R/register.R @@ -7,6 +7,7 @@ #' #' @param register A `data.frame` with all required information for the register's view #' @param outputs The output formats to create +#' @param config A list of configuration files to be sourced at the beginning of the rending process #' #' @return A `data.frame` of the register enriched with information from the configuration files of respective CODECHECKs from the online repositories #' @@ -16,16 +17,17 @@ #' @importFrom knitr kable #' @importFrom utils capture.output read.csv tail #' @import jsonlite +#' @import dplyr #' #' @export register_render <- function(register = read.csv("register.csv", as.is = TRUE), filter_by = c("venues", "codecheckers"), - outputs = c("html", "md", "json")) { - # Loading the dplyr package otherwise we cant use "%>%" - library(dplyr) - - # Loading config.R file - source(system.file("extdata", "config.R", package = "codecheck")) + outputs = c("html", "md", "json"), + config = c(system.file("extdata", "config.R", package = "codecheck"))) { + # Loading config.R files + for (i in seq(length(config))) { + source(config[i]) + } message("Using cache path ", R.cache::getCacheRootPath()) @@ -33,7 +35,11 @@ register_render <- function(register = read.csv("register.csv", as.is = TRUE), # Setting number of codechecks now for later use. This is done to avoid double counting codechecks # done by multiple authors. CONFIG$NO_CODECHECKS <- nrow(register_table) - render_cert_htmls(register_table, force_download = FALSE) + + if("html" %in% outputs) { + render_cert_htmls(register_table, force_download = FALSE) + } + create_filtered_reg_csvs(register, filter_by) create_register_files(register_table, filter_by, outputs) create_non_register_files(register_table, filter_by) diff --git a/R/utils_download_certs.R b/R/utils_download_certs.R index e44d5f0..04a6bb9 100644 --- a/R/utils_download_certs.R +++ b/R/utils_download_certs.R @@ -1,6 +1,3 @@ -library(httr) -library(jsonlite) - #' Downloads a certificate PDF from a report link and saves it locally. #' If the download link is a ZIP file, it extracts the PDF from #' the archive. Returns status based on success. @@ -153,6 +150,7 @@ get_osf_cert_link <- function(report_link, cert_id){ #' @param api_key (Optional) API key for Zenodo authentication if required. #' #' @importFrom httr GET status_code content +#' @importFrom jsonlite fromJSON #' #' @return The download link for the certificate file as a string if found; otherwise, NULL. get_zenodo_cert_link <- function(report_link, cert_id, api_key = "") { @@ -172,7 +170,7 @@ get_zenodo_cert_link <- function(report_link, cert_id, api_key = "") { if (httr::status_code(response) == 200) { # Parse the response - record_data <- fromJSON(httr::content(response, "text", encoding = "UTF-8")) + record_data <- jsonlite::fromJSON(httr::content(response, "text", encoding = "UTF-8")) files_list <- record_data$entries @@ -265,7 +263,7 @@ extract_cert_pdf_from_zip <- function(zip_download_url, cert_sub_dir){ #' #' @importFrom pdftools pdf_info #' @param cert_id The certificate identifier. This ID is used to locate the PDF and save the resulting images. -convert_cert_pdf_to_jpeg <- function(cert_id){ +convert_cert_pdf_to_png <- function(cert_id){ # Checking if the certs dir exist cert_dir <- file.path(CONFIG$CERTS_DIR[["cert"]], cert_id) diff --git a/R/utils_preprocess_register.R b/R/utils_preprocess_register.R index 3aac952..ded6f18 100644 --- a/R/utils_preprocess_register.R +++ b/R/utils_preprocess_register.R @@ -159,21 +159,31 @@ add_codechecker <- function(register_table, register) { return(register_table) } -#' Function for adding clickable links to the paper for each entry in the register table. +#' Function for adding clickable links to the paper for each entry in the register table and add certificate identifier and link as extra columns #' #' @param register_table The register table to be adjusted. -#' @return The adjusted register table with clickable Certificate links. +#' @return The adjusted register table with clickable Certificate links and new columns for certificate identifier and certificate URL add_cert_links <- function(register_table){ + ids <- c() + links <- c() + # Looping over the entries in the register for (i in seq_len(nrow(register_table))) { - # Constructing the hyperlink cert_id <- register_table[i, ]$Certificate - hyperlink <- paste0("[", cert_id, "](", CONFIG$HYPERLINKS[["certs"]], cert_id, "/)") - + cert_link <- paste0(CONFIG$HYPERLINKS[["certs"]], cert_id, "/") + + # Constructing the hyperlink + hyperlink <- paste0("[", cert_id, "](", cert_link, ")") register_table[i, ]$Certificate <- hyperlink + + ids <- c(ids, cert_id) + links <- c(links, cert_link) } + register_table$`Certificate ID` <- ids + register_table$`Certificate Link` <- links + return(register_table) } diff --git a/R/utils_render_cert_htmls.R b/R/utils_render_cert_htmls.R index 29d837a..0376cc9 100644 --- a/R/utils_render_cert_htmls.R +++ b/R/utils_render_cert_htmls.R @@ -10,6 +10,8 @@ render_cert_htmls <- function(register_table, force_download = FALSE){ # Loop over each cert in the register table for (i in 1:nrow(register_table)){ + download_cert_status <- NA + abstract <- get_abstract(register_table[i, ]$Repository) # Retrieving report link and cert id @@ -17,28 +19,33 @@ render_cert_htmls <- function(register_table, force_download = FALSE){ cert_hyperlink <- register_table[i, ]$Certificate cert_id <- sub("\\[(.*)\\]\\(.*\\)", "\\1", cert_hyperlink) - # Define paths for the certificate PDF and JPEG - pdf_path <- file.path(CONFIG$CERTS_DIR[["cert"]], cert_id, "cert.pdf") - pdf_exists <- file.exists(pdf_path) - - # Download the PDF if it doesn't exist or if force_download is TRUE - if (!pdf_exists || force_download) { - download_cert_status <- download_cert_pdf(report_link, cert_id) - # Successfully downloaded cert - # Proceeding to convert pdfs to jpegs - if (download_cert_status == 1){ - convert_cert_pdf_to_jpeg(cert_id) + if(CONFIG$CERT_DOWNLOAD_AND_CONVERT) { + # Define paths for the certificate PDF and JPEG + pdf_path <- file.path(CONFIG$CERTS_DIR[["cert"]], cert_id, "cert.pdf") + pdf_exists <- file.exists(pdf_path) + + # Download the PDF if it doesn't exist or if force_download is TRUE + if (!pdf_exists || force_download) { + download_cert_status <- download_cert_pdf(report_link, cert_id) + # Successfully downloaded cert + # Proceeding to convert pdfs to jpegs + if (download_cert_status == 1){ + convert_cert_pdf_to_png(cert_id) + } + + # Delaying requests to adhere to request limits + Sys.sleep(CONFIG$CERT_REQUEST_DELAY) } - - # Delaying reqwuests to adhere to request limits - Sys.sleep(CONFIG$CERT_REQUEST_DELAY) - } - - # The pdf exists and force download is False - else{ - download_cert_status <- 1 + + # The pdf exists and force download is False + else{ + download_cert_status <- 1 + } + } else { + # do not display a certificate + download_cert_status <- 0 } - + render_cert_html(cert_id, register_table[i, ]$Repository, download_cert_status) } } @@ -48,7 +55,7 @@ render_cert_htmls <- function(register_table, force_download = FALSE){ #' #' @importFrom pdftools pdf_info #' @param cert_id The certificate identifier. This ID is used to locate the PDF and save the resulting images. -convert_cert_pdf_to_jpeg <- function(cert_id){ +convert_cert_pdf_to_png <- function(cert_id){ # Checking if the certs dir exist cert_dir <- file.path(CONFIG$CERTS_DIR[["cert"]], cert_id) diff --git a/R/utils_render_cert_md.R b/R/utils_render_cert_md.R index 1427d95..0520897 100644 --- a/R/utils_render_cert_md.R +++ b/R/utils_render_cert_md.R @@ -204,6 +204,11 @@ add_abstract <- function(repo_link, md_content){ create_cert_md <- function(cert_id, repo_link, download_cert_status){ cert_dir <- file.path(CONFIG$CERTS_DIR[["cert"]], cert_id) + # Create the directory if it does not exist (e.g., because no PDFs are downloaded) + if (!dir.exists(cert_dir)) { + dir.create(cert_dir, recursive = TRUE) + } + # Loading the correct template based on whether cert exists if (download_cert_status == 0) { template_type <- "md_template_no_cert" diff --git a/R/utils_render_register_general.r b/R/utils_render_register_general.r index f52b38e..92ebd22 100644 --- a/R/utils_render_register_general.r +++ b/R/utils_render_register_general.r @@ -6,7 +6,7 @@ #' The function iterates through the provided output types, generates an output directory, #' filters and adjusts the register table, and renders the original register files based on the specified formats. create_original_register_files <- function(register_table, outputs){ - filter <- "none" + filter <- NA for (output_type in outputs){ table_details <- list(is_reg_table = TRUE) table_details[["output_dir"]] <- generate_output_dir(filter, table_details) @@ -150,7 +150,7 @@ generate_table_details <- function(table_key, table, filter, is_reg_table = TRUE #' "csv" for CSVs, "md" for MD and "html" for HTMLs. #' #' @return None. The function generates a file in the specified format. -render_register <- function(register_table, table_details, filter, output_type){ +render_register <- function(register_table, table_details, filter = NA, output_type){ register_table <- filter_and_drop_register_columns(register_table, filter, output_type) switch(output_type, @@ -175,7 +175,7 @@ generate_output_dir <- function(filter, table_details = list()) { # We have register tables if (table_details[["is_reg_table"]]){ # We have the original register table - if (filter=="none"){ + if (is.na(filter)){ output_dir <- base_dir } diff --git a/R/utils_render_register_htmls.R b/R/utils_render_register_htmls.R index 494a2c3..60896a3 100644 --- a/R/utils_render_register_htmls.R +++ b/R/utils_render_register_htmls.R @@ -91,7 +91,7 @@ generate_href <- function(filter, table_details, href_type) { base_url <- href_details$base_url # For the original register - if (filter == "none") { + if (is.na(filter)) { return(paste0(base_url, "register", href_details$ext)) } @@ -167,7 +167,7 @@ render_html <- function(table, table_details, filter){ # For all registered tables besides the original we change the html # file so that the path to the libs folder refers to the libs folder "docs/libs". # This is done to remove duplicates of "libs" folders. - if (filter != "none"){ + if (!is.na(filter)){ html_file_path <- paste0(output_dir, "index.html") edit_html_lib_paths(html_file_path) # Deleting the libs folder after changing the html lib path diff --git a/R/utils_render_register_json.R b/R/utils_render_register_json.R index f74770f..fa81da8 100644 --- a/R/utils_render_register_json.R +++ b/R/utils_render_register_json.R @@ -54,25 +54,25 @@ set_paper_title_references <- function(register_table){ #' @param table_details List containing details such as the table name, subcat name. #' @param filter The filter render_register_json <- function(register_table, table_details, filter) { - register_table <- add_repository_links_json(register_table) + register_table_json <- add_repository_links_json(register_table) # Set paper titles and references - register_table <- set_paper_title_references(register_table) + register_table_json <- set_paper_title_references(register_table_json) output_dir <- table_details[["output_dir"]] # Keeping only those columns that are mentioned in the json columns and those that # register table already has - columns_to_keep <- intersect(CONFIG$JSON_COLUMNS, names(register_table)) + columns_to_keep <- intersect(CONFIG$JSON_COLUMNS, names(register_table_json)) jsonlite::write_json( - register_table[, columns_to_keep], + register_table_json[, columns_to_keep], path = paste0(output_dir, "register.json"), pretty = TRUE ) jsonlite::write_json( - utils::tail(register_table, 10)[, columns_to_keep], + utils::tail(register_table_json, CONFIG$FEATURED_COUNT)[, columns_to_keep], path = paste0(output_dir, "featured.json"), pretty = TRUE ) @@ -80,7 +80,7 @@ render_register_json <- function(register_table, table_details, filter) { jsonlite::write_json( list( source = generate_href(filter, table_details, "json"), - cert_count = nrow(register_table) + cert_count = nrow(register_table_json) # TODO count conferences, preprints, # journals, etc. ), diff --git a/R/utils_render_register_mds.R b/R/utils_render_register_mds.R index 5500c83..efd7e3d 100644 --- a/R/utils_render_register_mds.R +++ b/R/utils_render_register_mds.R @@ -7,18 +7,21 @@ #' @return The modified markdown table add_markdown_title <- function(table_details, md_table, filter){ # The filter is in the CONFIG$MD_TITLES - if (filter %in% names(CONFIG$MD_TITLES)) { + title_fn <- NULL + + if (is.na(filter)) { + title_fn <- CONFIG$MD_TITLES[["default"]] + } else if (filter %in% names(CONFIG$MD_TITLES)) { # Loading the title function (if present) and passing the argument title_fn <- CONFIG$MD_TITLES[[filter]] - title <- title_fn(table_details) - } - - # No titles provided in the CONFIG file for the filter type - # Stopping the process - else { + } else { + # No filter or no titles provided in the CONFIG file for the filter type + # Stopping the process stop("Invalid filter provided.") } + title <- title_fn(table_details) + md_table <- gsub("\\$title\\$", title, md_table) return(md_table) } diff --git a/R/utils_render_table_non_registers.R b/R/utils_render_table_non_registers.R index 6be220f..82984c1 100644 --- a/R/utils_render_table_non_registers.R +++ b/R/utils_render_table_non_registers.R @@ -23,7 +23,7 @@ create_non_register_files <- function(register_table, filter_by){ render_html(table, table_details, filter) - # Removing the unneccessary columns before creating html and json + # Removing the unnecessary columns before creating html and json if (filter == "venues"){ table <- table %>% select(-`venue_slug`) } diff --git a/inst/extdata/config.R b/inst/extdata/config.R index 99619b4..430c168 100644 --- a/inst/extdata/config.R +++ b/inst/extdata/config.R @@ -23,7 +23,7 @@ CONFIG$REGISTER_COLUMNS <- list( html = c("Certificate", "Paper Title", "Type", "Venue", "Issue", "Report", "Check date"), md = c("Certificate", "Paper Title", "Type", "Venue", "Issue", "Report", "Check date"), csv = c("Certificate", "Repository", "Type", "Venue", "Issue", "Report", "Check date"), - json = c("Certificate", "Repository", "Type", "Venue", "Issue", "Report", "Check date") + json = c("Certificate ID", "Certificate Link", "Repository", "Type", "Venue", "Issue", "Report", "Check date") ) CONFIG$DIR_TEMP_REGISTER_CODECHECKER <- "docs/temp_register_codechecker.csv" @@ -41,7 +41,7 @@ CONFIG$FILTER_COLUMN_NAMES_TO_DROP <- list( ) CONFIG$MD_TITLES <- list( - "none" = function(table_details){ + "default" = function(table_details){ "CODECHECK Register" }, @@ -180,9 +180,12 @@ CONFIG$FILTER_SUBCAT_COLUMNS <- list( # OTHERS CONFIG$DICT_ORCID_ID_NAME <- list() -# Delaying requests by 1 second to adhere to the rate limit of 60 requests/ minute for Zenodo +# Delaying requests by 1 second to adhere to the rate limit of 60 requests/minute for Zenodo CONFIG$CERT_REQUEST_DELAY <- 1 +# Number of items in the featured lists of certificates +CONFIG$FEATURED_COUNT <- 10 + # CERT LINKS CONFIG$CERT_LINKS <- list( osf_api = "https://api.osf.io/v2/", @@ -192,7 +195,9 @@ CONFIG$CERT_LINKS <- list( ) CONFIG$CERTS_URL_PREFIX <- "https://doi.org/" -CONFIG$CERT_DPI <- 800 +CONFIG$CERT_DPI <- 800 + +CONFIG$CERT_DOWNLOAD_AND_CONVERT <- TRUE # DIRECTORIES CONFIG$CERTS_DIR <- list( @@ -239,7 +244,8 @@ CONFIG$DICT_VENUE_NAMES <- list( # JSON FILE INFORMATION # List specifying the columns to keep for JSON files CONFIG$JSON_COLUMNS <- c( - "Certificate", + "Certificate ID", + "Certificate Link", "Repository Link", "Type", "Venue", diff --git a/inst/extdata/templates/cert/template_base.md b/inst/extdata/templates/cert/template_base.md index f34b7a0..8b4d0b3 100644 --- a/inst/extdata/templates/cert/template_base.md +++ b/inst/extdata/templates/cert/template_base.md @@ -164,4 +164,4 @@ document.addEventListener("DOMContentLoaded", function() { adjustContentDisplay(abstractContent, abstractSection); }); - \ No newline at end of file + diff --git a/inst/extdata/templates/cert/template_no_cert.md b/inst/extdata/templates/cert/template_no_cert.md index e36957d..4ea5602 100644 --- a/inst/extdata/templates/cert/template_no_cert.md +++ b/inst/extdata/templates/cert/template_no_cert.md @@ -123,4 +123,4 @@ document.addEventListener("DOMContentLoaded", function() { adjustContentDisplay(abstractContent, abstractSection); }); - \ No newline at end of file + diff --git a/inst/tinytest/config/render_html.R b/inst/tinytest/config/render_html.R new file mode 100644 index 0000000..15ff327 --- /dev/null +++ b/inst/tinytest/config/render_html.R @@ -0,0 +1 @@ +CONFIG$CERT_DOWNLOAD_AND_CONVERT <- FALSE \ No newline at end of file diff --git a/inst/tinytest/register/short.csv b/inst/tinytest/register/short.csv new file mode 100644 index 0000000..6b84697 --- /dev/null +++ b/inst/tinytest/register/short.csv @@ -0,0 +1,4 @@ +Certificate,Repository,Type,Venue,Issue +2021-010,osf::bdu28,conference,AGILEGIS,38 +2022-018,gitlab::cdchck/community-codechecks/2022-svaRetro-svaNUMT,journal,GigaByte,44 +2024-017,github::codecheckers/Inter_Noise2024_Codes_Acoustics_Diffusion_Equation,community,codecheck NL,133 diff --git a/inst/tinytest/test_render_html.R b/inst/tinytest/test_render_html.R new file mode 100644 index 0000000..8f68f9c --- /dev/null +++ b/inst/tinytest/test_render_html.R @@ -0,0 +1,23 @@ +tinytest::using(ttdo) + +test_path <- "register/short.csv" +test_register <- read.csv(test_path) + +register_render(register = test_register, filter_by = c(), outputs = c("html"), + config = c(system.file("extdata", "config.R", package = "codecheck"), + "config/render_html.R") + ) + +# file generation ---- +expect_true(file.exists(file.path("docs/index.html"))) +expect_true(file.exists(file.path("docs/certs/2024-017/index.html"))) +expect_false(file.exists(file.path("docs/certs/2024-017/cert.pdf"))) +expect_false(file.exists(file.path("docs/certs/2024-017/cert_20.png"))) + +expect_true(file.exists(file.path("docs/certs/2021-010/index.html"))) +expect_true(file.exists(file.path("docs/certs/2022-018/index.html"))) + +# TODO ---- + +# clean up +expect_equal(unlink("docs", recursive = TRUE), 0) diff --git a/inst/tinytest/test_render_json.R b/inst/tinytest/test_render_json.R new file mode 100644 index 0000000..828822c --- /dev/null +++ b/inst/tinytest/test_render_json.R @@ -0,0 +1,38 @@ +tinytest::using(ttdo) + +test_path <- "register/short.csv" +test_register <- read.csv(test_path) + +expect_silent({ capture.output( + { + table <- register_render(register = test_register, filter_by = c(), outputs = c("json")) + }, + type = "message" + ) + }) + +# file generation ---- +expect_true(file.exists(file.path("docs/register.json"))) +expect_true(file.exists(file.path("docs/featured.json"))) +expect_true(file.exists(file.path("docs/stats.json"))) + +# stats ---- +stats <- jsonlite::read_json("docs/stats.json") +expect_equal(stats$cert_count, nrow(test_register)) +expect_equal(stats$source, paste0(CONFIG$HREF_DETAILS$json$base_url, "register.json")) + +# featured ---- +featured <- jsonlite::read_json("docs/featured.json") +expect_true(length(featured) < CONFIG$FEATURED_COUNT) +expect_equal(stats$cert_count, length(featured)) +expect_equal(names(featured[[1]]), CONFIG$JSON_COLUMNS) +expect_equal(sapply(featured, "[[", "Certificate ID"), test_register$Certificate) + +# register ---- +register <- jsonlite::read_json("docs/register.json") +expect_equal(length(register), length(featured)) +expect_equal(names(register[[1]]), CONFIG$JSON_COLUMNS) +expect_equal(sapply(register, "[[", "Certificate ID"), test_register$Certificate) + +# clean up +expect_equal(unlink("docs", recursive = TRUE), 0) diff --git a/inst/tinytest/test_render_md.R b/inst/tinytest/test_render_md.R new file mode 100644 index 0000000..5a96d5c --- /dev/null +++ b/inst/tinytest/test_render_md.R @@ -0,0 +1,16 @@ +tinytest::using(ttdo) + +test_path <- "register/short.csv" +test_register <- read.csv(test_path) + +expect_silent({ register_render(register = test_register, filter_by = c(), outputs = c("md")) }) + +# file generation ---- +expect_true(file.exists("docs/register.md")) +content <- readLines("docs/register.md") +expect_true(grep("svaRetro and svaNUM", content) != 0) + +# TODO more tests ---- + +# clean up +expect_equal(unlink("docs", recursive = TRUE), 0) diff --git a/man/add_cert_links.Rd b/man/add_cert_links.Rd index 6ba05be..ddd9cb2 100644 --- a/man/add_cert_links.Rd +++ b/man/add_cert_links.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils_preprocess_register.R \name{add_cert_links} \alias{add_cert_links} -\title{Function for adding clickable links to the paper for each entry in the register table.} +\title{Function for adding clickable links to the paper for each entry in the register table and add certificate identifier and link as extra columns} \usage{ add_cert_links(register_table) } @@ -10,8 +10,8 @@ add_cert_links(register_table) \item{register_table}{The register table to be adjusted.} } \value{ -The adjusted register table with clickable Certificate links. +The adjusted register table with clickable Certificate links and new columns for certificate identifier and certificate URL } \description{ -Function for adding clickable links to the paper for each entry in the register table. +Function for adding clickable links to the paper for each entry in the register table and add certificate identifier and link as extra columns } diff --git a/man/convert_cert_pdf_to_jpeg.Rd b/man/convert_cert_pdf_to_png.Rd similarity index 82% rename from man/convert_cert_pdf_to_jpeg.Rd rename to man/convert_cert_pdf_to_png.Rd index 969dd2e..fe4aa1d 100644 --- a/man/convert_cert_pdf_to_jpeg.Rd +++ b/man/convert_cert_pdf_to_png.Rd @@ -1,13 +1,13 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/utils_download_certs.R, % R/utils_render_cert_htmls.R -\name{convert_cert_pdf_to_jpeg} -\alias{convert_cert_pdf_to_jpeg} +\name{convert_cert_pdf_to_png} +\alias{convert_cert_pdf_to_png} \title{Converts each page of a certificate PDF to JPEG format images, saving them in the specified certificate directory.} \usage{ -convert_cert_pdf_to_jpeg(cert_id) +convert_cert_pdf_to_png(cert_id) -convert_cert_pdf_to_jpeg(cert_id) +convert_cert_pdf_to_png(cert_id) } \arguments{ \item{cert_id}{The certificate identifier. This ID is used to locate the PDF and save the resulting images.} diff --git a/man/register_render.Rd b/man/register_render.Rd index 0e9686f..ff55eea 100644 --- a/man/register_render.Rd +++ b/man/register_render.Rd @@ -7,13 +7,16 @@ register_render( register = read.csv("register.csv", as.is = TRUE), filter_by = c("venues", "codecheckers"), - outputs = c("html", "md", "json") + outputs = c("html", "md", "json"), + config = c(system.file("extdata", "config.R", package = "codecheck")) ) } \arguments{ \item{register}{A `data.frame` with all required information for the register's view} \item{outputs}{The output formats to create} + +\item{config}{A list of configuration files to be sourced at the beginning of the rending process} } \value{ A `data.frame` of the register enriched with information from the configuration files of respective CODECHECKs from the online repositories diff --git a/man/render_register.Rd b/man/render_register.Rd index 3e3806e..81546d3 100644 --- a/man/render_register.Rd +++ b/man/render_register.Rd @@ -4,7 +4,7 @@ \alias{render_register} \title{Render Register in Specified Output Format} \usage{ -render_register(register_table, table_details, filter, output_type) +render_register(register_table, table_details, filter = NA, output_type) } \arguments{ \item{register_table}{The register table that needs to be rendered into different files.}