metanorma-iec 2.2.4 → 2.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
1
  require_relative "init"
2
2
  require "isodoc"
3
+ require_relative "../../relaton/render-iec/general"
3
4
 
4
5
  module IsoDoc
5
6
  module Iec
@@ -233,6 +234,11 @@ module IsoDoc
233
234
  @i18n = @i18n_lg["default"]
234
235
  end
235
236
 
237
+ def bibrenderer
238
+ ::Relaton::Render::Iec::General.new(language: @lang,
239
+ i18nhash: @i18n.get)
240
+ end
241
+
236
242
  include Init
237
243
  end
238
244
  end
@@ -216,6 +216,9 @@
216
216
  <optional>
217
217
  <ref name="fullname"/>
218
218
  </optional>
219
+ <zeroOrMore>
220
+ <ref name="credential"/>
221
+ </zeroOrMore>
219
222
  <zeroOrMore>
220
223
  <ref name="affiliation"/>
221
224
  </zeroOrMore>
@@ -232,6 +235,11 @@
232
235
  <ref name="FullNameType"/>
233
236
  </element>
234
237
  </define>
238
+ <define name="credential">
239
+ <element name="credential">
240
+ <text/>
241
+ </element>
242
+ </define>
235
243
  <define name="FullNameType">
236
244
  <choice>
237
245
  <group>
@@ -305,7 +313,9 @@
305
313
  <zeroOrMore>
306
314
  <ref name="affiliationdescription"/>
307
315
  </zeroOrMore>
308
- <ref name="organization"/>
316
+ <optional>
317
+ <ref name="organization"/>
318
+ </optional>
309
319
  </element>
310
320
  </define>
311
321
  <define name="affiliationname">
@@ -134,7 +134,8 @@ module Metanorma
134
134
 
135
135
  def ol_attrs(node)
136
136
  attr_code(keep_attrs(node)
137
- .merge(id: ::Metanorma::Utils::anchor_or_uuid(node)))
137
+ .merge(id: ::Metanorma::Utils::anchor_or_uuid(node),
138
+ "explicit-type": olist_style(node.attributes[1])))
138
139
  end
139
140
 
140
141
  # TODO remove when I adopt pubid-iec
@@ -143,11 +144,11 @@ module Metanorma
143
144
  xmldoc.xpath("//bibdata/contributor[role/@type = 'publisher']" \
144
145
  "/organization").each_with_object([]) do |x, prefix|
145
146
  x1 = x.at("abbreviation")&.text || x.at("name")&.text
146
- #(x1 == "IEC" and prefix.unshift("IEC")) or prefix << x1
147
+ # (x1 == "IEC" and prefix.unshift("IEC")) or prefix << x1
147
148
  prefix << x1
148
149
  end
149
150
  end
150
- #
151
+
151
152
  def docidentifier_cleanup(xmldoc)
152
153
  prefix = get_id_prefix(xmldoc)
153
154
  id = xmldoc.at("//bibdata/docidentifier[@type = 'ISO']") or return
@@ -42,12 +42,14 @@ module Metanorma
42
42
  end
43
43
 
44
44
  def iso_id(node, xml)
45
- return unless node.attr("docnumber")
45
+ return unless node.attr("docnumber") || node.attr("docidentifier")
46
46
 
47
- part, subpart = node&.attr("partnumber")&.split(/-/)
48
- dn = add_id_parts(node.attr("docnumber"), part, subpart)
49
- dn = id_stage_prefix(dn, node)
50
- dn = id_edition_suffix(dn, node)
47
+ unless dn = node.attr("docidentifier")
48
+ part, subpart = node&.attr("partnumber")&.split(/-/)
49
+ dn = add_id_parts(node.attr("docnumber"), part, subpart)
50
+ dn = id_stage_prefix(dn, node)
51
+ dn = id_edition_suffix(dn, node)
52
+ end
51
53
  xml.docidentifier dn, **attr_code(type: "ISO")
52
54
  end
53
55
 
@@ -1578,6 +1578,9 @@
1578
1578
  <zeroOrMore>
1579
1579
  <ref name="indexsect"/>
1580
1580
  </zeroOrMore>
1581
+ <optional>
1582
+ <ref name="colophon"/>
1583
+ </optional>
1581
1584
  </element>
1582
1585
  </define>
1583
1586
  <define name="misccontainer">
@@ -1600,6 +1603,13 @@
1600
1603
  </oneOrMore>
1601
1604
  </element>
1602
1605
  </define>
1606
+ <define name="colophon">
1607
+ <element name="colophon">
1608
+ <oneOrMore>
1609
+ <ref name="content"/>
1610
+ </oneOrMore>
1611
+ </element>
1612
+ </define>
1603
1613
  <define name="foreword">
1604
1614
  <element name="foreword">
1605
1615
  <ref name="Content-Section"/>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.2.4".freeze
3
+ VERSION = "2.2.5".freeze
4
4
  end
5
5
  end
6
6
 
@@ -0,0 +1,57 @@
1
+ extenttemplate:
2
+ book: "{{ volume }} {{ page }}"
3
+ booklet: book
4
+ proceedings: book
5
+ journal: book
6
+ standard: book
7
+ techreport: book
8
+ inbook: "{{ volume }} {{ page }}"
9
+ misc: "{{ volume }} {{issue}} {{ page }}, {{ duration }}"
10
+ nametemplate:
11
+ one: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0]}} {{initials[0] | join: ''}}.{% endif %}"
12
+ two: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0]}} {{initials[0] | join: ''}}.{% endif %} , & {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{surname[1]}} {{initials[1] | join: ''}}.{% endif %}"
13
+ more: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0]}} {{initials[0] | join: ''}}.{% endif %} , {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{surname[1]}} {{initials[1] | join: ''}}. {% endif %} , & {% if nonpersonal[2] %}{{ nonpersonal[2] }}{% else %}{{surname[2]}} {{initials[2] | join: ''}}.{% endif %}"
14
+ # disabled the following: they should be provided in inheriting calls
15
+ # etal: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] | upcase}} ,_{%if given[0]%}{{given[0]}} {{middle[0]}}{%else%}{{initials[0] | join: ' '}}.{%endif%}{% endif %}, {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{%if given[1]%}{{given[1]}} {{middle[1]}}{%else%}{{initials[1] | join: ' '}}.{%endif%} {{surname[1] | upcase}}{% endif %} <em>et al.</em>"
16
+ # etal_count: 5
17
+ seriestemplate: "{% if series_formatted %}{{ series_formatted }}{%else%}{% if series_abbr %}{{series_abbr}}{% else %}{{series_title}}{% endif %} ({{series_run}}) {{series_num}}|({{series_partnumber}}){%endif%}"
18
+ journaltemplate: "<em>{% if series_abbr %}{{series_abbr}}{% else %}{{series_title}}{% endif %}</em> ({{series_run}}) {{ labels['volume'] }}_{{series_num}} {{ labels['part'] }}_{{series_partnumber}}"
19
+ template:
20
+ # skip standardidentifier, it is inserted in front of formattedref within metanorma
21
+ standard: "{% if home_standard %}<em><span_class='stddocTitle'>{{ title }}</span></em> ,_{{ extent }}{% else %}<smallcap>{{ creatornames }}</smallcap>. <em><span_class='stddocTitle'>{{ title }}</span></em> ,_{{ extent }} . {{ labels['version'] | capitalize }}_{{ edition_raw }}. {{labels['updated'] | capitalize }}_{{date_updated}}. {{status | capitalize}}. {{ authorizer }}. {{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>.{% endif %}"
22
+ website: "<smallcap>{{ creatornames }}</smallcap> ({{ role }}) . <em><span_class='stddocTitle'>{{ title }}</span></em> [website]. {{ labels['version'] | capitalize }}_{{ edition_raw }}. {{place}}: {{ publisher }}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
23
+ book: "<smallcap>{{ creatornames }}</smallcap> ({{role}}) . <em>{{ title }}</em> . {{ edition | capitalize_first }}. ({{ series }}). {% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}: {{publisher}}. {{date}}. {{size}}. {{extent}}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
24
+ booklet: book
25
+ manual: book
26
+ techreport: book
27
+ proceedings: book
28
+ inbook: "<smallcap>{{ creatornames }}</smallcap> ({{role}}) . {{ title }} . <em>{{host_title}}</em> ({{host_role}} {{ host_creatornames}}). {{ edition | capitalize_first }}. ({{ series }}). {% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}: {{publisher}}. {{date}}. {{size}}. {{extent}}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
29
+ inproceedings: inbook
30
+ incollection: inbook
31
+ journal: "<em>{{ title}}</em> . {{ edition | capitalize_first }}. {{place}}: {{publisher}}. {{date}}. {{size}}. {{extent}}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
32
+ article: "<smallcap>{{ creatornames }}</smallcap> ({{role}}) . {{ title }}. {{ series }} . {{date}}, {{ extent }}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
33
+ software: "<smallcap>{{ creatornames }}</smallcap> ({{ role}}) . <em>{{ title }}</em> . {{ labels['version'] | capitalize }}_{{ edition_raw }}. {{medium | capitalize}}. {{place}}: {{publisher}}. {{date}}. {{size}}. {{extent}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
34
+ electronic resource: software
35
+ dataset: "<smallcap>{{ creatornames }}</smallcap> ({{ 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 '. ' }}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. {{ size }}. {{ extent}}. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
36
+ webresource: website
37
+ unpublished: "<smallcap>{{ creatornames }}</smallcap> ({{ role }}) . <em>{{ title }}</em> . {{ medium | capitalize }}. {{ date }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. [{{ labels['viewed'] }}:_{{date_accessed}}]."
38
+ presentation: unpublished
39
+ thesis: "<smallcap>{{ creatornames }}</smallcap> ({{ role }}) . <em>{{ title }}</em> . {{ medium | capitalize }}. {{place}}: {{ publisher }}. {{ date }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. [{{ labels['viewed'] }}:_{{date_accessed}}]."
40
+ misc: "<smallcap>{{ creatornames }}</smallcap> ({{ role }}) . <em>{{ title }}</em> . {{ date }}."
41
+ # following are # unsupported types:
42
+ map: misc
43
+ audiovisual: misc
44
+ film: misc
45
+ video: misc
46
+ broadcast: misc
47
+ graphic_work: misc
48
+ music: misc
49
+ performance: misc
50
+ patent: misc
51
+ archival: misc
52
+ social_media: misc
53
+ alert: misc
54
+ message: misc
55
+ conversation: misc
56
+ internal: misc
57
+
@@ -0,0 +1,20 @@
1
+ require "relaton-render"
2
+ require "isodoc"
3
+ require_relative "parse"
4
+
5
+ module Relaton
6
+ module Render
7
+ module Iec
8
+ class General < ::Relaton::Render::IsoDoc::General
9
+ def config_loc
10
+ YAML.load_file(File.join(File.dirname(__FILE__), "config.yml"))
11
+ end
12
+
13
+ def klass_initialize(_options)
14
+ super
15
+ @parseklass = Relaton::Render::Iec::Parse
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ module Relaton
2
+ module Render
3
+ module Iec
4
+ class Parse < ::Relaton::Render::Parse
5
+ def simple_or_host_xml2hash(doc, host)
6
+ ret = super
7
+ ret.merge(home_standard: home_standard(doc, ret[:publisher_raw]))
8
+ end
9
+
10
+ def home_standard(_doc, pubs)
11
+ pubs&.any? do |r|
12
+ ["International Organization for Standardization", "ISO",
13
+ "International Electrotechnical Commission", "IEC"]
14
+ .include?(r[:nonpersonal])
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.4
4
+ version: 2.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-07 00:00:00.000000000 Z
11
+ date: 2023-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso
@@ -250,6 +250,9 @@ files:
250
250
  - lib/metanorma/iec/relaton-iec.rng
251
251
  - lib/metanorma/iec/reqt.rng
252
252
  - lib/metanorma/iec/version.rb
253
+ - lib/relaton/render-iec/config.yml
254
+ - lib/relaton/render-iec/general.rb
255
+ - lib/relaton/render-iec/parse.rb
253
256
  - metanorma-iec.gemspec
254
257
  homepage: https://github.com/metanorma/metanorma-iec
255
258
  licenses: