Skip to content

Commit

Permalink
fix empty ref links
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiWaldrant committed Nov 21, 2024
1 parent 5efd48d commit fd73837
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
2 changes: 1 addition & 1 deletion results/_include/_dataset_descriptions.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ lines <- pmap_chr(dataset_info, function(dataset_name, dataset_summary, dataset_
strip_margin(glue::glue("
|### {dataset_link}
|
|{summ} {ref}.
|{summ}{ref}.
|
|{dataset_description %|% ''}
|"))
Expand Down
28 changes: 16 additions & 12 deletions results/_include/_method_descriptions.qmd
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
```{r method_description}
#| echo: false
# show each method just once
lines <- pmap_chr(method_info %>% filter(!is_baseline), function(method_name, method_summary, method_description, references_doi, references_bibtex, code_url, implementation_url, ...) {
lines <- pmap_chr(method_info %>% filter(!is_baseline), function(method_name, method_summary, method_description, code_url, implementation_url, ...) {
rest <- list(...)
image <- pluck(rest, "image", .default = NULL)
documentation_url <- pluck(rest, "documentation_url", .default = NULL)
code_version <- pluck(rest, "code_version", .default = NULL)
references_doi <- pluck(rest, "references_doi", .default = NULL)
references_bibtex <- pluck(rest, "references_bibtex", .default = NULL)
if ("paper_reference" %in% names(rest)) {
ref <- split_cite_fun(rest$paper_reference)
if (ref != "") ref <- paste0(" ", ref)
} else {
bibs <- c()
if (!is.null(references_doi)) {
if (!is.null(references_doi) && !is.na(references_doi)) {
bibs <- get_bibtex_from_doi(references_doi)
}
if (!is.null(references_bibtex)) {
if (!is.null(references_bibtex) && !is.na(references_bibtex)) {
bibs <- c(bibs, references_bibtex)
}
# Write new entries to library.bib
write_library(bibs)
write_library(bibs)
# Get bibtex references
if (!is.null(bibs)) {
ref <- get_bibtex_entries(bibs)
} else {
ref <- ""
}
}
# Get bibtex references
ref <- get_bibtex_entries(bibs)
}
if (ref != "") ref <- paste0(" ", ref)
links <- c()
if (!is.na(code_url)) {
links <- c(links, glue::glue(" [Docs]({code_url})"))
Expand All @@ -35,8 +40,7 @@ lines <- pmap_chr(method_info %>% filter(!is_baseline), function(method_name, me
} else {
""
}
# ref <- split_cite_fun(paper_reference)
# if (ref != "") ref <- paste0(" ", ref)
links_label <-
if (length(links) > 0) {
glue::glue(" Links: {paste(links, collapse = ', ')}.")
Expand Down Expand Up @@ -64,7 +68,7 @@ lines <- pmap_chr(method_info %>% filter(!is_baseline), function(method_name, me
|
|{meta_list}
|
|{summ} {ref}
|{summ}{ref}
|
|{method_description %|% ''}
|"
Expand Down
21 changes: 14 additions & 7 deletions results/_include/_metric_descriptions.qmd
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
```{r metric_descriptions}
#| echo: false
lines <- pmap_chr(metric_info, function(metric_name, metric_summary, metric_description, references_doi, references_bibtex, implementation_url, code_version, ...) {
lines <- pmap_chr(metric_info, function(metric_name, metric_summary, metric_description, implementation_url, code_version, ...) {
rest <- list(...)
image <- pluck(rest, "image", .default = NULL)
code_version <- pluck(rest, "code_version", .default = NULL)
references_doi <- pluck(rest, "references_doi", .default = NULL)
references_bibtex <- pluck(rest, "references_bibtex", .default = NULL)
if ("paper_reference" %in% names(rest)) {
ref <- split_cite_fun(rest$paper_reference)
if (ref != "") ref <- paste0(" ", ref)
} else {
bibs <- c()
if (!is.null(references_doi)) {
if (!is.null(references_doi) && !is.na(references_doi)) {
bibs <- get_bibtex_from_doi(references_doi)
}
if (!is.null(references_bibtex)) {
if (!is.null(references_bibtex) && !is.na(references_bibtex)) {
bibs <- c(bibs, references_bibtex)
}
# Write new entries to library.bib
write_library(bibs)
# Get bibtex references
ref <- get_bibtex_entries(bibs)
}
if (!is.null(bibs)) {
ref <- get_bibtex_entries(bibs)
} else {
ref <- ""
}
}
if (ref != "") ref <- paste0(" ", ref)
summ <- (metric_summary %|% "Missing 'metric_summary'") %>% str_replace_all("\\n", " ") %>% str_replace_all("\\. *$", "")
Expand All @@ -41,7 +48,7 @@ lines <- pmap_chr(metric_info, function(metric_name, metric_summary, metric_desc
|
|{meta_list}
|
|{summ} {ref}.
|{summ}{ref}.
|
|{metric_description %|% ''}
|"))
Expand Down

0 comments on commit fd73837

Please sign in to comment.