relaton-render 0.3.9 → 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: 996ff1407f710b0195189008ac136236c636591071f5b1b6a93117d63f9bebda
4
- data.tar.gz: 538d2fb64f5ab0c9bcebf81dc0ae718199ee380bb882177a6ddfb064d7abe03b
3
+ metadata.gz: 963f65bd45b2b7d271822ba18c63f2a6e34768da2e77b73dee08f43ae9e68c3d
4
+ data.tar.gz: 989731f97b400da01dbf2d549b7319f3b04d4450f087866b1622ba381674c744
5
5
  SHA512:
6
- metadata.gz: 29448a51ba2bef275849506b3658e31eaa742514295b33d0ca0a9d4e9a2dabe30b0e83fc7570312a498c8fedbefe76ca98c7a660c54eea448128fa2d8f78d527
7
- data.tar.gz: 70d0b1a5705983207fa485d146a25534a02e403b3d8c7720142f22bab38690d26d6f7eb2ed5dc8d53d51b80e6c15f3038fe8a95a0249b3144a54c07cb586856c
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 |
@@ -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)
@@ -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),
@@ -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.9".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.9
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-06-24 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