metanorma-itu 1.3.10 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/Rakefile +2 -2
  4. data/bin/rspec +1 -2
  5. data/lib/asciidoctor/itu/basicdoc.rng +21 -4
  6. data/lib/asciidoctor/itu/converter.rb +3 -7
  7. data/lib/asciidoctor/itu/front.rb +5 -61
  8. data/lib/asciidoctor/itu/front_id.rb +67 -0
  9. data/lib/asciidoctor/itu/isodoc.rng +435 -78
  10. data/lib/asciidoctor/itu/itu.rng +3 -8
  11. data/lib/asciidoctor/itu/reqt.rng +23 -2
  12. data/lib/asciidoctor/itu/validate.rb +33 -31
  13. data/lib/asciidoctor/itu.rb +0 -1
  14. data/lib/isodoc/itu/base_convert.rb +5 -2
  15. data/lib/isodoc/itu/html/htmlstyle.css +6 -0
  16. data/lib/isodoc/itu/html/htmlstyle.scss +7 -0
  17. data/lib/isodoc/itu/html/wordstyle.css +29 -8
  18. data/lib/isodoc/itu/html/wordstyle.scss +29 -8
  19. data/lib/isodoc/itu/i18n-ar.yaml +1 -0
  20. data/lib/isodoc/itu/i18n-de.yaml +1 -0
  21. data/lib/isodoc/itu/i18n-en.yaml +1 -0
  22. data/lib/isodoc/itu/i18n-es.yaml +1 -0
  23. data/lib/isodoc/itu/i18n-fr.yaml +1 -0
  24. data/lib/isodoc/itu/i18n-ru.yaml +1 -0
  25. data/lib/isodoc/itu/i18n-zh-Hans.yaml +1 -0
  26. data/lib/isodoc/itu/i18n.rb +1 -2
  27. data/lib/isodoc/itu/init.rb +1 -2
  28. data/lib/isodoc/itu/itu.implementers-guide.xsl +175 -14
  29. data/lib/isodoc/itu/itu.in-force.xsl +175 -14
  30. data/lib/isodoc/itu/itu.recommendation-annex.xsl +175 -14
  31. data/lib/isodoc/itu/itu.recommendation-supplement.xsl +175 -14
  32. data/lib/isodoc/itu/itu.recommendation.xsl +175 -14
  33. data/lib/isodoc/itu/itu.resolution.xsl +175 -14
  34. data/lib/isodoc/itu/itu.service-publication.xsl +175 -14
  35. data/lib/isodoc/itu/itu.technical-paper.xsl +175 -14
  36. data/lib/isodoc/itu/itu.technical-report.xsl +175 -14
  37. data/lib/isodoc/itu/metadata.rb +3 -2
  38. data/lib/isodoc/itu/pdf_convert.rb +5 -4
  39. data/lib/isodoc/itu/terms.rb +9 -6
  40. data/lib/isodoc/itu.rb +0 -1
  41. data/lib/metanorma/itu/version.rb +1 -1
  42. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9fedf3f6b88ed3fec5d058a59d289f893646fbcdea430d5f628c2c5f4801b4e
4
- data.tar.gz: e569b3339b3437a5ac5db0b72a94fa6b6c8647e64d64e7c6690a3af5c9cc57b2
3
+ metadata.gz: 289ed3fed7e3c8d9a52e0de224e73db390c93a2378ae0a25c66d2ff12af255fd
4
+ data.tar.gz: fba11b78fa3488fc1f1ac9642d602e8eafc7bff0d4b9af09bbf929f868f89eb8
5
5
  SHA512:
6
- metadata.gz: b7870e02cd137d2f25bc39b552dee726ec92144e45b60a3aaf733285eb2394a5cb040f0a38eeef43a0f7fca7f5fca54326c780e4c9c2a0a502667ee497d7ae54
7
- data.tar.gz: 02d819038572881fb4882a20cc4a5ee18c96853226e8ca6820600391af390230128cbf32842660ede1e756976efbbfbcc73990bbb4caa51551f9943f20f2aa04
6
+ metadata.gz: bf6c0f9873c415a381273594e030864096e5a7a58fd4a9771021fd8dff447abfeea3fa307f51025cf8a2fbb5e4d91da3ac562000ec466c26c82db973a6508da9
7
+ data.tar.gz: fd0be35b3e8a1e280a7098e5966bc3ff3f976708b15ea9bc5a46bf911e36b47d2ccd243eab31a23abfea88f83d0f8b6aebccaaad7052b3d7277d23c70b40093b
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
data/bin/rspec CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
-
2
+
3
3
  # This file was generated by Bundler.
4
4
  #
5
5
  # The application 'rspec' is installed as part of a gem, and
@@ -15,4 +15,3 @@ require "rubygems"
15
15
  require "bundler/setup"
16
16
 
17
17
  load Gem.bin_path("rspec-core", "rspec")
18
-
@@ -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">
@@ -1,6 +1,7 @@
1
1
  require "asciidoctor"
2
2
  require "asciidoctor/standoc/converter"
3
3
  require "fileutils"
4
+ require "metanorma-utils"
4
5
  require_relative "./front"
5
6
  require_relative "./validate"
6
7
  require_relative "./cleanup"
@@ -107,16 +108,11 @@ module Asciidoctor
107
108
  return unless node.attr("keywords")
108
109
 
109
110
  node.attr("keywords").split(/, */).sort.each_with_index do |kw, i|
110
- xml.keyword (i.zero? ? strict_capitalize(kw) : kw)
111
+ kw_out = i.zero? ? Metanorma::Utils.strict_capitalize_first(kw) : kw
112
+ xml.keyword kw_out
111
113
  end
112
114
  end
113
115
 
114
- def strict_capitalize(str)
115
- letters = str.split("")
116
- letters.first.upcase!
117
- letters.join
118
- end
119
-
120
116
  def clause_parse(attrs, xml, node)
121
117
  node.option?("unnumbered") and attrs[:unnumbered] = true
122
118
  case sectiontype1(node)
@@ -1,6 +1,7 @@
1
1
  require "asciidoctor"
2
2
  require "asciidoctor/standoc/converter"
3
3
  require "fileutils"
4
+ require_relative "./front_id"
4
5
 
5
6
  module Asciidoctor
6
7
  module ITU
@@ -13,6 +14,10 @@ module Asciidoctor
13
14
  end
14
15
  end
15
16
 
17
+ def relaton_relations
18
+ super + %w(complements)
19
+ end
20
+
16
21
  def title_attr(type, lang = "en")
17
22
  { language: lang, format: "text/plain", type: type }
18
23
  end
@@ -109,55 +114,6 @@ module Asciidoctor
109
114
  end
110
115
  end
111
116
 
112
- def metadata_id(node, xml)
113
- provisional_id(node, xml)
114
- itu_id(node, xml)
115
- recommendation_id(node, xml)
116
- end
117
-
118
- def provisional_id(node, xml)
119
- return unless node.attr("provisional-name")
120
-
121
- xml.docidentifier **{ type: "ITU-provisional" } do |i|
122
- i << node.attr("provisional-name")
123
- end
124
- end
125
-
126
- ITULANG = { "en" => "E", "fr" => "F", "ar" => "A", "es" => "S",
127
- "zh" => "C", "ru" => "R" }.freeze
128
-
129
- def itu_id1(node, lang)
130
- bureau = node.attr("bureau") || "T"
131
- id = if doctype(node) == "service-publication"
132
- @i18n.annex_to_itu_ob_abbrev.sub(/%/, node.attr("docnumber"))
133
- else
134
- "ITU-#{bureau} #{node.attr('docnumber')}"
135
- end
136
- id + (lang ? "-#{ITULANG[@lang]}" : "")
137
- end
138
-
139
- def itu_id(node, xml)
140
- return unless node.attr("docnumber")
141
-
142
- xml.docidentifier **{ type: "ITU" } do |i|
143
- i << itu_id1(node, false)
144
- end
145
- xml.docidentifier **{ type: "ITU-lang" } do |i|
146
- i << itu_id1(node, true)
147
- end
148
- xml.docnumber { |i| i << node.attr("docnumber") }
149
- end
150
-
151
- def recommendation_id(node, xml)
152
- return unless node.attr("recommendationnumber")
153
-
154
- node.attr("recommendationnumber").split("/").each do |s|
155
- xml.docidentifier **{ type: "ITU-Recommendation" } do |i|
156
- i << s
157
- end
158
- end
159
- end
160
-
161
117
  def metadata_series(node, xml)
162
118
  node.attr("series") and
163
119
  xml.series **{ type: "main" } do |s|
@@ -191,18 +147,6 @@ module Asciidoctor
191
147
  xml.ip_notice_received (node.attr("ip-notice-received") || "false")
192
148
  end
193
149
 
194
- def structured_id(node, xml)
195
- return unless node.attr("docnumber")
196
-
197
- xml.structuredidentifier do |i|
198
- i.bureau node.attr("bureau") || "T"
199
- i.docnumber node.attr("docnumber")
200
- a = node.attr("annexid") and i.annexid a
201
- a = node.attr("amendment-number") and i.amendment a
202
- a = node.attr("corrigendum-number") and i.corrigendum a
203
- end
204
- end
205
-
206
150
  def metadata_techreport(node, xml)
207
151
  a = node.attr("meeting") and
208
152
  metadata_meeting(a, node.attr("meeting-acronym"), xml)
@@ -0,0 +1,67 @@
1
+ module Asciidoctor
2
+ module ITU
3
+ class Converter < Standoc::Converter
4
+ def metadata_id(node, xml)
5
+ provisional_id(node, xml)
6
+ itu_id(node, xml)
7
+ recommendation_id(node, xml)
8
+ end
9
+
10
+ def provisional_id(node, xml)
11
+ return unless node.attr("provisional-name")
12
+
13
+ xml.docidentifier **{ type: "ITU-provisional" } do |i|
14
+ i << node.attr("provisional-name")
15
+ end
16
+ end
17
+
18
+ ITULANG = { "en" => "E", "fr" => "F", "ar" => "A", "es" => "S",
19
+ "zh" => "C", "ru" => "R" }.freeze
20
+
21
+ def itu_id1(node, lang)
22
+ bureau = node.attr("bureau") || "T"
23
+ id = if doctype(node) == "service-publication"
24
+ @i18n.annex_to_itu_ob_abbrev.sub(/%/,
25
+ node.attr("docnumber"))
26
+ else
27
+ "ITU-#{bureau} #{node.attr('docnumber')}"
28
+ end
29
+ id + (lang ? "-#{ITULANG[@lang]}" : "")
30
+ end
31
+
32
+ def itu_id(node, xml)
33
+ return unless node.attr("docnumber")
34
+
35
+ xml.docidentifier **{ type: "ITU" } do |i|
36
+ i << itu_id1(node, false)
37
+ end
38
+ xml.docidentifier **{ type: "ITU-lang" } do |i|
39
+ i << itu_id1(node, true)
40
+ end
41
+ xml.docnumber { |i| i << node.attr("docnumber") }
42
+ end
43
+
44
+ def recommendation_id(node, xml)
45
+ return unless node.attr("recommendationnumber")
46
+
47
+ node.attr("recommendationnumber").split("/").each do |s|
48
+ xml.docidentifier **{ type: "ITU-Recommendation" } do |i|
49
+ i << s
50
+ end
51
+ end
52
+ end
53
+
54
+ def structured_id(node, xml)
55
+ return unless node.attr("docnumber")
56
+
57
+ xml.structuredidentifier do |i|
58
+ i.bureau node.attr("bureau") || "T"
59
+ i.docnumber node.attr("docnumber")
60
+ a = node.attr("annexid") and i.annexid a
61
+ a = node.attr("amendment-number") and i.amendment a
62
+ a = node.attr("corrigendum-number") and i.corrigendum a
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end