relaton 3.0.6 → 3.0.8

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.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/bin/relaton +20 -0
  3. data/lib/relaton/bib/model/docidentifier.rb +17 -2
  4. data/lib/relaton/bibcollection.rb +146 -0
  5. data/lib/relaton/bibdata.rb +92 -0
  6. data/lib/relaton/bipm/data_outcomes_parser.rb +6 -1
  7. data/lib/relaton/cli/base_convertor.rb +134 -0
  8. data/lib/relaton/cli/command.rb +390 -0
  9. data/lib/relaton/cli/data_fetcher.rb +20 -0
  10. data/lib/relaton/cli/frontend/dist/404.html +18 -0
  11. data/lib/relaton/cli/frontend/dist/app.iife.js +1 -0
  12. data/lib/relaton/cli/frontend/dist/style.css +3 -0
  13. data/lib/relaton/cli/frontend/index.html +14 -0
  14. data/lib/relaton/cli/frontend/package-lock.json +2945 -0
  15. data/lib/relaton/cli/frontend/package.json +29 -0
  16. data/lib/relaton/cli/frontend/public/404.html +18 -0
  17. data/lib/relaton/cli/frontend/src/App.test.ts +501 -0
  18. data/lib/relaton/cli/frontend/src/App.vue +506 -0
  19. data/lib/relaton/cli/frontend/src/app.ts +90 -0
  20. data/lib/relaton/cli/frontend/src/components/DocumentDetail.test.ts +142 -0
  21. data/lib/relaton/cli/frontend/src/components/DocumentDetail.vue +228 -0
  22. data/lib/relaton/cli/frontend/src/components/DocumentRow.vue +88 -0
  23. data/lib/relaton/cli/frontend/src/components/Icon.test.ts +44 -0
  24. data/lib/relaton/cli/frontend/src/components/Icon.vue +55 -0
  25. data/lib/relaton/cli/frontend/src/components/Pagination.vue +26 -0
  26. data/lib/relaton/cli/frontend/src/dev/main.ts +100 -0
  27. data/lib/relaton/cli/frontend/src/dev/sample-data.json +71 -0
  28. data/lib/relaton/cli/frontend/src/lib/filter.test.ts +88 -0
  29. data/lib/relaton/cli/frontend/src/lib/filter.ts +95 -0
  30. data/lib/relaton/cli/frontend/src/lib/hydrate.test.ts +102 -0
  31. data/lib/relaton/cli/frontend/src/lib/hydrate.ts +55 -0
  32. data/lib/relaton/cli/frontend/src/lib/shards.test.ts +319 -0
  33. data/lib/relaton/cli/frontend/src/lib/shards.ts +183 -0
  34. data/lib/relaton/cli/frontend/src/lib/types.ts +148 -0
  35. data/lib/relaton/cli/frontend/src/lib/url.test.ts +151 -0
  36. data/lib/relaton/cli/frontend/src/lib/url.ts +111 -0
  37. data/lib/relaton/cli/frontend/src/shims-vue.d.ts +5 -0
  38. data/lib/relaton/cli/frontend/src/styles/index.css +27 -0
  39. data/lib/relaton/cli/frontend/src/test/fetch.ts +58 -0
  40. data/lib/relaton/cli/frontend/tsconfig.json +20 -0
  41. data/lib/relaton/cli/frontend/vite.config.ts +42 -0
  42. data/lib/relaton/cli/frontend/vitest.config.ts +11 -0
  43. data/lib/relaton/cli/frontend_assets.rb +58 -0
  44. data/lib/relaton/cli/full_text_search.rb +98 -0
  45. data/lib/relaton/cli/i18n.yaml +1 -0
  46. data/lib/relaton/cli/index_item_normalizer.rb +380 -0
  47. data/lib/relaton/cli/index_site_generator.rb +1015 -0
  48. data/lib/relaton/cli/relaton_file.rb +290 -0
  49. data/lib/relaton/cli/subcommand_collection.rb +263 -0
  50. data/lib/relaton/cli/subcommand_db.rb +81 -0
  51. data/lib/relaton/cli/templates/_document.liquid +111 -0
  52. data/lib/relaton/cli/templates/_index.liquid +61 -0
  53. data/lib/relaton/cli/templates/index/page.liquid +20 -0
  54. data/lib/relaton/cli/templates/index-style.css +1017 -0
  55. data/lib/relaton/cli/util.rb +8 -0
  56. data/lib/relaton/cli/version.rb +11 -0
  57. data/lib/relaton/cli/xml_convertor.rb +47 -0
  58. data/lib/relaton/cli/xml_to_html_renderer.rb +117 -0
  59. data/lib/relaton/cli/yaml_convertor.rb +102 -0
  60. data/lib/relaton/cli.rb +113 -0
  61. data/lib/relaton/doi/CLAUDE.md +1 -1
  62. data/lib/relaton/element_finder.rb +29 -0
  63. data/lib/relaton/gb/CLAUDE.md +1 -1
  64. data/lib/relaton/ietf/CLAUDE.md +1 -1
  65. data/lib/relaton/iho/CLAUDE.md +3 -3
  66. data/lib/relaton/iho/bibliography.rb +41 -27
  67. data/lib/relaton/iho/processor.rb +3 -2
  68. data/lib/relaton/nist/CLAUDE.md +11 -1
  69. data/lib/relaton/nist/README.adoc +7 -1
  70. data/lib/relaton/nist/hit_collection.rb +25 -1
  71. data/lib/relaton/nist/mods_parser.rb +32 -8
  72. data/lib/relaton/nist/pubs_export.rb +69 -11
  73. data/lib/relaton/ogc/CLAUDE.md +1 -1
  74. data/lib/relaton/omg/CLAUDE.md +1 -1
  75. data/lib/relaton/plateau/CLAUDE.md +1 -1
  76. data/lib/relaton/render/general.rb +319 -0
  77. data/lib/relaton/render/iso690/csl_import.rb +129 -0
  78. data/lib/relaton/render/iso690/element.rb +153 -0
  79. data/lib/relaton/render/iso690/elements/access.rb +44 -0
  80. data/lib/relaton/render/iso690/elements/authorizer.rb +45 -0
  81. data/lib/relaton/render/iso690/elements/citeid.rb +39 -0
  82. data/lib/relaton/render/iso690/elements/component_part.rb +97 -0
  83. data/lib/relaton/render/iso690/elements/creator.rb +267 -0
  84. data/lib/relaton/render/iso690/elements/edition.rb +97 -0
  85. data/lib/relaton/render/iso690/elements/extent.rb +71 -0
  86. data/lib/relaton/render/iso690/elements/identifier.rb +46 -0
  87. data/lib/relaton/render/iso690/elements/location.rb +73 -0
  88. data/lib/relaton/render/iso690/elements/medium.rb +32 -0
  89. data/lib/relaton/render/iso690/elements/numeration.rb +26 -0
  90. data/lib/relaton/render/iso690/elements/production.rb +111 -0
  91. data/lib/relaton/render/iso690/elements/pub_date.rb +63 -0
  92. data/lib/relaton/render/iso690/elements/series.rb +66 -0
  93. data/lib/relaton/render/iso690/elements/size.rb +45 -0
  94. data/lib/relaton/render/iso690/elements/status.rb +30 -0
  95. data/lib/relaton/render/iso690/elements/stddoc.rb +40 -0
  96. data/lib/relaton/render/iso690/elements/title.rb +56 -0
  97. data/lib/relaton/render/iso690/elements/updated.rb +38 -0
  98. data/lib/relaton/render/iso690/elements.rb +67 -0
  99. data/lib/relaton/render/iso690/fields.rb +142 -0
  100. data/lib/relaton/render/iso690/i18n/en.yml +48 -0
  101. data/lib/relaton/render/iso690/i18n/fr.yml +14 -0
  102. data/lib/relaton/render/iso690/i18n/ja.yml +38 -0
  103. data/lib/relaton/render/iso690/i18n.rb +83 -0
  104. data/lib/relaton/render/iso690/identifier_kinds.rb +29 -0
  105. data/lib/relaton/render/iso690/index_renderer.rb +57 -0
  106. data/lib/relaton/render/iso690/kinds.rb +53 -0
  107. data/lib/relaton/render/iso690/renderer.rb +150 -0
  108. data/lib/relaton/render/iso690/rules/bipm.rb +186 -0
  109. data/lib/relaton/render/iso690/rules/jis.rb +103 -0
  110. data/lib/relaton/render/iso690/rules/nist.rb +384 -0
  111. data/lib/relaton/render/iso690/rules.rb +227 -0
  112. data/lib/relaton/render/iso690/style/locale.rb +59 -0
  113. data/lib/relaton/render/iso690/style/name_form.rb +87 -0
  114. data/lib/relaton/render/iso690/style/scheme.rb +33 -0
  115. data/lib/relaton/render/iso690/style/sort_rule.rb +25 -0
  116. data/lib/relaton/render/iso690/style/template_map.rb +40 -0
  117. data/lib/relaton/render/iso690/style/type_template.rb +45 -0
  118. data/lib/relaton/render/iso690/style.rb +227 -0
  119. data/lib/relaton/render/iso690/styles/apa.yml +45 -0
  120. data/lib/relaton/render/iso690/styles/author-date.yml +31 -0
  121. data/lib/relaton/render/iso690/styles/chicago.yml +49 -0
  122. data/lib/relaton/render/iso690/styles/ieee-sa.yml +45 -0
  123. data/lib/relaton/render/iso690/styles/jis-en.yml +68 -0
  124. data/lib/relaton/render/iso690/styles/jis-ja.yml +67 -0
  125. data/lib/relaton/render/iso690/styles/lncs.yml +54 -0
  126. data/lib/relaton/render/iso690/styles/mla.yml +56 -0
  127. data/lib/relaton/render/iso690/template.rb +248 -0
  128. data/lib/relaton/render/iso690.rb +28 -0
  129. data/lib/relaton/render/version.rb +5 -0
  130. data/lib/relaton/un/CLAUDE.md +1 -1
  131. data/lib/relaton/version.rb +1 -1
  132. data/lib/relaton-cli.rb +17 -0
  133. data/lib/relaton-render.rb +13 -0
  134. metadata +192 -21
@@ -0,0 +1,227 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Relaton
4
+ module Render
5
+ module Iso690
6
+ # The named-rule registry: presentation-of-models implementations
7
+ # the engine ships once, addressable from pack data as
8
+ # rules: { slot: rule_name }. Flavors migrate their ELEMENTS maps
9
+ # onto registered rules; nothing references a flavor class.
10
+ module Rules
11
+ # The bare status: unparenthesized, no label ("Recommendation")
12
+ class BareStatus < Elements::Status
13
+ def render
14
+ stage.to_s
15
+ end
16
+ end
17
+
18
+ # The IEEE-SA identifiers: DOI and ISBN carry their kind label
19
+ # with a colon ("DOI: https://doi.org/…")
20
+ class IeeeIdentifier < Elements::Identifier
21
+ private
22
+
23
+ def render_id(docidentifier)
24
+ return "#{docidentifier.type}: #{docidentifier.content}" if
25
+ %w[DOI ISBN].include?(docidentifier.type)
26
+
27
+ super
28
+ end
29
+ end
30
+
31
+ # The IEEE component part: "in Pellegrini, A. D., and P. K.
32
+ # Smith (eds.): <em>host</em>, production" — the names first,
33
+ # the eds marker in the close paren, the host title after the
34
+ # colon, the production after a comma
35
+ class IeeeComponentPart < Elements::ComponentPart
36
+ def render
37
+ h = host or return ""
38
+ out = +"in #{host_person_names(h)} (#{eds_label(h)}): "
39
+ out += host_title.to_s
40
+ production = Elements::Production
41
+ .new(h, style: @style, i18n: @i18n).render.to_s
42
+ out += ", #{production}" unless production.empty?
43
+ out
44
+ end
45
+
46
+ private
47
+
48
+ def host_editors(h)
49
+ Array(h.contributor).select { |c| has_role?(c, "editor") }
50
+ end
51
+
52
+ def eds_label(h)
53
+ @i18n.label(host_editors(h).one? ? "ed" : "eds")
54
+ end
55
+
56
+ # The IEEE host form: the first editor inverted, subsequent
57
+ # editors direct
58
+ def host_person_names(h)
59
+ host_editors(h).each_with_index.map { |c, i|
60
+ person = c.person or next ""
61
+
62
+ if i.zero?
63
+ [person_surname(person), person_given(person)]
64
+ .reject(&:empty?).join(", ")
65
+ else
66
+ [person_given(person), person_surname(person)]
67
+ .reject(&:empty?).join(" ")
68
+ end
69
+ }.reject(&:empty?).then { |names| join_names(names) }
70
+ end
71
+ end
72
+
73
+ # The IEEE access date, bare and unbracketed
74
+ # ("accessed September 3, 2019")
75
+ class IeeeAccess < Elements::Access
76
+ def render
77
+ "#{@i18n.label('viewed')} #{date_text}"
78
+ end
79
+ end
80
+
81
+ # The IEEE medium, capitalized and carrying its own trailing
82
+ # comma ("Dataset,", "Preprint,")
83
+ class IeeeMedium < Elements::Medium
84
+ private
85
+
86
+ def medium
87
+ m = @model.medium or return ""
88
+ text = m.carrier.to_s
89
+ text = m.genre.to_s if text.empty?
90
+ text = [m.form.to_s, m.size.to_s].reject(&:empty?)
91
+ .join(", ") if text.empty?
92
+ text.empty? ? "" : "#{text.sub(/^\w/) { |c| c.upcase }},"
93
+ end
94
+ end
95
+
96
+ # The ITU identifiers: ISBN and ISSN carry their kind label
97
+ # with a colon ("ISBN 92-61-12521-9")
98
+ class ItuIdentifier < Elements::Identifier
99
+ private
100
+
101
+ def render_id(docidentifier)
102
+ return "#{docidentifier.type}: #{docidentifier.content}" if
103
+ %w[ISBN ISSN].include?(docidentifier.type)
104
+
105
+ super
106
+ end
107
+ end
108
+
109
+ # The IHO creator cites the affiliation's organization name
110
+ # after the creator list ("D. Balenson, Internet Engineering
111
+ # Task Force")
112
+ class IhoCreator < Elements::Creator
113
+ def render
114
+ out = super.to_s
115
+ aff = affiliation_names
116
+ out.empty? || aff.empty? ? out : "#{out}, #{aff}"
117
+ end
118
+
119
+ private
120
+
121
+ def affiliation_names
122
+ creators.filter_map do |c|
123
+ person = c.person or next ""
124
+
125
+ Array(person.affiliation).filter_map do |a|
126
+ Array(a.organization&.name).map(&:content).first.to_s
127
+ end.reject(&:empty?).first.to_s
128
+ end.reject(&:empty?).uniq.join(", ")
129
+ end
130
+ end
131
+
132
+ # The IHO edition cites only for IHO-published documents, as
133
+ # the raw numeric edition carrying its own label ("edition
134
+ # 3.1.0"); worded editions ("Revision 1") cite as nothing
135
+ class IhoEdition < Elements::Edition
136
+ def render
137
+ return "" unless iho_publisher?
138
+
139
+ text = edition_text
140
+ text.match?(/\A\d/) ? " edition #{text}" : ""
141
+ end
142
+
143
+ private
144
+
145
+ def edition_text
146
+ raw = @model.edition
147
+ raw.respond_to?(:content) ? raw.content.to_s : raw.to_s
148
+ end
149
+
150
+ def iho_publisher?
151
+ Array(@model.contributor).any? do |c|
152
+ next false unless Array(c.role).any? do |r|
153
+ r.is_a?(String) ? r == "publisher" : r.type == "publisher"
154
+ end
155
+
156
+ org = c.organization or next false
157
+ names = Array(org.name).map(&:content) +
158
+ [org.abbreviation&.content.to_s]
159
+ # a string array: %w[] would split the organization's
160
+ # full name into words and never match it
161
+ names.any? do |n|
162
+ ["IHO", "International Hydrographic Organization"]
163
+ .include?(n)
164
+ end
165
+ end
166
+ end
167
+ end
168
+
169
+ # The NIST, BIPM and JIS rule sets live in their own
170
+ # autoloaded sections
171
+ autoload :Nist, "relaton/render/iso690/rules/nist"
172
+ autoload :Bipm, "relaton/render/iso690/rules/bipm"
173
+ autoload :Jis, "relaton/render/iso690/rules/jis"
174
+
175
+ REGISTRY = {
176
+ "status_bare" => BareStatus,
177
+ "itu_identifier" => ItuIdentifier,
178
+ "ieee_identifier" => IeeeIdentifier,
179
+ "ieee_component_part" => IeeeComponentPart,
180
+ "ieee_access" => IeeeAccess,
181
+ "ieee_medium" => IeeeMedium,
182
+ "nist_creator" => Nist::NistCreator,
183
+ "nist_date" => Nist::NistDate,
184
+ "nist_serial_date" => Nist::NistSerialDate,
185
+ "nist_series" => Nist::NistSeries,
186
+ "nist_component_part" => Nist::NistComponentPart,
187
+ "nist_identifier" => Nist::NistIdentifier,
188
+ "nist_publisher" => Nist::NistPublisher,
189
+ "nist_draft" => Nist::NistDraft,
190
+ "iho_creator" => IhoCreator,
191
+ "iho_edition" => IhoEdition,
192
+ "bipm_creator" => Bipm::BipmCreator,
193
+ "bipm_component_part" => Bipm::BipmComponentPart,
194
+ "bipm_production" => Bipm::BipmProduction,
195
+ "bipm_extent" => Bipm::BipmExtent,
196
+ "bipm_medium" => Bipm::BipmMedium,
197
+ "bipm_edition" => Bipm::BipmEdition,
198
+ "bipm_volume" => Bipm::BipmVolume,
199
+ "jis_component_part" => Jis::JisComponentPart,
200
+ "jis_series" => Jis::JisSeries,
201
+ "jis_extent" => Jis::JisExtent,
202
+ }.freeze
203
+
204
+ class << self
205
+ def register(name, klass)
206
+ REGISTRY[name.to_s] = klass
207
+ end
208
+
209
+ # A pack's rule selections become the renderer's element map;
210
+ # caller-supplied elements win over the pack's selections
211
+ def resolve(rules, elements = {})
212
+ Array(rules).to_h { |slot, name| [slot.to_sym, fetch(name)] }
213
+ .merge(elements || {})
214
+ end
215
+
216
+ private
217
+
218
+ def fetch(name)
219
+ REGISTRY.fetch(name.to_s) do
220
+ raise ArgumentError, "unknown citation style rule #{name}"
221
+ end
222
+ end
223
+ end
224
+ end
225
+ end
226
+ end
227
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Relaton
4
+ module Render
5
+ module Iso690
6
+ class Style
7
+ # LocalizedStrings: per-style overrides of the language pack's
8
+ # connective strings, keyed as in the CitationStyle model.
9
+ class Locale < Lutaml::Model::Serializable
10
+ attribute :conj, :string
11
+ attribute :others, :string
12
+ attribute :no_date, :string
13
+ attribute :no_author, :string
14
+ attribute :in_str, :string
15
+ attribute :at, :string
16
+ attribute :available_at, :string
17
+ # Arbitrary label overrides (edition words, join punctuation,
18
+ # size units): merged over the language pack verbatim.
19
+ attribute :labels, :hash, default: -> { {} }
20
+ # Typographic punctuation overrides (production order and
21
+ # separator), declared as in the language packs
22
+ attribute :punct, :hash, default: -> { {} }
23
+
24
+ key_value do
25
+ map "and", to: :conj
26
+ map "others", to: :others
27
+ map "noDate", to: :no_date
28
+ map "noAuthor", to: :no_author
29
+ map "in", to: :in_str
30
+ map "at", to: :at
31
+ map "availableAt", to: :available_at
32
+ map "labels", to: :labels
33
+ map "punct", to: :punct
34
+ end
35
+
36
+ LABEL_FOR = {
37
+ "conj" => "and", "others" => "others", "no_date" => "no_date",
38
+ "no_author" => "no_author", "in_str" => "in", "at" => "at",
39
+ "available_at" => "available_from",
40
+ }.freeze
41
+
42
+ # The named attributes' label map alone: a delta's named
43
+ # attribute (availableAt) outranks the base pack's labels
44
+ # hash carrying the same label key
45
+ def named_label_map
46
+ LABEL_FOR.filter_map do |attr, label|
47
+ value = public_send(attr)
48
+ [label, value] unless value.nil?
49
+ end.to_h
50
+ end
51
+
52
+ def label_map
53
+ named_label_map.merge(labels || {})
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Relaton
4
+ module Render
5
+ module Iso690
6
+ class Style
7
+ # How personal names are formed, as declared by the style's
8
+ # citation scheme (relaton-models NameFormRules).
9
+ class NameForm < Lutaml::Model::Serializable
10
+ attribute :initials, :boolean, default: -> { false }
11
+ attribute :given_name_first, :boolean, default: -> { false }
12
+ # Where an all-editor creator list's role marker sits relative
13
+ # to the name's terminating period: "glue" renders
14
+ # "NAME (eds.)." (the name-date default), "afterPeriod"
15
+ # renders "NAME. (eds.)" (ISO 690 clause-flavour).
16
+ attribute :role_placement, :string, default: "glue"
17
+ # A completename is rendered, not decomposed; styles that
18
+ # upcase inverted names may declare the completename treatment
19
+ attribute :completename_upcase, :boolean, default: -> { false }
20
+ # Every personal name takes the inverted form (surname first),
21
+ # not just the principal creator
22
+ attribute :inverted_all, :boolean, default: -> { false }
23
+ # "serial": the oxford comma appears at every gap of the
24
+ # creator list, including between two names
25
+ attribute :list_style, :string, default: ""
26
+ # Organization names take the inverted form's casing; small-cap
27
+ # styles keep the declared case
28
+ attribute :org_upcase, :boolean, default: -> { true }
29
+ # When no personal creator exists, the creator slot falls back
30
+ # to the publisher's abbreviation ("ISO: ISO 712, ...")
31
+ attribute :creator_fallback, :string
32
+ # A lone editor still carries the role marker ("(ed.)")
33
+ attribute :lone_editor_marked, :boolean, default: -> { false }
34
+ # Initials without their trailing periods ("Nixon RM")
35
+ attribute :initials_period, :boolean, default: -> { true }
36
+ # The inverted form's surname casing: the name-date convention
37
+ # upcases; small-cap styles keep the declared case
38
+ attribute :surname_upcase, :boolean, default: -> { true }
39
+ # Initials are a list; this separates them ("J. K." vs "J.K.")
40
+ attribute :initials_separator, :string, default: " "
41
+ # The first forename cites in full, the rest as initials
42
+ # ("Milena S."; document-history name forms)
43
+ attribute :subsequent_initials, :boolean, default: -> { false }
44
+ # The direct-order surname casing after the first creator:
45
+ # the name-date convention upcases
46
+ attribute :subsequent_surname_upcase, :boolean,
47
+ default: -> { true }
48
+ # At this many creators the creator list truncates to the
49
+ # first etalDisplay names with "et al." (0 disables)
50
+ attribute :etal_count, :integer, default: 0
51
+ attribute :etal_display, :integer, default: 0
52
+ # The in-text cite truncates separately from the creator
53
+ # list: at this many creators it shows the first
54
+ # inTextEtalDisplay names with "et al." (0 disables; IEEE
55
+ # cites 3+ as "Aluffi et al." while listing 6 in the
56
+ # bibliography)
57
+ attribute :in_text_etal_count, :integer, default: 0
58
+ attribute :in_text_etal_display, :integer, default: 1
59
+ # Editor lists carry the role marker ("(Eds.)")
60
+ attribute :editors_marked, :boolean, default: -> { true }
61
+
62
+ key_value do
63
+ map "initials", to: :initials
64
+ map "givenNameFirst", to: :given_name_first
65
+ map "rolePlacement", to: :role_placement
66
+ map "completenameUpcase", to: :completename_upcase
67
+ map "invertedAll", to: :inverted_all
68
+ map "listStyle", to: :list_style
69
+ map "orgUpcase", to: :org_upcase
70
+ map "creatorFallback", to: :creator_fallback
71
+ map "loneEditorMarked", to: :lone_editor_marked
72
+ map "initialsPeriod", to: :initials_period
73
+ map "surnameUpcase", to: :surname_upcase
74
+ map "initialsSeparator", to: :initials_separator
75
+ map "subsequentInitials", to: :subsequent_initials
76
+ map "subsequentSurnameUpcase", to: :subsequent_surname_upcase
77
+ map "etalCount", to: :etal_count
78
+ map "etalDisplay", to: :etal_display
79
+ map "inTextEtalCount", to: :in_text_etal_count
80
+ map "inTextEtalDisplay", to: :in_text_etal_display
81
+ map "editorsMarked", to: :editors_marked
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Relaton
4
+ module Render
5
+ module Iso690
6
+ class Style
7
+ # CitationScheme: the citation system, its name form and its
8
+ # localized strings (relaton-models CitationScheme).
9
+ class Scheme < Lutaml::Model::Serializable
10
+ attribute :system, :string, default: "name-date"
11
+ attribute :name_form, NameForm, default: -> { NameForm.new }
12
+ attribute :locale, Locale, default: -> { Locale.new }
13
+ attribute :home_docid_type, :string, collection: true
14
+ attribute :default_kind, :string, default: ""
15
+
16
+ # The renderings' short cite takes the reference form with the
17
+ # first-biblio marker (the 1.x citetemplate short), not the
18
+ # citation template
19
+ attribute :short_from_reference, :boolean, default: -> { false }
20
+
21
+ key_value do
22
+ map "system", to: :system
23
+ map "nameForm", to: :name_form
24
+ map "locale", to: :locale
25
+ map "homeDocidType", to: :home_docid_type
26
+ map "defaultKind", to: :default_kind
27
+ map "shortFromReference", to: :short_from_reference
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Relaton
4
+ module Render
5
+ module Iso690
6
+ class Style
7
+ # SortRule: one ordering key of a bibliographic index sort
8
+ # (relaton-models SortRule).
9
+ class SortRule < Lutaml::Model::Serializable
10
+ attribute :attribute, :string
11
+ attribute :order, :string
12
+
13
+ key_value do
14
+ map "attribute", to: :attribute
15
+ map "order", to: :order
16
+ end
17
+
18
+ def descending?
19
+ order == "descending"
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Relaton
4
+ module Render
5
+ module Iso690
6
+ class Style
7
+ # TemplateMap: citation and reference templates as data, plus the
8
+ # title emphasis markers and the first-creator name form. Slots
9
+ # name ISO 690 clause 7 data elements or name-form fields.
10
+ class TemplateMap < Lutaml::Model::Serializable
11
+ attribute :title_open, :string, default: "_"
12
+ attribute :title_close, :string, default: "_"
13
+ attribute :citation, :string, default: "{{surname}}, {{date}}"
14
+ attribute :reference, :string
15
+ attribute :name, :string, default: "{{surname}}, {{givenNames}}"
16
+ attribute :series, :string, default: ""
17
+ attribute :uri, :string, default: ""
18
+ attribute :creators, :string, default: ""
19
+ attribute :uri_short, :string, default: ""
20
+ # "first": cite only the first identifier (1.x
21
+ # authoritative_identifier|first styles)
22
+ attribute :identifier_mode, :string, default: "all"
23
+
24
+ key_value do
25
+ map "titleOpen", to: :title_open
26
+ map "titleClose", to: :title_close
27
+ map "citation", to: :citation
28
+ map "reference", to: :reference
29
+ map "name", to: :name
30
+ map "series", to: :series
31
+ map "uri", to: :uri
32
+ map "creators", to: :creators
33
+ map "uriShort", to: :uri_short
34
+ map "identifierMode", to: :identifier_mode
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Relaton
4
+ module Render
5
+ module Iso690
6
+ class Style
7
+ # TypeTemplate: the template variant for one bibliographic item
8
+ # type, selected by data lookup (relaton-models TypeTemplate).
9
+ class TypeTemplate < Lutaml::Model::Serializable
10
+ attribute :type, :string
11
+ attribute :template, :string
12
+ attribute :series, :string
13
+ attribute :title, :string
14
+ # Per-slot form overrides for the production and the
15
+ # authorizer: wrappers over the element's own render, so a
16
+ # kind can carry its slot's separator in the form
17
+ # (", {{production}}" over the engine's ". " glue)
18
+ attribute :production, :string
19
+ attribute :authorizer, :string
20
+ attribute :home, :boolean
21
+ attribute :fallbacks, :hash, default: -> { {} }
22
+ # The short-cite template for this kind; absent falls back to
23
+ # the reference template in short mode
24
+ attribute :short, :string
25
+ # Render the style's no_place label when the publisher has no
26
+ # place (the book-family templates of some flavors)
27
+ attribute :no_place, :boolean
28
+
29
+ key_value do
30
+ map "type", to: :type
31
+ map "template", to: :template
32
+ map "series", to: :series
33
+ map "title", to: :title
34
+ map "production", to: :production
35
+ map "authorizer", to: :authorizer
36
+ map "home", to: :home
37
+ map "fallbacks", to: :fallbacks
38
+ map "short", to: :short
39
+ map "noPlace", to: :no_place
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end