Skip to content

Commit f4e8e77

Browse files
committed
version information could be read as cells or as keyvalue data
1 parent d6222f7 commit f4e8e77

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

R/read.R

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,23 @@ read_data <- function(drfile, guide, checkname = FALSE) {
286286
}
287287

288288
# Validate template version
289-
validate_template_version(result$cells$.template$version, guide)
289+
if (exists("cells", where = result)) {
290+
if (exists(".template", where = result$cells)) {
291+
if (exists("version", where = result$cells$.template)) {
292+
validate_template_version(result$cells$.template$version, guide)
293+
}
294+
}
295+
} else {
296+
if (exists("keyvalue", where = result)) {
297+
if (exists(".template", where = result$keyvalue)) {
298+
if (exists("version", where = result$keyvalue$.template)) {
299+
validate_template_version(result$keyvalue$.template$version, guide)
300+
}
301+
}
302+
} else {
303+
rlang::abort("Variable '.template$version' not found under cells or keyvalue variables")
304+
}
305+
}
290306

291307
# Check template name if required
292308
if (checkname && guide$template.name != result$template.metadata$template.name) {

0 commit comments

Comments
 (0)