relaton-render 0.3.7 → 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be0824c3523bcd05d90124be3d8c36b496803edd2322b7128e0e47f759309d25
4
- data.tar.gz: 65f3c1fc7900217391a1f291ae57323823e8e1f8559e8b135b1e4e7563a3f19b
3
+ metadata.gz: 963f65bd45b2b7d271822ba18c63f2a6e34768da2e77b73dee08f43ae9e68c3d
4
+ data.tar.gz: 989731f97b400da01dbf2d549b7319f3b04d4450f087866b1622ba381674c744
5
5
  SHA512:
6
- metadata.gz: b283ddeb4b4c0045cb8f4da3356093040408949f39e28da7db6c7f6807f3ed21dac4db520631e8db9b61a4cc98dcee4b83bacc06ca489295f2ee10745657f94a
7
- data.tar.gz: 8394b5b4f72f01819cdff6754a46a281e89685b68f869a1615efc53388f751c43c6b36d3c4ff734fded3a7f9e3ad62b6e282d27c0e203aa88110dde7d2526277
6
+ metadata.gz: d8b0815748c83dd0daf24055a1c4e4f7b2a51f2c7d65632d2e5b8596fd112df4882610626716e9feb5f46ce0054ba66ad28543a55aa3162b867dedff92cd2180
7
+ data.tar.gz: 917f533dfe7158d182bbd679c1e921442b0786d59a25db92d8cbd330fb01cb05bf9655e0ff566ac4574ab66b670d29d91b1c1b4796bfebb0e82db0e0ef07c479
data/README.adoc CHANGED
@@ -99,6 +99,7 @@ drawn from the bibliographic item:
99
99
  | title | ./title | | |
100
100
  | edition | ./edition | | Y | If numeric value, is given internationalised rendering of "nth edition", as set in edition_numbering. Otherwise, the textual content of the tag is given.
101
101
  | edition_raw | ./edition | | Y | The strict textual content of the tag is given.
102
+ | edition_num | ./edition[@number] | | Y |
102
103
  | medium | ./medium | | Y |
103
104
  | place | ./place | | Y |
104
105
  | publisher | ./contributor[role/@type = 'publisher']/organization/name | | Y |
@@ -223,11 +224,11 @@ The extent of a bibliographic item may be expressed differently depending on the
223
224
 
224
225
  To capture this, a separate template is supplied under `extenttemplate` for each bibliographic item type. For those types where none is supplied, the template given for `misc` is used as the default.
225
226
 
226
- The template draws on the defined types of locality of extents; the most common of these is `page` and `volume`. Locality types are the fields used in the Liquid templates; for example:
227
+ The template draws on the defined types of locality of extents; the most common of these is `volume`, `issue` (within volume; "number" for journals), and `page`. Locality types are the fields used in the Liquid templates; for example:
227
228
 
228
229
  ....
229
230
  {
230
- article: "{{ volume_raw }}: {{ page_raw }}"
231
+ article: "{{ volume_raw }}|({{ issue_raw }}) : {{ page_raw }}"
231
232
  misc: "{{ volume }}, {{ page }}"
232
233
  }
233
234
  ....
@@ -237,7 +238,7 @@ The internationalisation files define a singular and a plural version of the loc
237
238
  * The plural label is always used if the extent is a range (with a `<from>` and `<to>`).
238
239
  * The singular label is used if the extent is not a range (_pp. 2–4_ vs. _p. 3_).
239
240
  * The internationalisation files include a slot where the number or number range is inserted, indicated by `%`, since this varies by language. (For instance, English has `pp. %`, whereas Chinese has `第%页`.)
240
- * The number of the volume or page, without accompanying labels, is given in `volume_raw` and `page_raw`.
241
+ * The number of the volume, issue/number, or page, without accompanying labels, is given in `volume_raw`, `issue_raw`, and `page_raw`.
241
242
 
242
243
  === Size template
243
244
 
@@ -252,6 +253,8 @@ The template draws on the defined types of locality of extents; the following ar
252
253
 
253
254
  | volume | ./medium/size[@type = 'volume'] | With internationalisation of label
254
255
  | volume_raw | ./medium/size[@type = 'volume'] |
256
+ | issue | ./medium/size[@type = 'issue'] | With internationalisation of label
257
+ | issue_raw | ./medium/size[@type = 'issue'] |
255
258
  | page | ./medium/size[@type = 'page'] | With internationalisation of label
256
259
  | page_raw | ./medium/size[@type = 'page'] |
257
260
  | data | ./medium/size[@type = 'data'] | Unit of size is included in value
@@ -23,6 +23,9 @@ extent:
23
23
  volume:
24
24
  sg: "% المجلد"
25
25
  pl: "% المجلدين"
26
+ issue:
27
+ sg: "% عدد"
28
+ pl: "% عدد"
26
29
  size:
27
30
  page:
28
31
  sg: "ص؜ %"
@@ -30,6 +33,9 @@ size:
30
33
  volume:
31
34
  sg: "المجلد %"
32
35
  pl: "المجلدين %"
36
+ issue:
37
+ sg: "% عدد"
38
+ pl: "% عدد"
33
39
  inflection:
34
40
  الطبعة؜:
35
41
  gender: f
@@ -22,6 +22,9 @@ extent:
22
22
  volume:
23
23
  sg: "Bd. %"
24
24
  pl: "Bde. %"
25
+ issue:
26
+ sg: "Nr. %"
27
+ pl: "Nr. %"
25
28
  size:
26
29
  page:
27
30
  sg: "% S."
@@ -29,6 +32,9 @@ size:
29
32
  volume:
30
33
  sg: "% Bd."
31
34
  pl: "% Bde."
35
+ issue:
36
+ sg: "% Nr."
37
+ pl: "% Nr."
32
38
  inflection:
33
39
  Auflage:
34
40
  gender: f
@@ -23,6 +23,9 @@ extent:
23
23
  volume:
24
24
  sg: "vol. %"
25
25
  pl: "vols. %"
26
+ issue:
27
+ sg: "no. %"
28
+ pl: "nos. %"
26
29
  size:
27
30
  page:
28
31
  sg: "% p."
@@ -30,4 +33,6 @@ size:
30
33
  volume:
31
34
  sg: "% vol."
32
35
  pl: "% vols."
33
-
36
+ issue:
37
+ sg: "% no."
38
+ pl: "% nos."
@@ -25,6 +25,9 @@ extent:
25
25
  volume:
26
26
  sg: "vol. %"
27
27
  pl: "vols. %"
28
+ issue:
29
+ sg: "núm. %"
30
+ pl: "núms. %"
28
31
  size:
29
32
  page:
30
33
  sg: "% pág."
@@ -32,6 +35,10 @@ size:
32
35
  volume:
33
36
  sg: "% vol."
34
37
  pl: "% vols."
38
+ issue:
39
+ sg: "% núm."
40
+ pl: "% núms."
41
+
35
42
  inflection:
36
43
  edición:
37
44
  gender: f
@@ -27,6 +27,9 @@ extent:
27
27
  volume:
28
28
  sg: "vol. %"
29
29
  pl: "vol. %"
30
+ issue:
31
+ sg: "nᵒ %"
32
+ pl: "nᵒˢ %"
30
33
  size:
31
34
  page:
32
35
  sg: "% p."
@@ -34,6 +37,9 @@ size:
34
37
  volume:
35
38
  sg: "% vol."
36
39
  pl: "% vol."
40
+ issue:
41
+ sg: "% nᵒ"
42
+ pl: "% nᵒˢ"
37
43
  inflection:
38
44
  édition:
39
45
  gender: f
@@ -29,6 +29,10 @@ extent:
29
29
  volume:
30
30
  sg: "т. %"
31
31
  pl: "тт. %"
32
+ issue:
33
+ sg: "шт. %"
34
+ pl: "шт. %"
35
+
32
36
  size:
33
37
  page:
34
38
  sg: "% стр."
@@ -36,6 +40,9 @@ size:
36
40
  volume:
37
41
  sg: "% т."
38
42
  pl: "% тт."
43
+ issue:
44
+ sg: "% шт."
45
+ pl: "% шт."
39
46
  inflection:
40
47
  издание:
41
48
  gender: n
@@ -23,6 +23,9 @@ extent:
23
23
  volume:
24
24
  sg: "第%卷"
25
25
  pl: "第%卷"
26
+ issue:
27
+ sg: "第%期"
28
+ pl: "第%期"
26
29
  size:
27
30
  page:
28
31
  sg: "%页"
@@ -30,3 +33,6 @@ size:
30
33
  volume:
31
34
  sg: "%卷"
32
35
  pl: "%卷"
36
+ issue:
37
+ sg: "%期"
38
+ pl: "%期"
@@ -34,7 +34,7 @@ module Relaton
34
34
  end
35
35
 
36
36
  def edition_fields_format(hash)
37
- hash[:edition] = editionformat(hash[:edition_raw])
37
+ hash[:edition] = editionformat(hash[:edition_raw], hash[:edition_num])
38
38
  hash[:draft] = draftformat(hash[:draft_raw], hash)
39
39
  end
40
40
 
@@ -95,11 +95,11 @@ module Relaton
95
95
  @r.i18n.get[role][number] || role
96
96
  end
97
97
 
98
- def editionformat(edn)
99
- return edn unless /^\d+$/.match?(edn)
98
+ def editionformat(edn, num)
99
+ return edn unless num || /^\d+$/.match?(edn)
100
100
 
101
- num = edition_translate1(edn.to_i)
102
- @r.edition_ordinal.sub(/%(Spellout|Ordinal)?/, num)
101
+ ret = edition_translate1(num || edn.to_i)
102
+ @r.edition_ordinal.sub(/%(Spellout|Ordinal)?/, ret)
103
103
  end
104
104
 
105
105
  def edition_translate1(num)
@@ -133,7 +133,7 @@ module Relaton
133
133
  end
134
134
 
135
135
  def extentformat1(key, val, hash, norm_hash)
136
- if %i(volume page).include?(key)
136
+ if %i(volume issue page).include?(key)
137
137
  hash["#{key}_raw".to_sym] = norm_hash[key]
138
138
  hash[key] = pagevolformat(norm_hash[key], val, key.to_s, false)
139
139
  end
@@ -164,6 +164,9 @@ module Relaton
164
164
  when "volume"
165
165
  hash[:volume_raw] = val
166
166
  hash[:volume] = pagevolformat(val, nil, "volume", true)
167
+ when "issue"
168
+ hash[:issue_raw] = val
169
+ hash[:issue] = pagevolformat(val, nil, "issue", true)
167
170
  when "page"
168
171
  hash[:page_raw] = val
169
172
  hash[:page] = pagevolformat(val, nil, "page", true)
@@ -15,12 +15,12 @@ extenttemplate:
15
15
  standard: book
16
16
  techreport: book
17
17
  inbook: "{{ volume }}: {{ page }}"
18
- misc: "{{ volume }}, {{ page }}, {{ duration }}"
18
+ misc: "{{ volume }} {{issue}} , {{ page }}, {{ duration }}"
19
19
  sizetemplate:
20
20
  dataset: "{{ data }}"
21
21
  electronic resource: dataset
22
22
  webresource: dataset
23
- misc: "{{ volume }}, {{ page }}, {{ data }}, {{ duration }}"
23
+ misc: "{{ volume }}, {{ issue }}, {{ page }}, {{ data }}, {{ duration }}"
24
24
  language: en
25
25
  script: Latn
26
26
  template:
@@ -27,7 +27,8 @@ module Relaton
27
27
  end
28
28
 
29
29
  def simple_or_host_xml2hash(doc, host)
30
- { edition_raw: edition(doc, host), medium_raw: medium(doc, host),
30
+ { edition_raw: edition(doc, host), edition_num: edition_num(doc, host),
31
+ medium_raw: medium(doc, host),
31
32
  place_raw: place(doc, host), publisher_raw: publisher(doc, host),
32
33
  publisher_abbrev_raw: publisher_abbrev(doc, host),
33
34
  distributor_raw: distributor(doc, host), draft_raw: draft(doc, host),
@@ -115,7 +115,10 @@ module Relaton
115
115
  x = pick_contributor(doc, "publisher")
116
116
  host and x ||= pick_contributor(host, "publisher")
117
117
  x.nil? and return nil
118
- x.map { |c| c.entity.abbreviation&.content }
118
+ x.map do |c|
119
+ c.entity.abbreviation&.content ||
120
+ c.entity.name.first&.content
121
+ end
119
122
  end
120
123
 
121
124
  def distributor(doc, host)
@@ -33,7 +33,11 @@ module Relaton
33
33
  end
34
34
 
35
35
  def edition(doc, host)
36
- doc.edition || host&.edition
36
+ doc.edition&.content || host&.edition&.content
37
+ end
38
+
39
+ def edition_num(doc, host)
40
+ doc.edition&.number || host&.edition&.number
37
41
  end
38
42
 
39
43
  def place(doc, host)
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Render
3
- VERSION = "0.3.7".freeze
3
+ VERSION = "0.3.10".freeze
4
4
  end
5
5
  end
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.3.7
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-30 00:00:00.000000000 Z
11
+ date: 2022-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -236,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
236
  - !ruby/object:Gem::Version
237
237
  version: '0'
238
238
  requirements: []
239
- rubygems_version: 3.3.14
239
+ rubygems_version: 3.3.16
240
240
  signing_key:
241
241
  specification_version: 4
242
242
  summary: Rendering of ISO 690 XML