diff --git a/py/stencila/schema/types.py b/py/stencila/schema/types.py index 40b628cf92..1e7816b5f8 100644 --- a/py/stencila/schema/types.py +++ b/py/stencila/schema/types.py @@ -112,6 +112,12 @@ class Cite(Entity): citationMode: Optional["ECitationMode"] = None """Determines how the citation is shown within the surrounding text.""" + citationPrefix: Optional[str] = None + """Text to show before the citation.""" + + citationSuffix: Optional[str] = None + """Text to show after the citation.""" + content: Optional[Array["InlineContent"]] = None """Optional structured content/text of this citation.""" @@ -126,25 +132,19 @@ class Cite(Entity): for example, "1-6, 9, 55". """ - prefix: Optional[str] = None - """Text to show before the citation.""" - - suffix: Optional[str] = None - """Text to show after the citation.""" - def __init__( self, target: str, citationMode: Optional["ECitationMode"] = None, + citationPrefix: Optional[str] = None, + citationSuffix: Optional[str] = None, content: Optional[Array["InlineContent"]] = None, id: Optional[str] = None, meta: Optional[Dict[str, Any]] = None, pageEnd: Optional[Union[int, str]] = None, pageStart: Optional[Union[int, str]] = None, - pagination: Optional[str] = None, - prefix: Optional[str] = None, - suffix: Optional[str] = None + pagination: Optional[str] = None ) -> None: super().__init__( id=id, @@ -154,6 +154,10 @@ def __init__( self.target = target if citationMode is not None: self.citationMode = citationMode + if citationPrefix is not None: + self.citationPrefix = citationPrefix + if citationSuffix is not None: + self.citationSuffix = citationSuffix if content is not None: self.content = content if pageEnd is not None: @@ -162,10 +166,6 @@ def __init__( self.pageStart = pageStart if pagination is not None: self.pagination = pagination - if prefix is not None: - self.prefix = prefix - if suffix is not None: - self.suffix = suffix class CiteGroup(Entity): diff --git a/r/R/types.R b/r/R/types.R index 16f286f1ad..12ee1622f9 100644 --- a/r/R/types.R +++ b/r/R/types.R @@ -90,28 +90,28 @@ BooleanValidator <- function( #' @name Cite #' @param target The target of the citation (URL or reference ID). \bold{Required}. #' @param citationMode Determines how the citation is shown within the surrounding text. +#' @param citationPrefix Text to show before the citation. +#' @param citationSuffix Text to show after the citation. #' @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". #' @param pageStart The page on which the work starts; for example "135" or "xiii". #' @param pagination Any description of pages that is not separated into pageStart and pageEnd; for example, "1-6, 9, 55". -#' @param prefix Text to show before the citation. -#' @param suffix Text to show after the citation. #' @return A `list` of class `Cite` #' @seealso \code{\link{Entity}} #' @export Cite <- function( target, citationMode, + citationPrefix, + citationSuffix, content, id, meta, pageEnd, pageStart, - pagination, - prefix, - suffix + pagination ){ self <- Entity( id = id, @@ -120,12 +120,12 @@ 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("Parenthetical", "Narrative", "NarrativeAuthor", "NarrativeYear", "normal", "suppressAuthor"), citationMode) + self[["citationPrefix"]] <- check_property("Cite", "citationPrefix", FALSE, missing(citationPrefix), "character", citationPrefix) + self[["citationSuffix"]] <- check_property("Cite", "citationSuffix", FALSE, missing(citationSuffix), "character", citationSuffix) self[["content"]] <- check_property("Cite", "content", FALSE, missing(content), Array(InlineContent), content) self[["pageEnd"]] <- check_property("Cite", "pageEnd", FALSE, missing(pageEnd), Union("numeric", "character"), pageEnd) self[["pageStart"]] <- check_property("Cite", "pageStart", FALSE, missing(pageStart), Union("numeric", "character"), pageStart) self[["pagination"]] <- check_property("Cite", "pagination", FALSE, missing(pagination), "character", pagination) - self[["prefix"]] <- check_property("Cite", "prefix", FALSE, missing(prefix), "character", prefix) - self[["suffix"]] <- check_property("Cite", "suffix", FALSE, missing(suffix), "character", suffix) class(self) <- c(class(self), "Cite") self } diff --git a/schema/Cite.schema.yaml b/schema/Cite.schema.yaml index 7b87f2d547..86849ec3d7 100644 --- a/schema/Cite.schema.yaml +++ b/schema/Cite.schema.yaml @@ -61,14 +61,20 @@ properties: Any description of pages that is not separated into pageStart and pageEnd; for example, "1-6, 9, 55". type: string - prefix: + citationPrefix: '@id': stencila:citationPrefix description: Text to show before the citation. type: string - suffix: + $comment: | + Previously this was name `prefix` but for consistency with `citationMode` + and `honorificPrefix`, to avoid ambiguity with other prefixes was renamed + to `citationPrefix`. + citationSuffix: '@id': stencila:citationSuffix description: Text to show after the citation. type: string + $comment: | + See comment on `citationPrefix` regarding naming. target: '@id': stencila:target description: The target of the citation (URL or reference ID).