metanorma-un 0.6.9 → 0.6.13

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bebff59ec3ff854c555b92c957234f6741e6bf178b8b88f849a9a1984eee4bf0
4
- data.tar.gz: e1c6234c1e97e715eb0162a12af1671aa095bec3ea184641c09e0ed27e80bfb9
3
+ metadata.gz: b7090558cbfbf23662a7b4c3d74d37e8f36f6ed5e9fd2533f4a60727b649103b
4
+ data.tar.gz: a66d7b14762d4d72ba18f136b5d21f6c9630e248bee55a4b77ba6ed609b55ee1
5
5
  SHA512:
6
- metadata.gz: 9845dc890c962b26f7f28a73cd8acddc2631b2656f9cbd66ff23715b7b5077087838f7948c23b770c6006f001f49c71097fde08def137e725437fa3ca9f73bb1
7
- data.tar.gz: c80f23d647165a1c4ad89bc7f7efed18f4c484ccbf495a9ef0a4a3a53bde0d68c241cb877c6ee093995987b90effeaab8ab3d7029c23aaea71a670bac2fb2d50
6
+ metadata.gz: 5489ca83efa7a1c79205c2ece2e831176280ba0ee916147ca0d8e5f35c34adb863a5ac6115e375c2462036c6baae47861dda1d359d70048ac4a934d74525fe9b
7
+ data.tar.gz: 25ddfbdf217fef36a89c60690b9f5592e30980fbcb9f505ceada556b7817dbe9813b4b0b773bf9cbdbfaf3c9e69913600925b81ce01a8744b9109c02b7e80cc3
data/Gemfile CHANGED
@@ -6,6 +6,6 @@ git_source(:github) { |repo| "https://github.com/#{repo}" }
6
6
 
7
7
  gemspec
8
8
 
9
- if File.exist? 'Gemfile.devel'
10
- eval File.read('Gemfile.devel'), nil, 'Gemfile.devel' # rubocop:disable Security/Eval
9
+ if File.exist? "Gemfile.devel"
10
+ eval File.read("Gemfile.devel"), nil, "Gemfile.devel" # rubocop:disable Security/Eval
11
11
  end
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
- require 'isodoc/gem_tasks'
3
+ require "isodoc/gem_tasks"
4
4
 
5
5
  IsoDoc::GemTasks.install
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
- task :default => :spec
8
+ task default: :spec
@@ -624,6 +624,9 @@
624
624
  <choice>
625
625
  <ref name="PureTextElement"/>
626
626
  <ref name="stem"/>
627
+ <ref name="eref"/>
628
+ <ref name="xref"/>
629
+ <ref name="hyperlink"/>
627
630
  </choice>
628
631
  </zeroOrMore>
629
632
  </element>
@@ -634,6 +637,9 @@
634
637
  <choice>
635
638
  <ref name="PureTextElement"/>
636
639
  <ref name="stem"/>
640
+ <ref name="eref"/>
641
+ <ref name="xref"/>
642
+ <ref name="hyperlink"/>
637
643
  </choice>
638
644
  </zeroOrMore>
639
645
  </element>
@@ -641,7 +647,12 @@
641
647
  <define name="tt">
642
648
  <element name="tt">
643
649
  <zeroOrMore>
644
- <ref name="PureTextElement"/>
650
+ <choice>
651
+ <ref name="PureTextElement"/>
652
+ <ref name="eref"/>
653
+ <ref name="xref"/>
654
+ <ref name="hyperlink"/>
655
+ </choice>
645
656
  </zeroOrMore>
646
657
  </element>
647
658
  </define>
@@ -822,7 +833,9 @@
822
833
  <attribute name="alt"/>
823
834
  </optional>
824
835
  <ref name="CitationType"/>
825
- <text/>
836
+ <oneOrMore>
837
+ <ref name="PureTextElement"/>
838
+ </oneOrMore>
826
839
  </define>
827
840
  <define name="hyperlink">
828
841
  <element name="link">
@@ -835,7 +848,9 @@
835
848
  <optional>
836
849
  <attribute name="alt"/>
837
850
  </optional>
838
- <text/>
851
+ <oneOrMore>
852
+ <ref name="PureTextElement"/>
853
+ </oneOrMore>
839
854
  </element>
840
855
  </define>
841
856
  <define name="xref">
@@ -849,7 +864,9 @@
849
864
  <optional>
850
865
  <attribute name="alt"/>
851
866
  </optional>
852
- <text/>
867
+ <oneOrMore>
868
+ <ref name="PureTextElement"/>
869
+ </oneOrMore>
853
870
  </element>
854
871
  </define>
855
872
  <define name="fn">
@@ -17,13 +17,14 @@ module Asciidoctor
17
17
 
18
18
  def metadata_committee(node, xml)
19
19
  return unless node.attr("committee")
20
+
20
21
  xml.editorialgroup do |a|
21
22
  a.committee node.attr("committee"),
22
- **attr_code(type: node.attr("committee-type"))
23
+ **attr_code(type: node.attr("committee-type"))
23
24
  i = 2
24
- while node.attr("committee_#{i}") do
25
+ while node.attr("committee_#{i}")
25
26
  a.committee node.attr("committee_#{i}"),
26
- **attr_code(type: node.attr("committee-type_#{i}"))
27
+ **attr_code(type: node.attr("committee-type_#{i}"))
27
28
  i += 1
28
29
  end
29
30
  end
@@ -66,13 +67,13 @@ module Asciidoctor
66
67
  xml.session do |session|
67
68
  session.number node.attr("session") if node.attr("session")
68
69
  session.date node.attr("session-date") if node.attr("session-date")
69
- node&.attr("item-number")&.split(/,[ ]*/)&.each do |i|
70
+ node&.attr("item-number")&.split(/, */)&.each do |i|
70
71
  session.item_number i
71
72
  end
72
- node&.attr("item-name")&.split(/,[ ]*/)&.each do |i|
73
+ node&.attr("item-name")&.split(/, */)&.each do |i|
73
74
  session.item_name i
74
75
  end
75
- node&.attr("subitem-name")&.split(/,[ ]*/)&.each do |i|
76
+ node&.attr("subitem-name")&.split(/, */)&.each do |i|
76
77
  session.subitem_name i
77
78
  end
78
79
  node.attr("collaborator") and
@@ -84,13 +85,13 @@ module Asciidoctor
84
85
  end
85
86
 
86
87
  def metadata_language(node, xml)
87
- languages = node&.attr("language")&.split(/,[ ]*/) ||
88
+ languages = node&.attr("language")&.split(/, */) ||
88
89
  %w(ar ru en fr zh es)
89
90
  languages.each { |l| xml.language l }
90
91
  end
91
92
 
92
93
  def metadata_submission_language(node, xml)
93
- languages = node&.attr("submissionlanguage")&.split(/,[ ]*/) || []
94
+ languages = node&.attr("submissionlanguage")&.split(/, */) || []
94
95
  languages.each { |l| xml.submissionlanguage l }
95
96
  end
96
97
 
@@ -101,7 +102,7 @@ module Asciidoctor
101
102
  metadata_submission_language(node, xml)
102
103
  end
103
104
 
104
- def title_validate(root)
105
+ def title_validate(_root)
105
106
  nil
106
107
  end
107
108
 
@@ -114,12 +115,11 @@ module Asciidoctor
114
115
 
115
116
  def doctype(node)
116
117
  d = super
117
- unless %w{plenary recommendation addendum communication corrigendum
118
- reissue agenda budgetary sec-gen-notes expert-report resolution
119
- plenary-attachment}.include? d
120
- @log.add(
121
- "Document Attributes", nil,
122
- "#{d} is not a legal document type: reverting to 'recommendation'")
118
+ unless %w{plenary recommendation addendum communication corrigendum
119
+ reissue agenda budgetary sec-gen-notes expert-report
120
+ resolution plenary-attachment}.include? d
121
+ @log.add("Document Attributes", nil,
122
+ "#{d} is not a legal document type: reverting to 'recommendation'")
123
123
  d = "recommendation"
124
124
  end
125
125
  d
@@ -128,11 +128,11 @@ module Asciidoctor
128
128
  def outputs(node, ret)
129
129
  File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
130
130
  presentation_xml_converter(node).convert(@filename + ".xml")
131
- html_converter(node).convert(@filename + ".presentation.xml",
131
+ html_converter(node).convert(@filename + ".presentation.xml",
132
132
  nil, false, "#{@filename}.html")
133
- doc_converter(node).convert(@filename + ".presentation.xml",
133
+ doc_converter(node).convert(@filename + ".presentation.xml",
134
134
  nil, false, "#{@filename}.doc")
135
- pdf_converter(node)&.convert(@filename + ".presentation.xml",
135
+ pdf_converter(node)&.convert(@filename + ".presentation.xml",
136
136
  nil, false, "#{@filename}.pdf")
137
137
  end
138
138
 
@@ -142,8 +142,8 @@ module Asciidoctor
142
142
  File.join(File.dirname(__FILE__), "un.rng"))
143
143
  end
144
144
 
145
- def style(n, t)
146
- return
145
+ def style(_node, _text)
146
+ nil
147
147
  end
148
148
 
149
149
  def html_extract_attributes(node)
@@ -168,6 +168,7 @@ module Asciidoctor
168
168
 
169
169
  def pdf_converter(node)
170
170
  return nil if node.attr("no-pdf")
171
+
171
172
  IsoDoc::UN::PdfConvert.new(doc_extract_attributes(node))
172
173
  end
173
174
 
@@ -196,25 +197,24 @@ module Asciidoctor
196
197
  xmldoc.xpath("//clause/p | //annex/p").each do |p|
197
198
  cl = Nokogiri::XML::Node.new("clause", xmldoc)
198
199
  cl["id"] = p["id"]
199
- cl["inline-header"]="true"
200
- p["id"] = "_" + UUIDTools::UUID.random_create
200
+ cl["inline-header"] = "true"
201
+ p["id"] = "_#{UUIDTools::UUID.random_create}"
201
202
  p.replace(cl)
202
203
  p.parent = cl
203
- while n = cl.next_element and !%w(p clause).include? n.name
204
+ while (n = cl.next_element) && !%w(p clause).include?(n.name)
204
205
  n.parent = cl
205
206
  end
206
207
  end
207
208
  end
208
209
 
209
210
  def admonition_attrs(node)
210
- attr_code(super.merge("unnumbered": node.option?("unnumbered"),
211
- "subsequence": node.attr("subsequence")))
211
+ attr_code(super.merge(unnumbered: node.option?("unnumbered"),
212
+ subsequence: node.attr("subsequence")))
212
213
  end
213
214
 
214
215
  def sectiontype_streamline(ret)
215
216
  case ret
216
- when "foreword" then "donotrecognise-foreword"
217
- when "introduction" then "donotrecognise-foreword"
217
+ when "foreword", "introduction" then "donotrecognise-foreword"
218
218
  else
219
219
  super
220
220
  end