relaton-render 0.5.14 → 0.5.15
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 +1 -0
- data/lib/isodoc/i18n.rb +2 -2
- data/lib/isodoc-yaml/i18n-ar.yaml +1 -0
- data/lib/isodoc-yaml/i18n-de.yaml +1 -0
- data/lib/isodoc-yaml/i18n-en.yaml +1 -0
- data/lib/isodoc-yaml/i18n-es.yaml +1 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
- data/lib/isodoc-yaml/i18n-ja.yaml +46 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +1 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
- data/lib/isodoc-yaml/i18n-zh-Hant.yaml +1 -0
- data/lib/relaton/render/general/config.yml +1 -1
- data/lib/relaton/render/general/render.rb +7 -0
- data/lib/relaton/render/parse/parse.rb +1 -1
- data/lib/relaton/render/parse/parse_extract.rb +22 -3
- data/lib/relaton/render/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0af6169e02ec5d26e446cde74cd73a1f46e35c8940d30f6c510f4be4de0088e6
|
|
4
|
+
data.tar.gz: f57803b06b0cdd09d3a0a7c88a2e33755fc976c4e32d15d5ad060442ac2a7c10
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ea4a04f26b246e60e332e6b77a9ebbdac20c0ae80e77b68e80446930a3eff08b12e598eec6d35919aebbc17e07d6ae4b56aa6b808b752d877ca1cb9f7ce10d16
|
|
7
|
+
data.tar.gz: 31712a34848e3564f871e7b41044d8082d2ee19036372b002a46670c4b8dc8ce9a206d6a4ae1fb783ea501fea20604753c2c9946e804afa36576a75b62aa74db
|
data/README.adoc
CHANGED
|
@@ -158,6 +158,7 @@ drawn from the bibliographic item:
|
|
|
158
158
|
| authorizer | ./contributor[role/@type = 'authorizer']/organization/name \| ./contributor[role/@type = 'publisher']/organization/name | | Y |
|
|
159
159
|
| authoritative_identifier | ./docidentifier[not(@type = 'metanorma' or @type = 'ordinal' or @type = 'ISBN' or @type = 'ISSN' or @type = 'DOI')] | Y | |
|
|
160
160
|
| other_identifier | ./docidentifier[@type = 'ISBN' or @type = 'ISSN' or @type = 'DOI'] | Y | | By default, each such identifier is prefixed with its type and colon
|
|
161
|
+
| doi | ./docidentifier[@type = 'DOI'] | Y | | No prefix supplied
|
|
161
162
|
| status | ./status | | | Rendering varies by flavour
|
|
162
163
|
| uri | ./uri[@type = 'citation' or @type = 'uri' or @type = 'src' or true] | | | If multiples, prioritise language match. Always exclude DOI: that is not where the resource is available from
|
|
163
164
|
| access_location | ./accessLocation | | Y |
|
data/lib/isodoc/i18n.rb
CHANGED
|
@@ -5,7 +5,7 @@ module IsoDoc
|
|
|
5
5
|
class RelatonRenderI18n < I18n
|
|
6
6
|
def load_yaml1(lang, script)
|
|
7
7
|
case lang
|
|
8
|
-
when "en", "fr", "ru", "de", "es", "ar"
|
|
8
|
+
when "en", "fr", "ru", "de", "es", "ar", "ja"
|
|
9
9
|
load_yaml2(lang)
|
|
10
10
|
when "zh"
|
|
11
11
|
case script
|
|
@@ -25,7 +25,7 @@ module IsoDoc
|
|
|
25
25
|
# because of the potential for script mixing
|
|
26
26
|
def cleanup_entities(hash, is_xml: true)
|
|
27
27
|
ret = super
|
|
28
|
-
if @lang == "ar" &&
|
|
28
|
+
if @lang == "ar" && ret.include?("%")
|
|
29
29
|
ret = "؜#{ret}؜"
|
|
30
30
|
end
|
|
31
31
|
ret
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
in:
|
|
2
|
+
at:
|
|
3
|
+
and: と
|
|
4
|
+
author_and: と
|
|
5
|
+
updated: 更新しました
|
|
6
|
+
viewed: 見た
|
|
7
|
+
version: バージョン
|
|
8
|
+
also_pub_as: 次のようにも出版されています
|
|
9
|
+
no_date: 日付なし。
|
|
10
|
+
no_place: 都市はありません。
|
|
11
|
+
date_formats:
|
|
12
|
+
month_year: yMMMM
|
|
13
|
+
day_month_year: to_long_s
|
|
14
|
+
date_time: to_long_s
|
|
15
|
+
ordinal_keys: []
|
|
16
|
+
OrdinalRules: digits-ordinal
|
|
17
|
+
edition: 版
|
|
18
|
+
edition_ordinal: "%Ordinal edition"
|
|
19
|
+
draft: "下書き %"
|
|
20
|
+
editor:
|
|
21
|
+
sg: 編
|
|
22
|
+
pl: 編
|
|
23
|
+
qq-open: <em>
|
|
24
|
+
qq-close: </em>
|
|
25
|
+
q-open:
|
|
26
|
+
q-close:
|
|
27
|
+
extent:
|
|
28
|
+
page:
|
|
29
|
+
sg: "ページ%"
|
|
30
|
+
pl: "ページ%"
|
|
31
|
+
volume:
|
|
32
|
+
sg: "巻%"
|
|
33
|
+
pl: "巻%"
|
|
34
|
+
issue:
|
|
35
|
+
sg: "いいえ%"
|
|
36
|
+
pl: "いいえ%"
|
|
37
|
+
size:
|
|
38
|
+
page:
|
|
39
|
+
sg: "ページ%"
|
|
40
|
+
pl: "ページ%"
|
|
41
|
+
volume:
|
|
42
|
+
sg: "巻%"
|
|
43
|
+
pl: "巻%"
|
|
44
|
+
issue:
|
|
45
|
+
sg: "いいえ%"
|
|
46
|
+
pl: "いいえ%"
|
|
@@ -48,7 +48,7 @@ template:
|
|
|
48
48
|
software: "{{ creatornames }} ({{ role}}) . {{labels['qq-open']}}{{ title }}{{labels['qq-close']}} . {{ labels['version'] | capitalize }}_{{ edition_raw }}. {{medium | capitalize}}. {{place}}: {{publisher}}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. {{size}}. {{ extent}}. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
|
|
49
49
|
# TODO: omitted: author ids, subsidiary titles, subsidiary creators, copyright, license, distributor, system requirements, relationships
|
|
50
50
|
electronic resource: software
|
|
51
|
-
standard: "{{ creatornames }} ({{ role}}) . {{ authoritative_identifier | join '|' }}: {{labels['qq-open']}}{{ title }}{{labels['qq-close']}} . {{ labels['in'] | capitalize }}:_{{ series_title }}. {{ medium | capitalize }}. {{ edition | capitalize_first }}. {{ place }}: {{ publisher }}. {{date}}. {{size}}. {{ extent }}. {{ other_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
|
51
|
+
standard: "{{ creatornames }} ({{ role}}) . {{ authoritative_identifier | join: '|' }}: {{labels['qq-open']}}{{ title }}{{labels['qq-close']}} . {{ labels['in'] | capitalize }}:_{{ series_title }}. {{ medium | capitalize }}. {{ edition | capitalize_first }}. {{ place }}: {{ publisher }}. {{date}}. {{size}}. {{ extent }}. {{ other_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
|
52
52
|
# TODO: omitted: author ids, subsidiary titles, rights metadata, distributor, persistent identifier, item attributes, relationships
|
|
53
53
|
techreport: standard
|
|
54
54
|
dataset: "{{ creatornames }} ({{ role }}) . {{labels['qq-open']}}{{ title }}{{labels['qq-close']}} . {{ labels['version'] | capitalize }}_{{ edition_raw }}. {{medium | capitalize }}. {{ labels['in'] | capitalize }}:_{{series}}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. {{ size }}. {{ extent}}. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
|
|
@@ -133,6 +133,13 @@ module Relaton
|
|
|
133
133
|
end
|
|
134
134
|
|
|
135
135
|
def parse1(doc)
|
|
136
|
+
r = doc.relation.select { |x| x.type == "hasRepresentation" }
|
|
137
|
+
.map { |x| @i18n.also_pub_as + parse_single_bibitem(x.bibitem) }
|
|
138
|
+
out = [parse_single_bibitem(doc)] + r
|
|
139
|
+
@i18n.l10n(out.join(". ").gsub(".. ", ". "))
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def parse_single_bibitem(doc)
|
|
136
143
|
r = renderer(doc.type || "misc")
|
|
137
144
|
data = @parse.extract(doc)
|
|
138
145
|
enhance_data(data, r.template_raw)
|
|
@@ -22,7 +22,7 @@ module Relaton
|
|
|
22
22
|
def simple_xml2hash(doc)
|
|
23
23
|
creators, role = creatornames(doc)
|
|
24
24
|
{ type: type(doc), title: title(doc), extent_raw: extent(doc),
|
|
25
|
-
size_raw: size(doc), uri_raw: uri(doc),
|
|
25
|
+
size_raw: size(doc), uri_raw: uri(doc), doi: doi(doc),
|
|
26
26
|
authoritative_identifier: authoritative_identifier(doc),
|
|
27
27
|
other_identifier: other_identifier(doc),
|
|
28
28
|
status: status(doc), creators: creators, role_raw: role }
|
|
@@ -91,9 +91,15 @@ module Relaton
|
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
def authoritative_identifier(doc)
|
|
94
|
-
doc.docidentifier.each_with_object([]) do |id, ret|
|
|
95
|
-
|
|
94
|
+
out = doc.docidentifier.each_with_object([]) do |id, ret|
|
|
95
|
+
id.primary && !authoritative_identifier_exclude.include?(id.type) and
|
|
96
|
+
ret << id.id
|
|
97
|
+
end
|
|
98
|
+
out.empty? and out = doc.docidentifier.each_with_object([]) do |id, ret|
|
|
99
|
+
authoritative_identifier_exclude.include?(id_type_norm(id)) or
|
|
100
|
+
ret << id.id
|
|
96
101
|
end
|
|
102
|
+
out
|
|
97
103
|
end
|
|
98
104
|
|
|
99
105
|
def authoritative_identifier_exclude
|
|
@@ -102,7 +108,7 @@ module Relaton
|
|
|
102
108
|
|
|
103
109
|
def other_identifier(doc)
|
|
104
110
|
doc.docidentifier.each_with_object([]) do |id, ret|
|
|
105
|
-
type = id
|
|
111
|
+
type = id_type_norm(id)
|
|
106
112
|
other_identifier_include.include? type or next
|
|
107
113
|
ret << @i18n.l10n("#{type}: #{id.id}")
|
|
108
114
|
end
|
|
@@ -112,6 +118,19 @@ module Relaton
|
|
|
112
118
|
%w(ISSN ISBN DOI)
|
|
113
119
|
end
|
|
114
120
|
|
|
121
|
+
def doi(doc)
|
|
122
|
+
out = doc.docidentifier.each_with_object([]) do |id, ret|
|
|
123
|
+
type = id.type&.sub(/^(DOI)\..*$/i, "\\1") or next
|
|
124
|
+
type.casecmp("doi").zero? or next
|
|
125
|
+
ret << id.id
|
|
126
|
+
end
|
|
127
|
+
out.empty? ? nil : out
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def id_type_norm(id)
|
|
131
|
+
id.type&.sub(/^(ISBN|ISSN)\..*$/i) { $1.upcase }
|
|
132
|
+
end
|
|
133
|
+
|
|
115
134
|
def uri(doc)
|
|
116
135
|
uri = nil
|
|
117
136
|
%w(citation uri src).each do |t|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-render
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.15
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-09-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -201,6 +201,7 @@ files:
|
|
|
201
201
|
- lib/isodoc-yaml/i18n-en.yaml
|
|
202
202
|
- lib/isodoc-yaml/i18n-es.yaml
|
|
203
203
|
- lib/isodoc-yaml/i18n-fr.yaml
|
|
204
|
+
- lib/isodoc-yaml/i18n-ja.yaml
|
|
204
205
|
- lib/isodoc-yaml/i18n-ru.yaml
|
|
205
206
|
- lib/isodoc-yaml/i18n-zh-Hans.yaml
|
|
206
207
|
- lib/isodoc-yaml/i18n-zh-Hant.yaml
|