Skip to content

Commit 9abb368

Browse files
committed
feat(packages): additions and generations for Cite, CiteGroup and Reference nodes
1 parent 5803cab commit 9abb368

25 files changed

Lines changed: 1581 additions & 12 deletions

File tree

docs/schema/block.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
Union of all block content types.
77

88

9-
Union of: @oxa:code, @oxa:heading, @oxa:paragraph, @oxa:thematicbreak
9+
Union of: @oxa:code, @oxa:heading, @oxa:paragraph, @oxa:reference, @oxa:thematicbreak

docs/schema/cite.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
(oxa:cite)=
2+
3+
## Cite
4+
5+
6+
An inline citation to a bibliographic reference.
7+
8+
9+
__type__: _string_, ("Cite")
10+
11+
: The type discriminator for Cite nodes.
12+
13+
__id__: __string__
14+
15+
: A unique identifier for the node.
16+
17+
__classes__: __array__ ("string")
18+
19+
: A list of class names for styling or semantics.
20+
21+
__data__: __object__
22+
23+
: Arbitrary key-value data attached to the node.
24+
25+
__xref__: __string__
26+
27+
: Reference to the id of a Reference node in the containing document.
28+
29+
__children__: __array__ ("Inline")
30+
31+
: Optional inline content that overrides generated citation display text.
32+
: See @oxa:inline
33+
34+
__prefix__: __array__ ("Inline")
35+
36+
: Inline content preceding the citation within its group.
37+
: See @oxa:inline
38+
39+
__suffix__: __array__ ("Inline")
40+
41+
: Inline content following the citation within its group.
42+
: See @oxa:inline
43+
44+
__display__: _string_, ("author" | "date" | "full")
45+
46+
: Controls which part of the referenced bibliographic record is rendered.
47+
48+
__locator__: __string__
49+
50+
: A human-readable locator within the referenced work.
51+
52+
__url__: __string__
53+
54+
: A deep link to a specific location in the referenced work.
55+
56+
__intent__: __string__
57+
58+
: The citation intent, typically using a CiTO vocabulary value.
59+
60+
### Example
61+
62+
`````{tab-set}
63+
````{tab-item} OXA
64+
:sync: oxa
65+
```json
66+
{"type":"Cite","xref":"jones2022","prefix":[{"type":"Text","value":"see "}],"locator":"fig. 3","intent":"extends"}
67+
```
68+
````
69+
70+
````{tab-item} Markdown
71+
:sync: markdown
72+
```markdown
73+
[@jones2022]
74+
```
75+
````
76+
77+
````{tab-item} HTML
78+
:sync: html
79+
```html
80+
<a href="#jones2022" role="doc-biblioref">see Jones, 2022, fig. 3</a>
81+
```
82+
````
83+
84+
````{tab-item} JATS
85+
:sync: jats
86+
```xml
87+
<xref ref-type="bibr" rid="jones2022">see Jones, 2022, fig. 3</xref>
88+
```
89+
````
90+
91+
`````

docs/schema/citegroup.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
(oxa:citegroup)=
2+
3+
## CiteGroup
4+
5+
6+
An inline container that groups citations with shared display semantics.
7+
8+
9+
__type__: _string_, ("CiteGroup")
10+
11+
: The type discriminator for CiteGroup nodes.
12+
13+
__id__: __string__
14+
15+
: A unique identifier for the node.
16+
17+
__classes__: __array__ ("string")
18+
19+
: A list of class names for styling or semantics.
20+
21+
__data__: __object__
22+
23+
: Arbitrary key-value data attached to the node.
24+
25+
__kind__: _string_, ("narrative" | "parenthetical")
26+
27+
: The citation display style shared by the group.
28+
29+
__children__: __array__ ("Cite")
30+
31+
: The citations in the group.
32+
: See @oxa:cite
33+
34+
### Example
35+
36+
`````{tab-set}
37+
````{tab-item} OXA
38+
:sync: oxa
39+
```json
40+
{"type":"CiteGroup","kind":"parenthetical","children":[{"type":"Cite","xref":"jones2022"},{"type":"Cite","xref":"smith2021"}]}
41+
```
42+
````
43+
44+
````{tab-item} Markdown
45+
:sync: markdown
46+
```markdown
47+
[@jones2022; @smith2021]
48+
```
49+
````
50+
51+
````{tab-item} HTML
52+
:sync: html
53+
```html
54+
<span role="doc-biblioref">(Jones, 2022; Smith, 2021)</span>
55+
```
56+
````
57+
58+
````{tab-item} JATS
59+
:sync: jats
60+
```xml
61+
<xref ref-type="bibr" rid="jones2022">Jones, 2022</xref>; <xref ref-type="bibr" rid="smith2021">Smith, 2021</xref>
62+
```
63+
````
64+
65+
`````

docs/schema/inline.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
Union of all inline content types.
77

88

9-
Union of: @oxa:text, @oxa:emphasis, @oxa:inlinecode, @oxa:strong, @oxa:subscript, @oxa:superscript
9+
Union of: @oxa:cite, @oxa:citegroup, @oxa:text, @oxa:emphasis, @oxa:inlinecode, @oxa:strong, @oxa:subscript, @oxa:superscript

docs/schema/reference.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
(oxa:reference)=
2+
3+
## Reference
4+
5+
6+
A block-level bibliographic record.
7+
8+
9+
__type__: _string_, ("Reference")
10+
11+
: The type discriminator for Reference nodes.
12+
13+
__id__: __string__
14+
15+
: A unique identifier for the node, used by Cite xref values.
16+
17+
__classes__: __array__ ("string")
18+
19+
: A list of class names for styling or semantics.
20+
21+
__data__: __object__
22+
23+
: Arbitrary key-value data attached to the node.
24+
25+
__children__: __array__ ("Inline")
26+
27+
: Optional inline content for the rendered display of this reference.
28+
: See @oxa:inline
29+
30+
__csl__: __object__
31+
32+
: A CSL-JSON item object for the bibliographic record.
33+
34+
### Example
35+
36+
`````{tab-set}
37+
````{tab-item} OXA
38+
:sync: oxa
39+
```json
40+
{"type":"Reference","id":"jones2022","children":[{"type":"Text","value":"Jones and Chen (2022)."}],"csl":{"id":"jones2022","citation-key":"jones2022","type":"article-journal","title":"A Framework for Open Science","author":[{"given":"Alice","family":"Jones"},{"given":"Bob","family":"Chen"}],"issued":{"date-parts":[[2022]]}}}
41+
```
42+
````
43+
44+
````{tab-item} HTML
45+
:sync: html
46+
```html
47+
<div id="jones2022" role="doc-biblioentry">Jones and Chen (2022).</div>
48+
```
49+
````
50+
51+
````{tab-item} JATS
52+
:sync: jats
53+
```xml
54+
<ref id="jones2022"><element-citation publication-type="journal"><article-title>A Framework for Open Science</article-title></element-citation></ref>
55+
```
56+
````
57+
58+
`````

lexicon/blocks/defs.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,41 @@
109109
}
110110
}
111111
},
112+
"reference": {
113+
"type": "object",
114+
"description": "A block-level bibliographic record.",
115+
"properties": {
116+
"id": {
117+
"type": "string"
118+
},
119+
"classes": {
120+
"type": "array",
121+
"items": {
122+
"type": "string"
123+
}
124+
},
125+
"data": {
126+
"type": "unknown"
127+
},
128+
"text": {
129+
"type": "string"
130+
},
131+
"facets": {
132+
"type": "array",
133+
"items": {
134+
"type": "ref",
135+
"ref": "pub.oxa.richtext.facet"
136+
}
137+
},
138+
"csl": {
139+
"type": "unknown"
140+
}
141+
},
142+
"required": [
143+
"id",
144+
"csl"
145+
]
146+
},
112147
"thematicBreak": {
113148
"type": "object",
114149
"description": "A thematic or structural division between sections of content.",
@@ -134,6 +169,7 @@
134169
"#code",
135170
"#heading",
136171
"#paragraph",
172+
"#reference",
137173
"#thematicBreak"
138174
]
139175
}

lexicon/richtext/facet.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
"type": "union",
2121
"closed": false,
2222
"refs": [
23+
"#cite",
24+
"#citeGroup",
2325
"#emphasis",
2426
"#inlineCode",
2527
"#strong",
@@ -48,6 +50,51 @@
4850
}
4951
}
5052
},
53+
"cite": {
54+
"type": "object",
55+
"description": "An inline citation to a bibliographic reference.",
56+
"properties": {
57+
"xref": {
58+
"type": "string"
59+
},
60+
"display": {
61+
"type": "string",
62+
"knownValues": [
63+
"author",
64+
"date",
65+
"full"
66+
]
67+
},
68+
"locator": {
69+
"type": "string"
70+
},
71+
"url": {
72+
"type": "string"
73+
},
74+
"intent": {
75+
"type": "string"
76+
}
77+
},
78+
"required": [
79+
"xref"
80+
]
81+
},
82+
"citeGroup": {
83+
"type": "object",
84+
"description": "An inline container that groups citations with shared display semantics.",
85+
"properties": {
86+
"kind": {
87+
"type": "string",
88+
"knownValues": [
89+
"narrative",
90+
"parenthetical"
91+
]
92+
}
93+
},
94+
"required": [
95+
"kind"
96+
]
97+
},
5198
"emphasis": {
5299
"type": "object",
53100
"description": "Emphasized content (typically italicized)."
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"$schema": "../../schemas/test-case.schema.json",
3+
"title": "Basic reference",
4+
"description": "A bibliographic reference with CSL-JSON data",
5+
"category": "block",
6+
"formats": {
7+
"oxa": {
8+
"type": "Reference",
9+
"id": "jones2022",
10+
"children": [{ "type": "Text", "value": "Jones and Chen (2022)." }],
11+
"csl": {
12+
"id": "jones2022",
13+
"citation-key": "jones2022",
14+
"type": "article-journal",
15+
"title": "A Framework for Open Science",
16+
"author": [
17+
{ "given": "Alice", "family": "Jones" },
18+
{ "given": "Bob", "family": "Chen" }
19+
],
20+
"issued": { "date-parts": [[2022]] }
21+
}
22+
},
23+
"html": "<div id=\"jones2022\" role=\"doc-biblioentry\">Jones and Chen (2022).</div>",
24+
"jats": "<ref id=\"jones2022\"><element-citation publication-type=\"journal\"><article-title>A Framework for Open Science</article-title></element-citation></ref>"
25+
}
26+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "../../schemas/test-case.schema.json",
3+
"title": "Basic citation",
4+
"description": "A citation to a reference by id with prefix and locator metadata",
5+
"category": "inline",
6+
"formats": {
7+
"oxa": {
8+
"type": "Cite",
9+
"xref": "jones2022",
10+
"prefix": [{ "type": "Text", "value": "see " }],
11+
"locator": "fig. 3",
12+
"intent": "extends"
13+
},
14+
"markdown": "[@jones2022]",
15+
"html": "<a href=\"#jones2022\" role=\"doc-biblioref\">see Jones, 2022, fig. 3</a>",
16+
"jats": "<xref ref-type=\"bibr\" rid=\"jones2022\">see Jones, 2022, fig. 3</xref>"
17+
},
18+
"notes": {
19+
"markdown": "Markdown citation syntax does not preserve all OXA citation metadata without extensions"
20+
}
21+
}

0 commit comments

Comments
 (0)