Skip to content

Commit

Permalink
fix dataset descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Jan 23, 2025
1 parent eda3705 commit e2a0162
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions results/_include/_dataset_descriptions.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,30 @@ lines <- pmap_chr(dataset_info, function(dataset_id, dataset_name, dataset_summa
}
# Make file_size human readable
if (!is.null(file_size)) {
file_size_str <- format(
structure(file_size, class = "object_size"),
units = "auto",
standard = "IEC",
digits = 2
)
}
file_size_str <-
if (is.na(file_size) || is.null(file_size)) {
NULL
} else {
format(
structure(file_size, class = "object_size"),
units = "auto",
standard = "IEC",
digits = 2
)
}
dataset_meta <- tribble(
~icon, ~value,
"bi bi-link-45deg", if(!is.null(dataset_link)) paste0("[Source dataset](", dataset_link, ")") else NULL,
"bi bi-box-arrow-up-right", if(!is.null(data_url)) paste0("[Data source](", data_url, ")") else NULL,
"bi bi-calendar", if(!is.null(date_created)) paste0(date_created) else NULL,
"bi bi-file-earmark-text", if(!is.null(file_size)) file_size_str else NULL,
"bi bi-file-earmark-text", file_size_str,
) %>% filter(!sapply(value, is.null))
meta_list <- paste(
paste0("<i class=\"", dataset_meta$icon, "\"></i> ", dataset_meta$value),
collapse = " · "
)
paste0("<i class=\"", dataset_meta$icon, "\"></i> ", dataset_meta$value),
collapse = " · "
)
summ <- (dataset_summary %|% "Missing 'dataset_summary'") %>% str_replace_all("\\n", " ") %>% str_replace_all("\\. *$", "")
Expand All @@ -65,4 +68,4 @@ lines <- pmap_chr(dataset_info, function(dataset_id, dataset_name, dataset_summa
|"))
})
knitr::asis_output(paste(lines, collapse = "\n"))
```
```

0 comments on commit e2a0162

Please sign in to comment.