relaton-render 3.0.0.pre.alpha.23 → 3.0.0.pre.alpha.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.adoc +3 -0
- data/docs/citation-style-pack.adoc +367 -0
- data/lib/relaton/render/iso690/elements/extent.rb +3 -0
- data/lib/relaton/render/version.rb +1 -1
- data/lib/relaton-render.rb +0 -9
- metadata +2 -12
- data/lib/relaton/render/fields/date.rb +0 -48
- data/lib/relaton/render/fields/fields.rb +0 -266
- data/lib/relaton/render/legacy/citations.rb +0 -178
- data/lib/relaton/render/parse/parse.rb +0 -152
- data/lib/relaton/render/parse/parse_contributors.rb +0 -184
- data/lib/relaton/render/parse/parse_extract.rb +0 -200
- data/lib/relaton/render/parse/parse_id.rb +0 -128
- data/lib/relaton/render/template/hash_utils.rb +0 -64
- data/lib/relaton/render/template/liquid.rb +0 -48
- data/lib/relaton/render/template/subclasses.rb +0 -123
- data/lib/relaton/render/template/template.rb +0 -230
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ecdbfb0b1c82700b6c957c9eeb259fd48f48d391a35062b07e4d6d6ede4ccb2e
|
|
4
|
+
data.tar.gz: 199330b061ce3e07eb3edff0364ffc313773eb27cf6f7b8d0a216bff4caa3cac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f21d46a60631252c2011e73096ea2ff321fae8f8f361c9e8bc46b53709d304da350bac73ab3eb44cdf7c5a4ec6a35c74f10875aa5548e417fc9c66afc43a8693
|
|
7
|
+
data.tar.gz: 2fac8549403467928c30917f75e167fba771a3f175c5128d9c2a1daab37cb813cd29b1feb493746559c985df068b68306d9cdd2cd1cb5fb63b82e0e79445a150
|
data/README.adoc
CHANGED
|
@@ -100,3 +100,6 @@ Liquid templates described below for rendering: it is the hash of bibliographic
|
|
|
100
100
|
|
|
101
101
|
For the configuation YAML used in relaton-render, refer to https://relaton.org/specs/relaton-render
|
|
102
102
|
|
|
103
|
+
== Documentation
|
|
104
|
+
|
|
105
|
+
* link:docs/citation-style-pack.adoc[Defining a Citation Style: the pack format] — the authoritative spec for CitationStyle YAML packs: resource types, presentation patterns, model presentation templates, locale/punctuation, inheritance and conformance.
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
= Defining a Citation Style: the Pack Format
|
|
2
|
+
|
|
3
|
+
This document is the authoritative authoring specification for a
|
|
4
|
+
CitationStyle pack: the one file that fully describes a citation style.
|
|
5
|
+
It is the contract between three parties — style authors, the rendering
|
|
6
|
+
engine, and the relaton-models citation schema.
|
|
7
|
+
|
|
8
|
+
Status markers: **[impl]** shipped on this engine line; **[spec]** the
|
|
9
|
+
committed design this engine line converges to (tracked in the
|
|
10
|
+
promotion backlog, section 12).
|
|
11
|
+
|
|
12
|
+
== 1. The laws
|
|
13
|
+
|
|
14
|
+
1. **Models are ISO 690.** The relaton-models citation module
|
|
15
|
+
(`Relaton::Bib::Item` and friends) is the single data substrate for
|
|
16
|
+
every style. There are no LNCS models, no Chicago models. A
|
|
17
|
+
bibliographic item is parsed, stored and exchanged once.
|
|
18
|
+
2. **A citation style is one encapsulated data pack.** Everything a
|
|
19
|
+
style knows lives in the pack: the scheme (name forms, citation
|
|
20
|
+
system), the locale (labels, punctuation), the presentation
|
|
21
|
+
templates (citation, reference, per-type patterns), and the
|
|
22
|
+
presentation-of-models (how each 690 model element presents).
|
|
23
|
+
Nothing lives in flavor Ruby.
|
|
24
|
+
3. **The pack's field vocabulary is a superset of CSL-JSON.** Every
|
|
25
|
+
CSL-JSON term has a home; the standards-specific extensions CSL
|
|
26
|
+
lacks (designations/docids, typed stages, host relations, ordinal
|
|
27
|
+
editions, bilingual and CJK forms) extend it. The same is true of
|
|
28
|
+
the logic vocabulary (section 8): it supersets CSL's condition
|
|
29
|
+
grammar, not a general template engine.
|
|
30
|
+
4. **Engines hold zero styles.** The engine is a generic evaluator of
|
|
31
|
+
packs. Canonical packs (the ISO 690 default, LNCS, Chicago,
|
|
32
|
+
IEEE-SA) ship beside the engine while the vocabulary co-evolves and
|
|
33
|
+
extract to a data repository once it stabilises — the CSL precedent
|
|
34
|
+
being a separate styles distribution consumed by many processors.
|
|
35
|
+
5. **No Liquid.** The template language is the chunk grammar
|
|
36
|
+
(section 8): declarative, schema-validated, sandboxed, identical in
|
|
37
|
+
Ruby and relaton-ts. A fenced `procedural:` escape may exist for
|
|
38
|
+
experimental packs; canonical styles never reference it.
|
|
39
|
+
|
|
40
|
+
== 2. The pack file
|
|
41
|
+
|
|
42
|
+
One YAML document. **[impl]** Loaded and validated by the
|
|
43
|
+
CitationStyle model (`Relaton::Render::Iso690::Style.load` accepts a
|
|
44
|
+
path or a hash; unknown keys are rejected). **[spec]** The model
|
|
45
|
+
itself is owned by relaton-models' citation module; this engine loads
|
|
46
|
+
it, and relaton-ts loads its mirror.
|
|
47
|
+
|
|
48
|
+
Skeleton — every key, in order:
|
|
49
|
+
|
|
50
|
+
....
|
|
51
|
+
name: "ISO 690 (metanorma-iso flavour)"
|
|
52
|
+
family: iso690 # [spec] iso690 | lncs | chicago | ieee-sa
|
|
53
|
+
extends: null # [spec] name of a base pack this deltas
|
|
54
|
+
requires: # [spec] capability gates this pack needs
|
|
55
|
+
- extent_group_separator
|
|
56
|
+
|
|
57
|
+
scheme:
|
|
58
|
+
system: name-date # name-date | numeric | designation
|
|
59
|
+
shortFromReference: true
|
|
60
|
+
homeDocidType: [ISO, IEC] # docid types that mark a "home" standard
|
|
61
|
+
defaultKind: "" # kind for types the taxonomy leaves unmapped
|
|
62
|
+
nameForm: { ... } # section 7
|
|
63
|
+
locale: { ... } # section 6
|
|
64
|
+
|
|
65
|
+
templates: # style-wide templates, section 5
|
|
66
|
+
titleOpen: "_"
|
|
67
|
+
titleClose: "_"
|
|
68
|
+
citation: "{{surname}}, {{date}}"
|
|
69
|
+
reference: "{{creator}}. {{title}}. ..."
|
|
70
|
+
name: "{{surname}}, {{givenNames}}"
|
|
71
|
+
series: ""
|
|
72
|
+
creators: ""
|
|
73
|
+
uri: "<fmt-link target='{{uri}}'>{{uri}}</fmt-link>"
|
|
74
|
+
uriShort: ""
|
|
75
|
+
identifierMode: all # all | first
|
|
76
|
+
|
|
77
|
+
types: # [spec] section 4: the resource-type taxonomy
|
|
78
|
+
article-journal: { alias: continuing }
|
|
79
|
+
standard: { alias: report }
|
|
80
|
+
|
|
81
|
+
perType: # section 5: the presentation patterns
|
|
82
|
+
- type: report
|
|
83
|
+
home: true
|
|
84
|
+
template: "{{title}}"
|
|
85
|
+
title: "<span class='stddocTitle'>{{title}}</span>"
|
|
86
|
+
short: "{{title}}, {{extent}}"
|
|
87
|
+
- type: monograph
|
|
88
|
+
noPlace: true
|
|
89
|
+
fallbacks: { date: "n.d" }
|
|
90
|
+
template: "{{creator}}{{role}}. {{title}}. ..."
|
|
91
|
+
|
|
92
|
+
sortKey: # index sorting
|
|
93
|
+
- attribute: creator
|
|
94
|
+
- attribute: date
|
|
95
|
+
|
|
96
|
+
rules: # [spec] section 9: presentation-of-models
|
|
97
|
+
identifier: itu # named engine rule selections
|
|
98
|
+
creator: nist_series_publisher
|
|
99
|
+
|
|
100
|
+
postProcess: # [spec] ordered gsub rule chain
|
|
101
|
+
- pattern: "。+"
|
|
102
|
+
replace: "。"
|
|
103
|
+
....
|
|
104
|
+
|
|
105
|
+
== 3. Lifecycle
|
|
106
|
+
|
|
107
|
+
* **Adopt** — a flavor points its `bibrenderer` at a named canonical
|
|
108
|
+
pack. Zero code, zero YAML. The target state for new and generic
|
|
109
|
+
flavors.
|
|
110
|
+
* **Inherit-and-override** — **[spec]** `extends: <pack>` plus a delta.
|
|
111
|
+
The merge semantics are part of this specification (section 11):
|
|
112
|
+
`perType`/`types` merge per type key (a delta re-declaring `article`
|
|
113
|
+
never drops the base's `monograph`); `labels`, `punct`, `fallbacks`
|
|
114
|
+
and rule selections merge per key; scheme scalars replace. The
|
|
115
|
+
merge is deterministic and identical in Ruby and TS.
|
|
116
|
+
* **Own pack** — a fully self-contained instance. Last resort; the
|
|
117
|
+
existing flavor YAMLs are this, and most should collapse into deltas
|
|
118
|
+
over a canonical base.
|
|
119
|
+
|
|
120
|
+
**[spec] `requires:`** names engine capabilities, so a resolver fails
|
|
121
|
+
loudly (`pack requires extent_group_separator`) instead of silently
|
|
122
|
+
mis-rendering. Capability names are frozen per engine minor line.
|
|
123
|
+
|
|
124
|
+
== 4. Info-resource-types
|
|
125
|
+
|
|
126
|
+
Different information resource types present with different patterns
|
|
127
|
+
in nearly every citation style. The pack's type taxonomy is the axis
|
|
128
|
+
those patterns hang on.
|
|
129
|
+
|
|
130
|
+
**[impl]** The engine normalises a bibliographic item's wire `type`
|
|
131
|
+
value to an ISO 690 clause-8 resource *kind* through the Kinds table;
|
|
132
|
+
perType entries select on kinds. **[spec]** The taxonomy becomes pack
|
|
133
|
+
data (`types:`), aligned name-for-name with the CSL resource types —
|
|
134
|
+
the same superset law as the fields — with the standards extensions
|
|
135
|
+
CSL lacks.
|
|
136
|
+
|
|
137
|
+
.Kind taxonomy (ISO 690 clause 8) and its wire-type synonyms [impl]
|
|
138
|
+
[cols="1,3"]
|
|
139
|
+
|===
|
|
140
|
+
|Kind |Wire types
|
|
141
|
+
|
|
142
|
+
|`monograph` |book, booklet, manual, proceedings, thesis
|
|
143
|
+
|`report` |standard, techreport, report *(the clause 8.11 fallback)*
|
|
144
|
+
|`patent` |patent
|
|
145
|
+
|`continuing` |journal, serial, article-journal, article-magazine
|
|
146
|
+
|`component_part` |inbook, incollection, inproceedings
|
|
147
|
+
|`serial_part` |article
|
|
148
|
+
|`online` |software, unpublished, dataset, webpage, online
|
|
149
|
+
|`webdoc` |website, webresource
|
|
150
|
+
|===
|
|
151
|
+
|
|
152
|
+
**[spec]** The full recommended taxonomy carries every CSL type
|
|
153
|
+
(`article-journal`, `article-magazine`, `article-newspaper`, `bill`,
|
|
154
|
+
`book`, `broadcast`, `chapter`, `classic`, `collection`, `dataset`,
|
|
155
|
+
`document`, `entry`, `entry-dictionary`, `entry-encyclopedia`,
|
|
156
|
+
`event`, `figure`, `graphic`, `hearing`, `interview`, `legal_case`,
|
|
157
|
+
`legislation`, `manuscript`, `map`, `motion_picture`, `musical_score`,
|
|
158
|
+
`pamphlet`, `paper-conference`, `patent`, `performance`, `periodical`,
|
|
159
|
+
`personal_communication`, `post`, `post-weblog`, `regulation`,
|
|
160
|
+
`report`, `review`, `review-book`, `software`, `song`, `speech`,
|
|
161
|
+
`standard`, `statute`, `thesis`, `treaty`, `webpage`) plus the
|
|
162
|
+
relaton extensions (`techreport`, `inbook`, `incollection`,
|
|
163
|
+
`inproceedings`, `webresource`, `webdoc`, `online`). Rules of the
|
|
164
|
+
taxonomy:
|
|
165
|
+
|
|
166
|
+
* **Complete, explicit coverage.** Every type resolves to a declared
|
|
167
|
+
pattern — through an entry, an `alias`, or the declared `fallthrough`
|
|
168
|
+
(`report`). Nothing inherits silently.
|
|
169
|
+
* **Aliasing is declared**, never engine-hardcoded: `booklet: book`.
|
|
170
|
+
* **Home/external splits sit on top** — for standards-producing
|
|
171
|
+
bodies, the *same* type carries two patterns, selected by whether
|
|
172
|
+
the item bears one of `scheme.homeDocidType`'s designations.
|
|
173
|
+
IEEE-SA's `standard` pattern is *only* designation + title; a
|
|
174
|
+
Chicago `standard` is cited differently again — same type, different
|
|
175
|
+
packs, different patterns.
|
|
176
|
+
|
|
177
|
+
== 5. Presentation patterns (`perType`)
|
|
178
|
+
|
|
179
|
+
The pattern — not the template — is the unit. A journal-article
|
|
180
|
+
pattern is not a reordered book template; it is its own arrangement
|
|
181
|
+
(quoted title form, italic container, vol/no/pp placement,
|
|
182
|
+
month-abbreviated dates) *plus* its own short cite, fallbacks and
|
|
183
|
+
terminator behaviour. The perType entry carries all of it:
|
|
184
|
+
|
|
185
|
+
[cols="1,3"]
|
|
186
|
+
|===
|
|
187
|
+
|Field |Meaning
|
|
188
|
+
|
|
189
|
+
|`type` |the kind (or **[spec]** taxonomy type) this pattern serves
|
|
190
|
+
|`template` |the reference (bibliography entry) arrangement
|
|
191
|
+
|`title`, `series` |per-slot form overrides for this pattern
|
|
192
|
+
|`short` |the short-cite template (falls back to the reference in short mode)
|
|
193
|
+
|`home` |`true` marks the pattern serving items bearing a home docid; two entries of one type split on it
|
|
194
|
+
|`fallbacks` |absent-slot replacement texts, per slot (`date: "n.d"`, `dategroup: "(n.d.)"`)
|
|
195
|
+
|`noPlace` |render the locale's `no_place` label when production lacks a place
|
|
196
|
+
|===
|
|
197
|
+
|
|
198
|
+
Multiple entries of one `type` resolve: home-flagged variants split by
|
|
199
|
+
the home test; otherwise the first match wins; unmatched kinds fall to
|
|
200
|
+
`templates.reference`.
|
|
201
|
+
|
|
202
|
+
== 6. Locale, labels and punctuation
|
|
203
|
+
|
|
204
|
+
**[impl]** Packs overlay the engine language packs (`i18n/<lang>.yml`)
|
|
205
|
+
per language; the pack wins. Adding a language is a new language pack,
|
|
206
|
+
never code.
|
|
207
|
+
|
|
208
|
+
* `locale.and|others|noDate|noAuthor|in|at|availableAt` — connective
|
|
209
|
+
strings.
|
|
210
|
+
* `locale.labels` — arbitrary label overrides merged verbatim:
|
|
211
|
+
`and`, `oxford_comma`, `list_separator`, `series_no`, `no_place`,
|
|
212
|
+
`available_from`, `ed`/`eds`, `edition_ordinal`/`edition_cardinal`/
|
|
213
|
+
`version_cardinal` (locale templates, `{{ var1 }}` with the
|
|
214
|
+
`ordinal_word` filter), extent unit templates (`volume: "vol. %"`,
|
|
215
|
+
`page: "%頁"` — the `%` carries the value, so a CJK locale places
|
|
216
|
+
its unit after the number), `extent_group_separator`, month names.
|
|
217
|
+
* `locale.punct` — typographic punctuation: `production_sep`,
|
|
218
|
+
`production_order` (`publisher_first` for LNCS-style orders),
|
|
219
|
+
`open-paren`/`close-paren` (ASCII vs fullwidth), `cjk-latin-separator`,
|
|
220
|
+
`size-join`, `marker-space`.
|
|
221
|
+
* **[spec] `postProcess:`** — the CJK spacing rules that flavors
|
|
222
|
+
carry as Ruby today become ordered `pattern/replace` rule chains in
|
|
223
|
+
the pack, so bilingual typography travels with the style.
|
|
224
|
+
|
|
225
|
+
== 7. Name forms (`scheme.nameForm`) [impl]
|
|
226
|
+
|
|
227
|
+
Every knob of creator presentation:
|
|
228
|
+
|
|
229
|
+
[cols="1,3"]
|
|
230
|
+
|===
|
|
231
|
+
|Knob |Effect
|
|
232
|
+
|
|
233
|
+
|`initials`, `initialsSeparator`, `initialsPeriod` |initials vs given names, "A. B." vs "AB"
|
|
234
|
+
|`invertedAll`, `givenNameFirst` |surname-first for all names / direct order
|
|
235
|
+
|`surnameUpcase`, `subsequentSurnameUpcase`, `subsequentInitials` |caps and second-name forms
|
|
236
|
+
|`completenameUpcase`, `orgUpcase` |verbatim names and organisations
|
|
237
|
+
|`editorsMarked`, `loneEditorMarked`, `rolePlacement` |"(eds.)" markers and their placement
|
|
238
|
+
|`listStyle`, `creatorFallback` |join style; fallback source when no personal creator (OGC: `publisher_abbrev`)
|
|
239
|
+
|`etalCount`, `etalDisplay` |bibliography et-al truncation
|
|
240
|
+
|`inTextEtalCount`, `inTextEtalDisplay` |in-text et-al truncation
|
|
241
|
+
|===
|
|
242
|
+
|
|
243
|
+
== 8. The template language
|
|
244
|
+
|
|
245
|
+
**[impl]** Templates are chunk strings: `{{slot}}` fields and literal
|
|
246
|
+
text. The evaluator carries the segment-join semantics — a literal
|
|
247
|
+
renders when it separates two present fields, so absent elements
|
|
248
|
+
swallow their separators; leading and trailing literals drop with
|
|
249
|
+
their fields; parenthetical literals (`({{series}})`, `({{series}})`)
|
|
250
|
+
pair as groups that drop whole when the field is absent, balanced on
|
|
251
|
+
the template's literal parens alone; stacked separators collapse;
|
|
252
|
+
trailing terminators apply per style. The short-cite evaluator splits
|
|
253
|
+
after the leading field run at the first-biblio delimiter, which the
|
|
254
|
+
presentation layer turns into the cross-reference capsule.
|
|
255
|
+
|
|
256
|
+
Slots resolve to the 690 model presentations: `creator`, `title`,
|
|
257
|
+
`edition`, `medium`, `series`, `production`, `date`, `numeration`,
|
|
258
|
+
`component_part`, `identifier`, `location`, `size`, `extent`,
|
|
259
|
+
`access`, `stddoc`, `status`, `citeid`, `authorizer`, `updated`;
|
|
260
|
+
derived fields `role`, `dategroup` (the parenthesised date group),
|
|
261
|
+
`disambiguateddate` (the batch-suffixed date, "2022a"); and the name
|
|
262
|
+
fields (`surname`, `givenNames`, ...).
|
|
263
|
+
|
|
264
|
+
**[spec]** The logic vocabulary supersets CSL's condition grammar:
|
|
265
|
+
|
|
266
|
+
* **Conditionals** — `choose`/`if`/`else-if` over `type`, field
|
|
267
|
+
presence, `home`, and `disambiguated` ( CSL `position`-adjacent ),
|
|
268
|
+
as declarative blocks inside `perType` entries and templates.
|
|
269
|
+
* **Fallback chains** — `creator: [authors, publisher_abbrev]`:
|
|
270
|
+
first present source wins, replacing today's single `creatorFallback`
|
|
271
|
+
knob and OGC's hack.
|
|
272
|
+
* No loops, no arbitrary filters, no string mutation — those are
|
|
273
|
+
`postProcess` rules or named rules, never template logic.
|
|
274
|
+
|
|
275
|
+
== 9. Model presentation templates (`rules`) — presentation-of-models
|
|
276
|
+
|
|
277
|
+
Each 690 model element has a declarative presentation vocabulary; the
|
|
278
|
+
pack selects per-slot rule implementations by name. **[impl]** the
|
|
279
|
+
declarative surface (extent unit `%`-templates, production orders,
|
|
280
|
+
group separators, locale templates, fallbacks); **[spec]** the
|
|
281
|
+
registry: engine implements each named rule once, conformance-tested
|
|
282
|
+
per rule, mirrored in relaton-ts, and addressable as pack data —
|
|
283
|
+
`identifier: itu`, `creator: nist_series_publisher`.
|
|
284
|
+
|
|
285
|
+
The promotion backlog — every flavor element override still standing
|
|
286
|
+
is a rule to promote:
|
|
287
|
+
|
|
288
|
+
[cols="2,2"]
|
|
289
|
+
|===
|
|
290
|
+
|Flavor override |Becomes rule
|
|
291
|
+
|
|
292
|
+
|`ItuIdentifier` |`identifier: itu`
|
|
293
|
+
|`NistIdentifier`, `NistCreator`, `NistDate`, `SerialDate`, `NistSeries`, `NistComponentPart`, `NistPublisher`, `Draft` |the NIST author-year rule set
|
|
294
|
+
|`IeeeIdentifier`, `IeeeComponentPart`, `IeeeAccess`, `IeeeMedium` |the IEEE-SA rule set (designation-first standards)
|
|
295
|
+
|`BipmCreator`, `BipmComponentPart`, `BipmProduction`, `BipmExtent`, `BipmMedium`, `BipmEdition`, `BipmVolume` |the BIPM rule set
|
|
296
|
+
|`IhoEdition`, `IhoCreator` |affiliation-composite creators
|
|
297
|
+
|`JisComponentPart`, `JisSeries`, `JisExtent` |the JIS host-citation rules
|
|
298
|
+
|`BsiStatus` |status presentation
|
|
299
|
+
|===
|
|
300
|
+
|
|
301
|
+
== 10. Citation forms
|
|
302
|
+
|
|
303
|
+
**[impl]** The renderings capsule every pack produces (the isodoc
|
|
304
|
+
contract): `author`, `date`, `citation{full, default, short,
|
|
305
|
+
author_date, author_date_br, author, date, reference_tag, title,
|
|
306
|
+
title_reference_tag}`, `formattedref`. `templates.citation` is the
|
|
307
|
+
in-text form; `shortFromReference` takes the reference form with the
|
|
308
|
+
first-biblio marker; batch disambiguation suffixes derive from
|
|
309
|
+
author+date collisions; `identifierMode` governs `default` (first vs
|
|
310
|
+
all designations). **[spec]** `system: numeric | designation` selects
|
|
311
|
+
numeric `[1]`/`[B4]` and designation-led citation systems — the
|
|
312
|
+
IEEE-SA and JIS/BSI homes — as first-class engines, not author-date
|
|
313
|
+
approximations.
|
|
314
|
+
|
|
315
|
+
== 11. Deltas and the flavor triangle
|
|
316
|
+
|
|
317
|
+
**[spec]** `extends` resolves base-then-delta at load, on model
|
|
318
|
+
instances (never ad-hoc hash merges):
|
|
319
|
+
|
|
320
|
+
* `perType`, `types`: merge **per type key** — a delta's `article`
|
|
321
|
+
entry overlays the base's; the base's other entries survive.
|
|
322
|
+
* `labels`, `punct`, `fallbacks`: per-key merge.
|
|
323
|
+
* `nameForm` knobs, `templates.*`, rule selections: replace.
|
|
324
|
+
* `sortKey`, `requires`: union.
|
|
325
|
+
|
|
326
|
+
The forcing test: PLATEAU's four near-copy styles (document-language
|
|
327
|
+
x item-language quadrants) collapse to `extends: jis` plus two
|
|
328
|
+
punct/label deltas. If the merge cannot express that, the merge is
|
|
329
|
+
wrong.
|
|
330
|
+
|
|
331
|
+
== 12. Validation, versioning, conformance
|
|
332
|
+
|
|
333
|
+
* **Schema** — the CitationStyle model validates every pack; unknown
|
|
334
|
+
keys fail at load, not at render. [impl]
|
|
335
|
+
* **`requires:`** — capability gating, frozen names per engine minor
|
|
336
|
+
line. [spec]
|
|
337
|
+
* **Conformance corpora** — every canonical pack ships a corpus of
|
|
338
|
+
examples with expected renderings, in the iso690-test tradition:
|
|
339
|
+
LNCS from Springer's authors' instructions; Chicago from CMOS;
|
|
340
|
+
IEEE-SA from the Standards Style Manual clause 17 (`[B1] ASME
|
|
341
|
+
BPVC-I-2004, Title.` designation-only standards; Chicago-derived
|
|
342
|
+
books/articles with only the first name inverted). CI renders the
|
|
343
|
+
matrix: every declared type, every pattern, both engine ports.
|
|
344
|
+
* **Portability & safety** — packs are data: they validate, sandbox
|
|
345
|
+
and render identically server-side (the CF Workers API) and in
|
|
346
|
+
relaton-ts. No interpreters, no Liquid, no flavor Ruby.
|
|
347
|
+
|
|
348
|
+
== 13. Authoring walkthrough (LNCS, abridged)
|
|
349
|
+
|
|
350
|
+
. Declare the pack: `family: lncs`, `extends: null` (canonical),
|
|
351
|
+
`requires: [production_order, extent_units]`.
|
|
352
|
+
. Name forms: initials without periods, `invertedAll`, direct-order
|
|
353
|
+
subsequent names, `creatorFallback: [publisher_abbrev]` for
|
|
354
|
+
standards with no personal authors.
|
|
355
|
+
. Locale: `production_order: publisher_first`, `production_sep: ", "`,
|
|
356
|
+
year trailing in parentheses (the `dategroup` form).
|
|
357
|
+
. Types and patterns: `paper-conference` ("`{{creator}}: {{title}}.
|
|
358
|
+
In: {{componentpart}} {{extent}} {{production}} {{dategroup}}.`"),
|
|
359
|
+
`chapter`, `article-journal`, `book`, `thesis`, `webpage` — one
|
|
360
|
+
entry each, own `title`/`series` forms, own `short` cites.
|
|
361
|
+
. Rules: `identifier: lncs-series` (LNCS vol./pp. forms).
|
|
362
|
+
. Conformance: the Springer instruction examples become the corpus;
|
|
363
|
+
the pack merges only when the matrix is green.
|
|
364
|
+
|
|
365
|
+
The same walk with CMOS examples yields Chicago; with the IEEE-SA
|
|
366
|
+
manual, `family: ieee-sa` — whose `standard` pattern is two fields
|
|
367
|
+
long.
|
data/lib/relaton-render.rb
CHANGED
|
@@ -9,14 +9,5 @@ module Relaton
|
|
|
9
9
|
# single-item API raises, the batch API skips
|
|
10
10
|
class Unrenderable < StandardError; end
|
|
11
11
|
|
|
12
|
-
# Deprecated 1.x engine leaves, restored so flavor gems that still
|
|
13
|
-
# subclass them load against this line. Superseded by the Iso690
|
|
14
|
-
# engine; removed when the flavors have migrated to CitationStyle
|
|
15
|
-
# instances. Referencing a constant loads its tree on demand.
|
|
16
|
-
autoload :Parse, "relaton/render/parse/parse"
|
|
17
|
-
autoload :Fields, "relaton/render/fields/fields"
|
|
18
|
-
autoload :Date, "relaton/render/fields/date"
|
|
19
|
-
autoload :Template, "relaton/render/template/template"
|
|
20
|
-
autoload :Citations, "relaton/render/legacy/citations"
|
|
21
12
|
end
|
|
22
13
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-render
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.0.pre.alpha.
|
|
4
|
+
version: 3.0.0.pre.alpha.25
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -113,9 +113,8 @@ files:
|
|
|
113
113
|
- bin/console
|
|
114
114
|
- bin/rspec
|
|
115
115
|
- bin/setup
|
|
116
|
+
- docs/citation-style-pack.adoc
|
|
116
117
|
- lib/relaton-render.rb
|
|
117
|
-
- lib/relaton/render/fields/date.rb
|
|
118
|
-
- lib/relaton/render/fields/fields.rb
|
|
119
118
|
- lib/relaton/render/general.rb
|
|
120
119
|
- lib/relaton/render/iso690.rb
|
|
121
120
|
- lib/relaton/render/iso690/element.rb
|
|
@@ -157,15 +156,6 @@ files:
|
|
|
157
156
|
- lib/relaton/render/iso690/style/type_template.rb
|
|
158
157
|
- lib/relaton/render/iso690/styles/author-date.yml
|
|
159
158
|
- lib/relaton/render/iso690/template.rb
|
|
160
|
-
- lib/relaton/render/legacy/citations.rb
|
|
161
|
-
- lib/relaton/render/parse/parse.rb
|
|
162
|
-
- lib/relaton/render/parse/parse_contributors.rb
|
|
163
|
-
- lib/relaton/render/parse/parse_extract.rb
|
|
164
|
-
- lib/relaton/render/parse/parse_id.rb
|
|
165
|
-
- lib/relaton/render/template/hash_utils.rb
|
|
166
|
-
- lib/relaton/render/template/liquid.rb
|
|
167
|
-
- lib/relaton/render/template/subclasses.rb
|
|
168
|
-
- lib/relaton/render/template/template.rb
|
|
169
159
|
- lib/relaton/render/version.rb
|
|
170
160
|
- relaton-render.gemspec
|
|
171
161
|
homepage: https://github.com/relaton/relaton-render
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
module Relaton
|
|
2
|
-
module Render
|
|
3
|
-
class Date
|
|
4
|
-
def initialize(date, options)
|
|
5
|
-
@date = date
|
|
6
|
-
@r = options[:renderer]
|
|
7
|
-
@type = options[:type]
|
|
8
|
-
@bibitem = options[:bibitem]
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def render
|
|
12
|
-
return @date if @date.nil? || /^\d+$/.match?(@date)
|
|
13
|
-
|
|
14
|
-
render1(granularity)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# @r.date is using document language setting, not citation-specific
|
|
18
|
-
def render1(format)
|
|
19
|
-
datef = dateparse(format, @r.lang.to_sym)
|
|
20
|
-
case @r.date[format]
|
|
21
|
-
when "to_full_s", "to_long_s", "to_medium_s", "to_short_s"
|
|
22
|
-
datef.send @r.date[format]
|
|
23
|
-
else
|
|
24
|
-
datef.to_additional_s(@r.date[format])
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def granularity
|
|
29
|
-
case @date
|
|
30
|
-
when /^\d+-\d+$/ then "month_year"
|
|
31
|
-
when /^\d+-\d+-\d+$/ then "day_month_year"
|
|
32
|
-
else "date_time"
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def dateparse(format, lang)
|
|
37
|
-
case format
|
|
38
|
-
when "date_time"
|
|
39
|
-
DateTime.parse(@date).localize(lang, timezone: "Zulu")
|
|
40
|
-
when "day_month_year"
|
|
41
|
-
DateTime.parse(@date).localize(lang, timezone: "Zulu").to_date
|
|
42
|
-
when "month_year"
|
|
43
|
-
DateTime.parse("#{@date}-01").localize(lang, timezone: "Zulu").to_date
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|