relaton-render 0.4.4 → 0.5.0

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: 3e355ba215a67c891399708f72baabeba37cddfc01a43df6d722c0a1aa769878
4
- data.tar.gz: cdc21aa38ecdadab907db21b1b0cf58b8ce1f2ebc7966be7a894b4f58ffc3919
3
+ metadata.gz: b9c876441b0795c06974791ff6c689262426266b59c0de09d2b7d4d64ac347bb
4
+ data.tar.gz: aa0f083b296c8156c94debdf34797941cca2a22e714821810020657c1dfaff2a
5
5
  SHA512:
6
- metadata.gz: f52456f0d7708e911a731fb6f584aed61cced226ed4f7a5de54407b0563ccaa5e5d182472cc0d01d2a59e13d1955910b8cfed1fd601d79ac88745ec6cab45743
7
- data.tar.gz: aeb47b97f4146f90bdc86a3e2b5637e35675c67e37bb79b49010a450d34adcfb5c2792b3334ecedf8ff2749bc3511afaeb42442cf35eb8ef840f56d2599f654c
6
+ metadata.gz: 475ab58c7d8c60be6a42312a32900460702b72bd6e523df26a0b9cbd5e78b2fbc90c3316102c089197730693d08be123cf4492aabe90c5a8817a52de59d06eb9
7
+ data.tar.gz: 9a604112f31a1a0d634a598e0a03a3137706d585502f7df7f6264bafc22c2fae0ec724bd512b11ffbab923b4ba76fc1ed9ed07f375861f32e1213518cc016d41
@@ -0,0 +1,22 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: release
4
+
5
+ on:
6
+ workflow_dispatch:
7
+ inputs:
8
+ next_version:
9
+ description: |
10
+ Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
11
+ required: true
12
+ default: 'skip'
13
+ push:
14
+ tags: [ v* ]
15
+
16
+ jobs:
17
+ release:
18
+ uses: relaton/support/.github/workflows/release.yml@master
19
+ with:
20
+ next_version: ${{ github.event.inputs.next_version }}
21
+ secrets:
22
+ rubygems-api-key: ${{ secrets.RELATON_CI_RUBYGEMS_API_KEY }}
data/README.adoc CHANGED
@@ -155,13 +155,14 @@ drawn from the bibliographic item:
155
155
  | place | ./place | | Y |
156
156
  | publisher | ./contributor[role/@type = 'publisher']/organization/name | | Y |
157
157
  | distributor | ./contributor[role/@type = 'distributor']/organization/name | | Y |
158
- | standardidentifier | ./docidentifier[not(@type = 'metanorma' or @type = 'ordinal')] | Y | |
158
+ | authoritative_identifier | ./docidentifier[not(@type = 'metanorma' or @type = 'ordinal' or @type = 'ISBN' or @type = 'ISSN' or @type = 'DOI')] | Y | |
159
+ | other_identifier | ./docidentifier[@type = 'ISBN' or @type = 'ISSN' or @type = 'DOI'] | Y | | By default, each such identifier is prefixed with its type and colon
159
160
  | status | ./status | | | Rendering varies by flavour
160
161
  | uri | ./uri[@type = 'doi' or @type = 'uri' or @type = 'src' or true] | | |
161
162
  | access_location | ./accessLocation | | Y |
162
163
  | extent | ./extent | Y | | Render with standard abbreviations for pp, vols, with n-dash, with delimiting of multiple locations
163
- | creatornames | ./contributor[role/@type = 'author'] \| ./contributor[role/@type = 'performer'] \| ./contributor[role/@type = 'adapter'] \| ./contributor[role/@type = 'translator'] \| ./contributor[role/@type = 'editor'] \| ./contributor[role/@type = 'publisher'] \| ./contributor[role/@type = 'distributor'] \| ./contributor | Y | | <<nametemplate,`nametemplate`>> applied to each name; joining template from internationalisation applied to multiple names
164
- | authorcite | ./contributor[role/@type = 'author'] \| ./contributor[role/@type = 'performer'] \| ./contributor[role/@type = 'adapter'] \| ./contributor[role/@type = 'translator'] \| ./contributor[role/@type = 'editor'] \| ./contributor[role/@type = 'publisher'] \| ./contributor[role/@type = 'distributor'] \| ./contributor | Y | | <<authorcitetemplate,`authorcitetemplate`>> applied to each name; joining template from internationalisation applied to multiple names
164
+ | creatornames | ./contributor[role/@type = 'author'] \| ./contributor[role/@type = 'performer'] \| ./contributor[role/@type = 'adapter'] \| ./contributor[role/@type = 'translator'] \| ./contributor[role/@type = 'editor'] \| ./contributor[role/@type = 'distributor'] \| ./contributor | Y | | <<nametemplate,`nametemplate`>> applied to each name; joining template from internationalisation applied to multiple names
165
+ | authorcite | ./contributor[role/@type = 'author'] \| ./contributor[role/@type = 'performer'] \| ./contributor[role/@type = 'adapter'] \| ./contributor[role/@type = 'translator'] \| ./contributor[role/@type = 'editor'] \| ./contributor[role/@type = 'distributor'] \| ./contributor | Y | | <<authorcitetemplate,`authorcitetemplate`>> applied to each name; joining template from internationalisation applied to multiple names
165
166
  | role | ./contributor[role/description] \| ./contributor[role/@type] | | |
166
167
  | date | ./date[@type = 'issued'] \| ./date[@type = 'circulated'] \| ./date | | Y |
167
168
  | date_updated | ./date[@type = 'updated'] | | Y |
@@ -31,35 +31,35 @@ sizetemplate:
31
31
  language: en
32
32
  script: Latn
33
33
  template:
34
- book: "{{ creatornames }} ({{role}}) . <em>{{ title }}</em> [{{medium}}] . {{ edition | capitalize_first }}. ({{ series }}.) {% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}: {{publisher}}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ standardidentifier | first }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]. {{size}}. {{extent}}."
34
+ book: "{{ creatornames }} ({{role}}) . <em>{{ title }}</em> [{{medium}}] . {{ edition | capitalize_first }}. ({{ series }}.) {% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}: {{publisher}}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]. {{size}}. {{extent}}."
35
35
  # TODO: omitted: author ids, subsidiary titles, subsidiary creators, rights metadata, distributor, item attributes, relationships
36
36
  booklet: book
37
37
  manual: book
38
38
  proceedings: book
39
- inbook: "{{ creatornames }} ({{role}}) . {{ title }} . {{ labels['in'] | capitalize }}: {{ host_creatornames}} ({{ host_role}}) : <em>{{host_title}}</em> [{{medium}}] . {{ edition | capitalize_first }}. ({{ series }}.) {% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}: {{publisher}}. {{date}}. {{size}}. {{extent}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ standardidentifier | first }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
39
+ inbook: "{{ creatornames }} ({{role}}) . {{ title }} . {{ labels['in'] | capitalize }}: {{ host_creatornames}} ({{ host_role}}) : <em>{{host_title}}</em> [{{medium}}] . {{ edition | capitalize_first }}. ({{ series }}.) {% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}: {{publisher}}. {{date}}. {{size}}. {{extent}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
40
40
  inproceedings: inbook
41
41
  incollection: inbook
42
42
  # TODO: omitted: author ids, additional info for component part, subsidiary titles of host resource, rights metadata, distributor, relationships
43
- journal: "<em>{{ title}}</em> [{{medium}}] . {{ edition | capitalize_first }}. {{place}}: {{publisher}}. {{date}}. {{size}}. {{extent}}. {{ standardidentifier | first }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
43
+ journal: "<em>{{ title}}</em> [{{medium}}] . {{ edition | capitalize_first }}. {{place}}: {{publisher}}. {{date}}. {{size}}. {{extent}}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
44
44
  # TODO subsidiary titles, rights metadata, item attributes, relationships
45
- article: "{{ creatornames }} ({{role}}) . {{ title }}. {{ series }} [{{medium}}] . {{ edition | capitalize_first }}. {{size}}. {{ extent }}. {{place}}: {{publisher}}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ standardidentifier | first }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
45
+ article: "{{ creatornames }} ({{role}}) . {{ title }}. {{ series }} [{{medium}}] . {{ edition | capitalize_first }}. {{size}}. {{ extent }}. {{place}}: {{publisher}}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
46
46
  # TODO: omitted: author ids, subsidiary titles, rights metadata, distributor, item attributes, relationships; newspapers
47
- software: "{{ creatornames }} ({{ role}}) . <em>{{ title }}</em> . {{ labels['version'] | capitalize }}_{{ edition_raw }}. {{medium | capitalize}}. {{place}}: {{publisher}}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ standardidentifier | first }}. {{ uri }}. {{size}}. {{ extent}}. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
47
+ software: "{{ creatornames }} ({{ role}}) . <em>{{ title }}</em> . {{ 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}}]. "
48
48
  # TODO: omitted: author ids, subsidiary titles, subsidiary creators, copyright, license, distributor, system requirements, relationships
49
49
  electronic resource: software
50
- standard: "{{ creatornames }} ({{ role}}) . <em>{{ title }}</em> . {{ labels['in'] | capitalize }}:_{{ series_title }}. {{ medium | capitalize }}. {{ edition | capitalize_first }}. {{place}}: {{publisher}}. {{date}}. {{size}}. {{ extent }}. {{ standardidentifier | first }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
50
+ standard: "{{ creatornames }} ({{ role}}) . {{ authoritative_identifier | join '|' }}: <em>{{ title }}</em> . {{ 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
51
  # TODO: omitted: author ids, subsidiary titles, rights metadata, distributor, persistent identifier, item attributes, relationships
52
52
  techreport: standard
53
- dataset: "{{ creatornames }} ({{ role }}) . <em>{{ title }}</em> . {{ labels['version'] | capitalize }}_{{ edition_raw }}. {{medium | capitalize }}. {{ labels['in'] | capitalize }}:_{{series}}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ standardidentifier | first }}. {{ uri }}. {{ size }}. {{ extent}}. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
53
+ dataset: "{{ creatornames }} ({{ role }}) . <em>{{ title }}</em> . {{ 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}}]. "
54
54
  # TODO: omitted: author ids, system requirements, host archive, copyright, license, data source, distributor, usage instructions, relationships, provenance
55
- website: "{{ creatornames }} ({{ role }}) . <em>{{ title }}</em> . {{ labels['version'] | capitalize }}_{{ edition_raw }}. {{medium | capitalize }}. {{ place }}: {{ publisher }}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ standardidentifier | first }}. {{ uri }}. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
55
+ website: "{{ creatornames }} ({{ role }}) . <em>{{ title }}</em> . {{ labels['version'] | capitalize }}_{{ edition_raw }}. {{medium | capitalize }}. {{ place }}: {{ publisher }}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
56
56
  # TODO: omitted: author ids, page title, system requirements, subsidiary creator, rights metadata, distributor, persistent identifier, archive location, archive date and time, relationships
57
57
  webresource: website
58
58
  # TODO: component part
59
- unpublished: "{{ creatornames }} ({{ role }}) . <em>{{ title }}</em> . {{ medium | capitalize }}. {{ date }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. {{ standardidentifier | first }}. {{ uri }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
59
+ unpublished: "{{ creatornames }} ({{ role }}) . <em>{{ title }}</em> . {{ medium | capitalize }}. {{ date }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
60
60
  # TODO: omitted: author ids, subsidiary titles, subsidiary creators, host archive, item attributes, relationships
61
61
  presentation: unpublished
62
- thesis: "{{ creatornames }} ({{ role }}) . <em>{{ title }}</em> . {{ medium | capitalize }}. {{ place }}: {{ publisher }}. {{ date }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. {{ standardidentifier | first }}. {{ uri }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
62
+ thesis: "{{ creatornames }} ({{ role }}) . <em>{{ title }}</em> . {{ medium | capitalize }}. {{ place }}: {{ publisher }}. {{ date }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
63
63
  misc: "{{ creatornames }} ({{ role }}) . <em>{{ title }}</em> . {{ date }}."
64
64
  # following are # unsupported types:
65
65
  map: misc
@@ -40,7 +40,7 @@ module Relaton
40
40
 
41
41
  def root_initalize(opt)
42
42
  i18n_initialize(opt)
43
- @parse = @parseklass.new(lang: @lang, script: @script)
43
+ @parse = @parseklass.new(lang: @lang, script: @script, i18n: @i18n)
44
44
  @nametemplate = @nametemplateklass
45
45
  .new(template: opt["nametemplate"], i18n: @i18n)
46
46
  @authorcitetemplate = @authorcitetemplateklass
@@ -9,6 +9,7 @@ module Relaton
9
9
  def initialize(options)
10
10
  @lang = options[:lang] || "en"
11
11
  @script = options[:script] || "Latn"
12
+ @i18n = options[:i18n]
12
13
  end
13
14
 
14
15
  def extract(doc)
@@ -21,8 +22,9 @@ module Relaton
21
22
  def simple_xml2hash(doc)
22
23
  creators, role = creatornames(doc)
23
24
  { type: type(doc), title: title(doc), extent_raw: extent(doc),
24
- size_raw: size(doc),
25
- standardidentifier: standardidentifier(doc), uri_raw: uri(doc),
25
+ size_raw: size(doc), uri_raw: uri(doc),
26
+ authoritative_identifier: authoritative_identifier(doc),
27
+ other_identifier: other_identifier(doc),
26
28
  status: status(doc), creators: creators, role_raw: role }
27
29
  end
28
30
 
@@ -52,7 +52,7 @@ module Relaton
52
52
  end
53
53
 
54
54
  def creatornames_roles_allowed
55
- %w(author performer adapter translator editor publisher distributor)
55
+ %w(author performer adapter translator editor distributor)
56
56
  end
57
57
 
58
58
  def creatornames1(doc)
@@ -44,7 +44,15 @@ module Relaton
44
44
  x = doc.place
45
45
  x.empty? && host and x = host.place
46
46
  x.empty? and return x
47
- x.map(&:name)
47
+ x.map { |p| place1(p) }
48
+ end
49
+
50
+ def place1(place)
51
+ place.city.nil? && place.region.empty? && place.country.empty? and
52
+ return place.name
53
+ ret = [place.city] + place.region.map(&:name) +
54
+ place.country.map(&:name)
55
+ @i18n.l10n(ret.compact.join(", "))
48
56
  end
49
57
 
50
58
  def series(doc)
@@ -82,14 +90,25 @@ module Relaton
82
90
  series.run
83
91
  end
84
92
 
85
- def standardidentifier(doc)
93
+ def authoritative_identifier(doc)
94
+ doc.docidentifier.each_with_object([]) do |id, ret|
95
+ ret << id.id unless authoritative_identifier_exclude.include? id.type
96
+ end
97
+ end
98
+
99
+ def authoritative_identifier_exclude
100
+ %w(metanorma metanorma-ordinal) + other_identifier_include
101
+ end
102
+
103
+ def other_identifier(doc)
86
104
  doc.docidentifier.each_with_object([]) do |id, ret|
87
- ret << id.id unless standardidentifier_exclude.include? id.type
105
+ other_identifier_include.include? id.type or next
106
+ ret << @i18n.l10n("#{id.type}: #{id.id}")
88
107
  end
89
108
  end
90
109
 
91
- def standardidentifier_exclude
92
- %w(metanorma metanorma-ordinal)
110
+ def other_identifier_include
111
+ %w(ISSN ISBN DOI)
93
112
  end
94
113
 
95
114
  def uri(doc)
@@ -73,9 +73,9 @@ module Relaton
73
73
  def template_clean1(str)
74
74
  str.gsub(/\S*#{FIELD_DELIM}#{FIELD_DELIM}\S*/o, "")
75
75
  .gsub(/#{FIELD_DELIM}/o, "")
76
- .gsub(/([,:;]\s*)+([,:;](\s|$))/, "\\2")
77
- .gsub(/([,.:;]\s*)+([.](\s|$))/, "\\2")
78
- .gsub(/([,:;]\s*)+(,(\s|$))/, "\\2")
76
+ .gsub(/([,:;]\s*)+([,:;](\s|_|$))/, "\\2")
77
+ .gsub(/([,.:;]\s*)+([.](\s|_|$))/, "\\2")
78
+ .gsub(/([,:;]\s*)+(,(\s|_|$))/, "\\2")
79
79
  .gsub(/(:\s+)(&\s)/, "\\2")
80
80
  .gsub(/\s+([,.:;)])/, "\\1")
81
81
  .sub(/^\s*[,.:;]\s*/, "")
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Render
3
- VERSION = "0.4.4".freeze
3
+ VERSION = "0.5.0".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.4.4
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-23 00:00:00.000000000 Z
11
+ date: 2022-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -186,6 +186,7 @@ extensions: []
186
186
  extra_rdoc_files: []
187
187
  files:
188
188
  - ".github/workflows/rake.yml"
189
+ - ".github/workflows/release.yml"
189
190
  - ".hound.yml"
190
191
  - ".rubocop.yml"
191
192
  - Gemfile
@@ -222,7 +223,7 @@ homepage: https://github.com/relaton/relaton-render
222
223
  licenses:
223
224
  - BSD-2-Clause
224
225
  metadata: {}
225
- post_install_message:
226
+ post_install_message:
226
227
  rdoc_options: []
227
228
  require_paths:
228
229
  - lib
@@ -237,8 +238,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
238
  - !ruby/object:Gem::Version
238
239
  version: '0'
239
240
  requirements: []
240
- rubygems_version: 3.3.16
241
- signing_key:
241
+ rubygems_version: 3.1.6
242
+ signing_key:
242
243
  specification_version: 4
243
244
  summary: Rendering of ISO 690 XML
244
245
  test_files: []