This function processes monthly Cristin data to generate HTML content and metadata files for web display. It uses htmltools to construct interactive HTML elements (e.g., buttons, articles) for each publication, and optionally writes markdown files with frontmatter for further processing.

CristinWeb(
  monthlies,
  sdg.data = NULL,
  sdg.path = NULL,
  archive.url = NULL,
  local.storage = NULL,
  user.cards = TRUE,
  md.path = "",
  md.save = FALSE,
  use.multisession = FALSE,
  min.multisession = 25,
  n.workers = NULL,
  handler = "cli",
  restore.defaults = FALSE,
  full.update = FALSE,
  lang = "nn",
  silent = FALSE,
  log = list()
)

Arguments

monthlies

Data containing monthly information from Cristin.

sdg.data

Data containing information about Sustainable Development Goals (SDGs). Default is NULL.

sdg.path

Path to SDG images. Default is NULL.

archive.url

Relative URL to the archive. Default is NULL.

local.storage

Path to the local storage directory. Default is NULL.

user.cards

Logical, indicating whether to update user information from INN. Default is TRUE.

md.path

Path to output markdown files. Default is an empty string (current directory).

md.save

Logical, indicating whether to save the markdown files to disk. Default is FALSE.

use.multisession

Logical. If TRUE, parallel processing using multisession is employed; otherwise, processing is sequential. Default is FALSE.

min.multisession

Minimum number of results for using multisession. Default is 25.

n.workers

Optional integer for the number of workers to be used in multisession mode. If NULL, it defaults to the number of available cores minus one (with a minimum of one).

handler

The progress handler to be used by the progressr package. Default is "cli".

restore.defaults

Logical. If TRUE, the current future plan is saved and restored upon exit. Default is FALSE.

full.update

Logical, indicating whether to perform a full update of user information from INN. Default is FALSE.

lang

Language for localization ("nb", "nn", "no", or "en"). Defaults to "nn". If lang is set to "no", it is internally converted to "nn". Any language not in c("nb", "nn", "no") is set to "en".

silent

Logical, indicating whether to suppress log messages. Default is FALSE.

log

List to store log messages. Default is an empty list.

Value

A list containing two elements:

results

A tibble with metadata and HTML content (as generated by htmltools) for each publication.

log

A log of processing messages.

Details

This function is typically used with CristinMonthly to convert monthly publication data into HTML components and markdown files with frontmatter metadata. The function leverages htmltools to programmatically build HTML elements such as articles and buttons for links to additional publication information.

Examples

# \donttest{
  # Create monthlies for unit 209.5.10.0
  example <- CristinMonthly(
    c2z::Zotero(
      id = "4827927",
      api = "Io1bwAiOjB1jPgUNegjJhJxF",
      user = FALSE
    ),
    unit.id = "209.5.10.0",
    start.date = "2023-07",
    post = TRUE,
    silent = TRUE,
    use.citeproc = FALSE
  )
#> Error in if (count == 1) singularis else pluralis: argument is of length zero
  # Generate HTML and markdown files
  if (any(nrow(example$monthlies))) {
    # Generate HTML and markdown files
    example.web <- CristinWeb(
      example$monthlies,
      user.cards = FALSE
    )

    # Print the three first publication titles (if any)
    if (!is.null(example$monthlies)) {
      example$monthlies |>
        dplyr::select(title) |>
        print(n = 3, width = 80)
    }
  }
#> Error in example$monthlies: object of type 'closure' is not subsettable
# }