Skip to content

Commit

Permalink
feat(Cite): Add content field to Cite schema
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-ketch committed Aug 13, 2019
1 parent 80ec4fb commit e7826cb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions py/stencila/schema/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Cite(Entity):

target: str
citationMode: Optional["Enum0"]
content: Optional[Array["InlineContent"]]
pageEnd: Optional[Union[str, int]]
pageStart: Optional[Union[str, int]]
pagination: Optional[str]
Expand All @@ -49,6 +50,7 @@ def __init__(
self,
target: str,
citationMode: Optional["Enum0"] = None,
content: Optional[Array["InlineContent"]] = None,
id: Optional[str] = None,
meta: Optional[Dict[str, Any]] = None,
pageEnd: Optional[Union[str, int]] = None,
Expand All @@ -65,6 +67,8 @@ def __init__(
self.target = target
if citationMode is not None:
self.citationMode = citationMode
if content is not None:
self.content = content
if pageEnd is not None:
self.pageEnd = pageEnd
if pageStart is not None:
Expand Down
3 changes: 3 additions & 0 deletions r/R/types.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Entity <- function(
#' @name Cite
#' @param target The target of the citation (URL or reference ID). \bold{Required}.
#' @param citationMode How the cite is rendered in the surrounding text.
#' @param content Optional structured content/text of this citation.
#' @param id The identifier for this item.
#' @param meta Metadata associated with this item.
#' @param pageEnd The page on which the work ends; for example "138" or "xvi".
Expand All @@ -39,6 +40,7 @@ Entity <- function(
Cite <- function(
target,
citationMode,
content,
id,
meta,
pageEnd,
Expand All @@ -54,6 +56,7 @@ Cite <- function(
self$type <- as_scalar("Cite")
self[["target"]] <- check_property("Cite", "target", TRUE, missing(target), "character", target)
self[["citationMode"]] <- check_property("Cite", "citationMode", FALSE, missing(citationMode), Enum("normal", "suppressAuthor"), citationMode)
self[["content"]] <- check_property("Cite", "content", FALSE, missing(content), Array("InlineContent"), content)
self[["pageEnd"]] <- check_property("Cite", "pageEnd", FALSE, missing(pageEnd), Union("character", "numeric"), pageEnd)
self[["pageStart"]] <- check_property("Cite", "pageStart", FALSE, missing(pageStart), Union("character", "numeric"), pageStart)
self[["pagination"]] <- check_property("Cite", "pagination", FALSE, missing(pagination), "character", pagination)
Expand Down
6 changes: 6 additions & 0 deletions schema/Cite.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ properties:
enum:
- normal
- suppressAuthor
content:
'@id': stencila:content
description: Optional structured content/text of this citation.
type: array
items:
$ref: InlineContent
pageStart:
'@id': schema:pageStart
description: The page on which the work starts; for example "135" or "xiii".
Expand Down

0 comments on commit e7826cb

Please sign in to comment.