metanorma-jis 0.4.2 → 0.4.4

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.
@@ -70,19 +70,19 @@ module IsoDoc
70
70
  end
71
71
 
72
72
  def move_participants(doc)
73
- p = doc.at(ns("//clause[@type = 'participants']")) or return
74
- t = participant_table(p) or return
75
- p.remove
76
- ins = make_preface(doc) or return nil
77
- ins.add_first_child t
73
+ doc.xpath(ns("//clause[@type = 'participants']")).reverse_each do |p|
74
+ t = participant_table(p) or next
75
+ p.remove
76
+ ins = make_preface(doc) or next
77
+ ins.add_first_child t
78
+ end
78
79
  end
79
80
 
80
81
  def participant_table(clause)
81
- s = clause.at(ns("./sourcecode")) or return nil
82
- y = YAML.safe_load(s.children.to_xml(encoding: "UTF-8")) or return nil
83
- y.is_a?(Array) or return nil
82
+ s, t, y, d = participant_table_prep(clause)
83
+ s or return nil
84
84
  out1 = <<~OUTPUT
85
- <clause id='_#{UUIDTools::UUID.random_create}'><title>#{@meta.get[:"investigative-committee"]} #{@i18n.membership_table}</title>
85
+ <clause id='_#{UUIDTools::UUID.random_create}' type="participants"><title>#{t}</title>
86
86
  <table unnumbered='true'>
87
87
  <thead>
88
88
  <tr><th/><th>#{@i18n.full_name}</th><th>#{@i18n.affiliation}</th></tr>
@@ -90,11 +90,21 @@ module IsoDoc
90
90
  <tbody>
91
91
  OUTPUT
92
92
  out2 = <<~OUTPUT
93
- </tbody></table></clause>
93
+ </tbody>#{d&.to_xml}</table></clause>
94
94
  OUTPUT
95
95
  "#{out1}#{participant_rows(y)}#{out2}"
96
96
  end
97
97
 
98
+ def participant_table_prep(clause)
99
+ s = clause.at(ns("./sourcecode"))
100
+ t = clause.at(ns("./title"))&.children&.to_xml ||
101
+ %(#{@meta.get[:"investigative-committee"]} #{@i18n.membership_table})
102
+ y = YAML.safe_load(s.children.to_xml(encoding: "UTF-8"))
103
+ d = clause.at(ns("./dl[@key = 'true']"))
104
+ s && y.is_a?(Array) or return [nil, nil, nil, nil]
105
+ [s, t, y, d]
106
+ end
107
+
98
108
  def participant_rows(yaml)
99
109
  yaml.map do |y|
100
110
  r = y["role"] ? @i18n.l10n("(#{y['role']})") : ""
@@ -76,6 +76,7 @@ module IsoDoc
76
76
 
77
77
  def dl_to_para_name(node)
78
78
  e = node.at(ns("./fmt-name")) or return ""
79
+ node.parent.parent["type"] == "participants" and return ""
79
80
  "<p class='ListTitle'>#{e.children.to_xml}</p>"
80
81
  end
81
82
 
@@ -267,11 +267,11 @@ Detailed in https://www.relaton.org/model/creator/</a:documentation>
267
267
  <a:documentation>An identifier of the person according to an international identifier scheme</a:documentation>
268
268
  </ref>
269
269
  </zeroOrMore>
270
- <zeroOrMore>
270
+ <optional>
271
271
  <ref name="contact">
272
272
  <a:documentation>Contact information for the person, including URI, address, phone number, and email</a:documentation>
273
273
  </ref>
274
- </zeroOrMore>
274
+ </optional>
275
275
  </element>
276
276
  </define>
277
277
  <define name="fullname">
@@ -454,11 +454,11 @@ real names (if the person is named with a pseudonym or user name); previous lega
454
454
  <a:documentation>An identifier of the organization according to an international identifier scheme</a:documentation>
455
455
  </ref>
456
456
  </zeroOrMore>
457
- <zeroOrMore>
457
+ <optional>
458
458
  <ref name="contact">
459
459
  <a:documentation>Contact information for the organization, including address, phone number, and email</a:documentation>
460
460
  </ref>
461
- </zeroOrMore>
461
+ </optional>
462
462
  <optional>
463
463
  <ref name="logo">
464
464
  <a:documentation>A logo for the organization</a:documentation>
@@ -540,12 +540,18 @@ real names (if the person is named with a pseudonym or user name); previous lega
540
540
  <!-- TODO may change -->
541
541
  <define name="contact">
542
542
  <a:documentation>Contact information for a person or organization</a:documentation>
543
- <choice>
543
+ <zeroOrMore>
544
544
  <ref name="address"/>
545
+ </zeroOrMore>
546
+ <zeroOrMore>
545
547
  <ref name="phone"/>
548
+ </zeroOrMore>
549
+ <zeroOrMore>
546
550
  <ref name="email"/>
551
+ </zeroOrMore>
552
+ <zeroOrMore>
547
553
  <ref name="uri"/>
548
- </choice>
554
+ </zeroOrMore>
549
555
  </define>
550
556
  <define name="phone">
551
557
  <a:documentation>The phone number associated with a person or organization</a:documentation>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Jis
3
- VERSION = "0.4.2".freeze
3
+ VERSION = "0.4.4".freeze
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-jis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-10 00:00:00.000000000 Z
11
+ date: 2025-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: japanese_calendar
@@ -322,7 +322,7 @@ homepage: https://github.com/metanorma/metanorma-jis
322
322
  licenses:
323
323
  - BSD-2-Clause
324
324
  metadata: {}
325
- post_install_message:
325
+ post_install_message:
326
326
  rdoc_options: []
327
327
  require_paths:
328
328
  - lib
@@ -338,7 +338,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
338
338
  version: '0'
339
339
  requirements: []
340
340
  rubygems_version: 3.3.27
341
- signing_key:
341
+ signing_key:
342
342
  specification_version: 4
343
343
  summary: metanorma-jis lets you write JIS standards in AsciiDoc.
344
344
  test_files: []