Skip to content

Commit

Permalink
catch cases where description is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Feb 14, 2024
1 parent f6e52fe commit 2e64019
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/common/helper_functions/read_api_files.R
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,28 @@ render_file <- function(spec) {
spec$info$label <- basename(spec$info$example)
}

example <-
if (is.null(spec$info$example) || is.na(spec$info$example)) {
""
} else {
paste0("Example file: `", spec$info$example, "`")
}

description <-
if (is.null(spec$info$description) || is.na(spec$info$description)) {
""
} else {
paste0("Description:\n\n", spec$info$description)
}

strip_margin(glue::glue("
§## File format: {spec$info$label}
§
§{spec$info$summary %||% ''}
§
§Example file: `{spec$info$example %|% '<Missing>'}`
§
§Description:
§{example}
§
§{spec$info$description %||% ''}
§{description}
§
§Format:
§
Expand Down

0 comments on commit 2e64019

Please sign in to comment.