Skip to content
This repository has been archived by the owner on Jan 27, 2022. It is now read-only.

Commit

Permalink
fix(Table, Figure, CodeChunk): Narrow caption to BlockContent falling…
Browse files Browse the repository at this point in the history
… back to string
  • Loading branch information
nokome committed Apr 12, 2021
1 parent fdd6b04 commit 4acc3ba
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions py/stencila/schema/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class CodeChunk(CodeBlock):
assigns: Optional[Array[Union[str, "Variable"]]] = None
"""Variables that the code chunk assigns to."""

caption: Optional[Union[str, Array["Node"]]] = None
caption: Optional[Union[Array["BlockContent"], str]] = None
"""A caption for the CodeChunk."""

declares: Optional[Array[Union[str, "Variable", "Function"]]] = None
Expand Down Expand Up @@ -303,7 +303,7 @@ def __init__(
text: str,
alters: Optional[Array[str]] = None,
assigns: Optional[Array[Union[str, "Variable"]]] = None,
caption: Optional[Union[str, Array["Node"]]] = None,
caption: Optional[Union[Array["BlockContent"], str]] = None,
declares: Optional[Array[Union[str, "Variable", "Function"]]] = None,
duration: Optional[float] = None,
errors: Optional[Array["CodeError"]] = None,
Expand Down Expand Up @@ -1519,7 +1519,7 @@ class Figure(CreativeWork):
and labels for them.
"""

caption: Optional[Union[str, Array["Node"]]] = None
caption: Optional[Union[Array["BlockContent"], str]] = None
"""A caption for the figure."""

label: Optional[str] = None
Expand All @@ -1531,7 +1531,7 @@ def __init__(
about: Optional[Array["Thing"]] = None,
alternateNames: Optional[Array[str]] = None,
authors: Optional[Array[Union["Person", "Organization"]]] = None,
caption: Optional[Union[str, Array["Node"]]] = None,
caption: Optional[Union[Array["BlockContent"], str]] = None,
comments: Optional[Array["Comment"]] = None,
content: Optional[Array["Node"]] = None,
dateAccepted: Optional["Date"] = None,
Expand Down Expand Up @@ -3570,7 +3570,7 @@ class Table(CreativeWork):
"""Rows of cells in the table.
"""

caption: Optional[Union[str, Array["Node"]]] = None
caption: Optional[Union[Array["BlockContent"], str]] = None
"""A caption for the table."""

label: Optional[str] = None
Expand All @@ -3583,7 +3583,7 @@ def __init__(
about: Optional[Array["Thing"]] = None,
alternateNames: Optional[Array[str]] = None,
authors: Optional[Array[Union["Person", "Organization"]]] = None,
caption: Optional[Union[str, Array["Node"]]] = None,
caption: Optional[Union[Array["BlockContent"], str]] = None,
comments: Optional[Array["Comment"]] = None,
content: Optional[Array["Node"]] = None,
dateAccepted: Optional["Date"] = None,
Expand Down
6 changes: 3 additions & 3 deletions r/R/types.R
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ CodeChunk <- function(
self$type <- as_scalar("CodeChunk")
self[["alters"]] <- check_property("CodeChunk", "alters", FALSE, missing(alters), Array("character"), alters)
self[["assigns"]] <- check_property("CodeChunk", "assigns", FALSE, missing(assigns), Array(Union("character", Variable)), assigns)
self[["caption"]] <- check_property("CodeChunk", "caption", FALSE, missing(caption), Union("character", Array(Node)), caption)
self[["caption"]] <- check_property("CodeChunk", "caption", FALSE, missing(caption), Union(Array(BlockContent), "character"), caption)
self[["declares"]] <- check_property("CodeChunk", "declares", FALSE, missing(declares), Array(Union("character", Variable, Function)), declares)
self[["duration"]] <- check_property("CodeChunk", "duration", FALSE, missing(duration), "numeric", duration)
self[["errors"]] <- check_property("CodeChunk", "errors", FALSE, missing(errors), Array(CodeError), errors)
Expand Down Expand Up @@ -1719,7 +1719,7 @@ Figure <- function(
version = version
)
self$type <- as_scalar("Figure")
self[["caption"]] <- check_property("Figure", "caption", FALSE, missing(caption), Union("character", Array(Node)), caption)
self[["caption"]] <- check_property("Figure", "caption", FALSE, missing(caption), Union(Array(BlockContent), "character"), caption)
self[["label"]] <- check_property("Figure", "label", FALSE, missing(label), "character", label)
class(self) <- c(class(self), "Figure")
self
Expand Down Expand Up @@ -3937,7 +3937,7 @@ Table <- function(
)
self$type <- as_scalar("Table")
self[["rows"]] <- check_property("Table", "rows", TRUE, missing(rows), Array(TableRow), rows)
self[["caption"]] <- check_property("Table", "caption", FALSE, missing(caption), Union("character", Array(Node)), caption)
self[["caption"]] <- check_property("Table", "caption", FALSE, missing(caption), Union(Array(BlockContent), "character"), caption)
self[["label"]] <- check_property("Table", "label", FALSE, missing(label), "character", label)
class(self) <- c(class(self), "Table")
self
Expand Down
4 changes: 2 additions & 2 deletions schema/CodeChunk.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ properties:
An array of nodes or, to be compatible with https://schema.org/caption,
a string.
anyOf:
- type: string
- type: array
items:
$ref: Node
$ref: BlockContent
- type: string
label:
'@id': stencila:label
description: A short label for the CodeChunk.
Expand Down
4 changes: 2 additions & 2 deletions schema/Figure.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ properties:
An array of nodes or, to be compatible with https://schema.org/caption,
a string.
anyOf:
- type: string
- type: array
items:
$ref: Node
$ref: BlockContent
- type: string
label:
'@id': stencila:label
description: A short label for the figure.
Expand Down
4 changes: 2 additions & 2 deletions schema/Table.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ properties:
An array of nodes or, to be compatible with https://schema.org/caption,
a string.
anyOf:
- type: string
- type: array
items:
$ref: Node
$ref: BlockContent
- type: string
label:
'@id': stencila:label
description: A short label for the table.
Expand Down

0 comments on commit 4acc3ba

Please sign in to comment.