Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style syntax for related variables #375

Open
wants to merge 13 commits into
base: v1.1
Choose a base branch
from
12 changes: 9 additions & 3 deletions schemas/styles/csl-choose.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ div {

## When specifying conditions, we allow either the attribute syntax or the element-based one.
choose.condition =
(condition.atts, match?)
| element cs:conditions { match?, condition.elem+ }
(condition.atts, relation, match?)
| element cs:conditions { match?, relation, condition.elem+ }
denismaier marked this conversation as resolved.
Show resolved Hide resolved
choose.if = element cs:if { choose.condition, rendering-element* }
choose.else-if =
element cs:else-if { choose.condition, rendering-element* }
choose.else = element cs:else { rendering-element+ }

## This element allows for more complex conditional logic; for
## example, if you need to specify mixed "match" rules.
condition.elem = element cs:condition { match?, condition.atts }
condition.elem =
element cs:condition { match?, relation, condition.atts }
condition.atts =
(condition.atts.simple+, condition.atts.complex?)
| condition.atts.complex
Expand All @@ -30,6 +31,11 @@ div {
## otherwise identical citations. This attempt at disambiguation is only
## made after all other disambiguation methods have failed.
[ a:defaultValue = "true" ] attribute disambiguate { "true" }
|
## Tests whether the item has the given relation.
attribute has-relation {
list { relations+ }
}
|
## Tests whether the given variables contain numeric text.
attribute is-numeric {
Expand Down
22 changes: 18 additions & 4 deletions schemas/styles/csl.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ div {
attribute variable {
list { variables.names+ }
},
relation,
affixes,

## Specify the delimiter for name lists of name variables rendered by
Expand Down Expand Up @@ -690,6 +691,7 @@ div {
date.form,
rendering-element.date.date-part.localized*)
| (rendering-element.date.date-part.non-localized+, delimiter)),
relation,
affixes,
display,
font-formatting,
Expand Down Expand Up @@ -777,10 +779,12 @@ div {
## Specify verbatim text.
attribute value { text }
| ((attribute variable { variables.numbers | variables.strings },
[ a:defaultValue = "long" ] attribute form { "short" | "long" })
[ a:defaultValue = "long" ] attribute form { "short" | "long" },
relation)
| (attribute variable { variables.titles },
[ a:defaultValue = "long" ]
attribute form { "short" | "long" | "sub" | "main" })?)
attribute form { "short" | "long" | "sub" | "main" },
relation)?)
}
# ==============================================================================

Expand All @@ -803,7 +807,10 @@ div {
## Number forms: "numeric" ("4"), "ordinal" ("4th"), "long-ordinal"
## ("fourth"), "roman" ("iv").
[ a:defaultValue = "numeric" ]
attribute form { "numeric" | "ordinal" | "long-ordinal" | "roman" }?
attribute form {
"numeric" | "ordinal" | "long-ordinal" | "roman"
}?,
relation
}
# ==============================================================================

Expand Down Expand Up @@ -846,7 +853,8 @@ div {
delimiter,
display,
font-formatting,
rendering-element+
rendering-element+,
relation
}
group.attributes = notAllowed?
}
Expand Down Expand Up @@ -1136,6 +1144,12 @@ div {
always-render = attribute always-render { xsd:boolean }?
}

## Select a related-variable
div {
relation = attribute relation { relations }?
denismaier marked this conversation as resolved.
Show resolved Hide resolved
relations = "original" | "reviewed"
}

## Formatting attributes.
div {
affixes =
Expand Down