relaton 3.0.7 → 3.1.0
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/bin/relaton +20 -0
- data/lib/relaton/3gpp/processor.rb +1 -1
- data/lib/relaton/3gpp.rb +3 -3
- data/lib/relaton/adobe/processor.rb +1 -1
- data/lib/relaton/adobe.rb +3 -3
- data/lib/relaton/bib/item_data.rb +2 -2
- data/lib/relaton/bib/model/docidentifier.rb +17 -2
- data/lib/relaton/bib.rb +2 -2
- data/lib/relaton/bibcollection.rb +146 -0
- data/lib/relaton/bibdata.rb +92 -0
- data/lib/relaton/bipm/data_outcomes_parser.rb +6 -1
- data/lib/relaton/bipm/processor.rb +1 -1
- data/lib/relaton/bipm.rb +3 -3
- data/lib/relaton/bsi/processor.rb +1 -1
- data/lib/relaton/bsi.rb +1 -1
- data/lib/relaton/calconnect/data_fetcher.rb +2 -2
- data/lib/relaton/calconnect/model/item.rb +1 -1
- data/lib/relaton/calconnect/processor.rb +1 -1
- data/lib/relaton/calconnect.rb +2 -2
- data/lib/relaton/ccsds/data/fetcher.rb +1 -1
- data/lib/relaton/ccsds/model/item.rb +1 -1
- data/lib/relaton/ccsds/processor.rb +1 -1
- data/lib/relaton/ccsds/util.rb +1 -1
- data/lib/relaton/ccsds.rb +1 -1
- data/lib/relaton/cen/processor.rb +1 -1
- data/lib/relaton/cen.rb +2 -2
- data/lib/relaton/cie/data_fetcher.rb +3 -3
- data/lib/relaton/cie/processor.rb +1 -1
- data/lib/relaton/cie.rb +2 -2
- data/lib/relaton/cli/base_convertor.rb +134 -0
- data/lib/relaton/cli/command.rb +396 -0
- data/lib/relaton/cli/data_fetcher.rb +20 -0
- data/lib/relaton/cli/frontend/dist/404.html +18 -0
- data/lib/relaton/cli/frontend/dist/app.iife.js +1 -0
- data/lib/relaton/cli/frontend/dist/style.css +3 -0
- data/lib/relaton/cli/frontend/index.html +14 -0
- data/lib/relaton/cli/frontend/package-lock.json +2945 -0
- data/lib/relaton/cli/frontend/package.json +29 -0
- data/lib/relaton/cli/frontend/public/404.html +18 -0
- data/lib/relaton/cli/frontend/src/App.test.ts +501 -0
- data/lib/relaton/cli/frontend/src/App.vue +506 -0
- data/lib/relaton/cli/frontend/src/app.ts +90 -0
- data/lib/relaton/cli/frontend/src/components/DocumentDetail.test.ts +142 -0
- data/lib/relaton/cli/frontend/src/components/DocumentDetail.vue +228 -0
- data/lib/relaton/cli/frontend/src/components/DocumentRow.vue +88 -0
- data/lib/relaton/cli/frontend/src/components/Icon.test.ts +44 -0
- data/lib/relaton/cli/frontend/src/components/Icon.vue +55 -0
- data/lib/relaton/cli/frontend/src/components/Pagination.vue +26 -0
- data/lib/relaton/cli/frontend/src/dev/main.ts +100 -0
- data/lib/relaton/cli/frontend/src/dev/sample-data.json +71 -0
- data/lib/relaton/cli/frontend/src/lib/filter.test.ts +88 -0
- data/lib/relaton/cli/frontend/src/lib/filter.ts +95 -0
- data/lib/relaton/cli/frontend/src/lib/hydrate.test.ts +102 -0
- data/lib/relaton/cli/frontend/src/lib/hydrate.ts +55 -0
- data/lib/relaton/cli/frontend/src/lib/shards.test.ts +319 -0
- data/lib/relaton/cli/frontend/src/lib/shards.ts +183 -0
- data/lib/relaton/cli/frontend/src/lib/types.ts +148 -0
- data/lib/relaton/cli/frontend/src/lib/url.test.ts +151 -0
- data/lib/relaton/cli/frontend/src/lib/url.ts +111 -0
- data/lib/relaton/cli/frontend/src/shims-vue.d.ts +5 -0
- data/lib/relaton/cli/frontend/src/styles/index.css +27 -0
- data/lib/relaton/cli/frontend/src/test/fetch.ts +58 -0
- data/lib/relaton/cli/frontend/tsconfig.json +20 -0
- data/lib/relaton/cli/frontend/vite.config.ts +42 -0
- data/lib/relaton/cli/frontend/vitest.config.ts +11 -0
- data/lib/relaton/cli/frontend_assets.rb +58 -0
- data/lib/relaton/cli/full_text_search.rb +98 -0
- data/lib/relaton/cli/i18n.yaml +1 -0
- data/lib/relaton/cli/index_item_normalizer.rb +380 -0
- data/lib/relaton/cli/index_site_generator.rb +1043 -0
- data/lib/relaton/cli/relaton_file.rb +290 -0
- data/lib/relaton/cli/subcommand_collection.rb +263 -0
- data/lib/relaton/cli/subcommand_db.rb +81 -0
- data/lib/relaton/cli/templates/_document.liquid +111 -0
- data/lib/relaton/cli/templates/_index.liquid +61 -0
- data/lib/relaton/cli/templates/index/page.liquid +20 -0
- data/lib/relaton/cli/templates/index-style.css +1017 -0
- data/lib/relaton/cli/util.rb +8 -0
- data/lib/relaton/cli/xml_convertor.rb +47 -0
- data/lib/relaton/cli/xml_to_html_renderer.rb +117 -0
- data/lib/relaton/cli/yaml_convertor.rb +102 -0
- data/lib/relaton/cli.rb +103 -0
- data/lib/relaton/core/processor.rb +1 -1
- data/lib/relaton/core.rb +1 -1
- data/lib/relaton/db/registry.rb +1 -1
- data/lib/relaton/db.rb +1 -1
- data/lib/relaton/doi/CLAUDE.md +1 -1
- data/lib/relaton/doi/parser.rb +2 -1
- data/lib/relaton/doi/processor.rb +1 -1
- data/lib/relaton/doi.rb +4 -4
- data/lib/relaton/easc/processor.rb +1 -1
- data/lib/relaton/easc.rb +3 -3
- data/lib/relaton/ecma/data_fetcher.rb +1 -1
- data/lib/relaton/ecma/processor.rb +1 -1
- data/lib/relaton/ecma.rb +2 -2
- data/lib/relaton/element_finder.rb +29 -0
- data/lib/relaton/etsi/data_fetcher.rb +2 -2
- data/lib/relaton/etsi/item.rb +1 -1
- data/lib/relaton/etsi/processor.rb +2 -2
- data/lib/relaton/etsi.rb +1 -1
- data/lib/relaton/evs/processor.rb +1 -1
- data/lib/relaton/evs.rb +2 -2
- data/lib/relaton/gb/CLAUDE.md +1 -1
- data/lib/relaton/gb/bibliography.rb +1 -1
- data/lib/relaton/gb/processor.rb +1 -1
- data/lib/relaton/gb.rb +2 -2
- data/lib/relaton/gost/processor.rb +1 -1
- data/lib/relaton/gost.rb +3 -3
- data/lib/relaton/iala/processor.rb +1 -1
- data/lib/relaton/iala.rb +3 -3
- data/lib/relaton/iana/data_fetcher.rb +1 -1
- data/lib/relaton/iana/processor.rb +1 -1
- data/lib/relaton/iana.rb +2 -2
- data/lib/relaton/iec/data_fetcher.rb +1 -1
- data/lib/relaton/iec/processor.rb +1 -1
- data/lib/relaton/iec.rb +2 -2
- data/lib/relaton/ieee/processor.rb +1 -1
- data/lib/relaton/ieee.rb +2 -2
- data/lib/relaton/ietf/CLAUDE.md +1 -1
- data/lib/relaton/ietf/data_fetcher.rb +1 -1
- data/lib/relaton/ietf/processor.rb +1 -1
- data/lib/relaton/ietf.rb +2 -2
- data/lib/relaton/iho/CLAUDE.md +3 -3
- data/lib/relaton/iho/bibliography.rb +41 -27
- data/lib/relaton/iho/hash_parser_v1.rb +1 -1
- data/lib/relaton/iho/processor.rb +4 -3
- data/lib/relaton/iho.rb +2 -2
- data/lib/relaton/index.rb +1 -1
- data/lib/relaton/isbn/processor.rb +1 -1
- data/lib/relaton/isbn.rb +1 -1
- data/lib/relaton/iso/hash_parser_v1.rb +1 -1
- data/lib/relaton/iso/processor.rb +1 -1
- data/lib/relaton/iso.rb +3 -3
- data/lib/relaton/itu/processor.rb +1 -1
- data/lib/relaton/itu.rb +3 -3
- data/lib/relaton/jcgm/processor.rb +1 -1
- data/lib/relaton/jcgm.rb +2 -2
- data/lib/relaton/jis/processor.rb +1 -1
- data/lib/relaton/jis.rb +2 -2
- data/lib/relaton/nist/CLAUDE.md +11 -1
- data/lib/relaton/nist/README.adoc +7 -1
- data/lib/relaton/nist/hit_collection.rb +25 -1
- data/lib/relaton/nist/mods_parser.rb +32 -8
- data/lib/relaton/nist/processor.rb +1 -1
- data/lib/relaton/nist/pubs_export.rb +69 -11
- data/lib/relaton/nist.rb +2 -2
- data/lib/relaton/oasis/processor.rb +1 -1
- data/lib/relaton/oasis.rb +2 -2
- data/lib/relaton/ogc/CLAUDE.md +1 -1
- data/lib/relaton/ogc/processor.rb +1 -1
- data/lib/relaton/ogc.rb +2 -2
- data/lib/relaton/oiml/processor.rb +1 -1
- data/lib/relaton/oiml.rb +2 -2
- data/lib/relaton/omg/CLAUDE.md +1 -1
- data/lib/relaton/omg/processor.rb +1 -1
- data/lib/relaton/omg.rb +1 -1
- data/lib/relaton/plateau/CLAUDE.md +1 -1
- data/lib/relaton/plateau/data_fetcher.rb +1 -1
- data/lib/relaton/plateau/processor.rb +1 -1
- data/lib/relaton/plateau.rb +2 -2
- data/lib/relaton/render/general.rb +319 -0
- data/lib/relaton/render/iso690/csl_import.rb +129 -0
- data/lib/relaton/render/iso690/element.rb +153 -0
- data/lib/relaton/render/iso690/elements/access.rb +44 -0
- data/lib/relaton/render/iso690/elements/authorizer.rb +45 -0
- data/lib/relaton/render/iso690/elements/citeid.rb +39 -0
- data/lib/relaton/render/iso690/elements/component_part.rb +97 -0
- data/lib/relaton/render/iso690/elements/creator.rb +267 -0
- data/lib/relaton/render/iso690/elements/edition.rb +97 -0
- data/lib/relaton/render/iso690/elements/extent.rb +71 -0
- data/lib/relaton/render/iso690/elements/identifier.rb +46 -0
- data/lib/relaton/render/iso690/elements/location.rb +73 -0
- data/lib/relaton/render/iso690/elements/medium.rb +32 -0
- data/lib/relaton/render/iso690/elements/numeration.rb +26 -0
- data/lib/relaton/render/iso690/elements/production.rb +111 -0
- data/lib/relaton/render/iso690/elements/pub_date.rb +63 -0
- data/lib/relaton/render/iso690/elements/series.rb +66 -0
- data/lib/relaton/render/iso690/elements/size.rb +45 -0
- data/lib/relaton/render/iso690/elements/status.rb +30 -0
- data/lib/relaton/render/iso690/elements/stddoc.rb +40 -0
- data/lib/relaton/render/iso690/elements/title.rb +56 -0
- data/lib/relaton/render/iso690/elements/updated.rb +38 -0
- data/lib/relaton/render/iso690/elements.rb +67 -0
- data/lib/relaton/render/iso690/fields.rb +142 -0
- data/lib/relaton/render/iso690/i18n/en.yml +48 -0
- data/lib/relaton/render/iso690/i18n/fr.yml +14 -0
- data/lib/relaton/render/iso690/i18n/ja.yml +38 -0
- data/lib/relaton/render/iso690/i18n.rb +83 -0
- data/lib/relaton/render/iso690/identifier_kinds.rb +29 -0
- data/lib/relaton/render/iso690/index_renderer.rb +57 -0
- data/lib/relaton/render/iso690/kinds.rb +53 -0
- data/lib/relaton/render/iso690/renderer.rb +150 -0
- data/lib/relaton/render/iso690/rules/bipm.rb +186 -0
- data/lib/relaton/render/iso690/rules/jis.rb +103 -0
- data/lib/relaton/render/iso690/rules/nist.rb +384 -0
- data/lib/relaton/render/iso690/rules.rb +227 -0
- data/lib/relaton/render/iso690/style/locale.rb +59 -0
- data/lib/relaton/render/iso690/style/name_form.rb +87 -0
- data/lib/relaton/render/iso690/style/scheme.rb +33 -0
- data/lib/relaton/render/iso690/style/sort_rule.rb +25 -0
- data/lib/relaton/render/iso690/style/template_map.rb +40 -0
- data/lib/relaton/render/iso690/style/type_template.rb +45 -0
- data/lib/relaton/render/iso690/style.rb +227 -0
- data/lib/relaton/render/iso690/styles/apa.yml +45 -0
- data/lib/relaton/render/iso690/styles/author-date.yml +31 -0
- data/lib/relaton/render/iso690/styles/chicago.yml +49 -0
- data/lib/relaton/render/iso690/styles/ieee-sa.yml +45 -0
- data/lib/relaton/render/iso690/styles/jis-en.yml +68 -0
- data/lib/relaton/render/iso690/styles/jis-ja.yml +67 -0
- data/lib/relaton/render/iso690/styles/lncs.yml +54 -0
- data/lib/relaton/render/iso690/styles/mla.yml +56 -0
- data/lib/relaton/render/iso690/template.rb +248 -0
- data/lib/relaton/render/iso690.rb +28 -0
- data/lib/relaton/sae/CLAUDE.md +89 -0
- data/lib/relaton/sae/bibdata.rb +8 -0
- data/lib/relaton/sae/bibitem.rb +8 -0
- data/lib/relaton/sae/bibliography.rb +128 -0
- data/lib/relaton/sae/data_fetcher.rb +219 -0
- data/lib/relaton/sae/doi_code.rb +83 -0
- data/lib/relaton/sae/item.rb +10 -0
- data/lib/relaton/sae/item_data.rb +6 -0
- data/lib/relaton/sae/processor.rb +62 -0
- data/lib/relaton/sae/util.rb +9 -0
- data/lib/relaton/sae.rb +37 -0
- data/lib/relaton/un/CLAUDE.md +1 -1
- data/lib/relaton/un/processor.rb +1 -1
- data/lib/relaton/un.rb +1 -1
- data/lib/relaton/version.rb +1 -1
- data/lib/relaton/w3c/bibliography.rb +1 -1
- data/lib/relaton/w3c/data_fetcher.rb +1 -1
- data/lib/relaton/w3c/processor.rb +1 -1
- data/lib/relaton/w3c.rb +2 -2
- data/lib/relaton/xsf/data_fetcher.rb +1 -1
- data/lib/relaton/xsf/processor.rb +1 -1
- data/lib/relaton/xsf.rb +2 -2
- data/lib/relaton-cli.rb +17 -0
- data/lib/relaton-render.rb +12 -0
- data/lib/relaton.rb +3 -2
- metadata +203 -23
|
@@ -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
|