metanorma-itu 0.0.1 → 0.1.0

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: 5929f61643c8dbafa66db621a66293f54bd32f6d49230c9f5bc7b2631a9d9fe0
4
- data.tar.gz: e1f97d4f79ab995555c6b5aac7db3118aa96908f8722a4b1982875fa5f5f98d5
3
+ metadata.gz: 53aa5ba06fe4c815ebf48d2ed8ec630f6b36aa29931a1ce3e2b7bb4072df51c0
4
+ data.tar.gz: d7187d43af041c57475376b83386586c309485f0be9c98d2afc0fe77491040a2
5
5
  SHA512:
6
- metadata.gz: 9680e50d0d3d1b447a9a647cc94a01cd1f1553f6b5f2a0edc1657781f4947c80a037818bf9046242109b282e0146d4dacd9c14f6bcde93edfdd1d96cfa7518ca
7
- data.tar.gz: 6a353703d1015385bcb8741e17df7a42d622ca65a0a340cd7242a442a900f2a904a8f27d6f0c37aeed2b8d50116d96d00f275d0d97b7c24cbb2b5480e076fc19
6
+ metadata.gz: 7ff02edcb14b675aadace9f1aaf4be5408926d898663acf18a712d796d37c52f0510d4fadd6c2d44e922ecea0359188b7a552ec601b4b94b4104ccf9847c1908
7
+ data.tar.gz: 186aa7ff33a27c75b9f60c485bd2998c1c6b570c8cbcfe7434b1a02a6c386822f4c313416d5ae253278dd2ea2698f10ac00b5841921333ea5f9a35fcd819cc34
data/.travis.yml CHANGED
@@ -1,3 +1,5 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
1
3
  language: ruby
2
4
  cache: bundler
3
5
  os:
@@ -6,12 +8,14 @@ os:
6
8
  rvm:
7
9
  - 2.5
8
10
  - 2.4
9
- - 2.3
10
11
  - ruby-head
11
- before_install:
12
- - gem install bundler -v 2.0.1
13
- - bundle install
12
+ before_install:
13
+ - nvm install 8
14
14
  - npm install -g puppeteer
15
+ - npm install
16
+ - gem install bundler -v 2.0.1
17
+ - bundle update
15
18
  matrix:
16
19
  allow_failures:
17
20
  - rvm: ruby-head
21
+
data/appveyor.yml CHANGED
@@ -1,5 +1,10 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
1
3
  version: '{build}'
2
4
 
5
+ cache:
6
+ - vendor/bundle
7
+
3
8
  environment:
4
9
  matrix:
5
10
  - RUBY_VERSION: 25
@@ -16,6 +21,8 @@ install:
16
21
 
17
22
  build_script:
18
23
  - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
24
+ - set GIT_TERMINAL_PROMPT=0
25
+ - bundle config --local path vendor/bundle
19
26
  - bundle update
20
27
  - bundle install
21
28
 
@@ -26,4 +33,3 @@ before_test:
26
33
 
27
34
  test_script:
28
35
  - bundle exec rake
29
-
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "asciidoctor/csand"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/rspec ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rspec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require "pathname"
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path(
11
+ "../../Gemfile", Pathname.new(__FILE__).realpath
12
+ )
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("rspec-core", "rspec")
18
+
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -48,6 +48,7 @@ module Asciidoctor
48
48
  end
49
49
 
50
50
  def make_preface(x, s)
51
+ s.add_previous_sibling("<preface/>") unless x.at("//preface")
51
52
  make_abstract(x, s)
52
53
  move_sections_into_preface(x, x.at("//preface"))
53
54
  end
@@ -52,6 +52,7 @@ module Asciidoctor
52
52
  suffix = 2
53
53
  while node.attr("bureau_#{suffix}")
54
54
  metadata_committee1(node, xml, "_#{suffix}")
55
+ suffix += 1
55
56
  end
56
57
  end
57
58
 
@@ -59,45 +60,35 @@ module Asciidoctor
59
60
  xml.editorialgroup do |a|
60
61
  a.bureau ( node.attr("bureau#{suffix}") || "T" )
61
62
  a.group **attr_code(type: node.attr("grouptype#{suffix}")) do |g|
62
- g.name node.attr("group#{suffix}")
63
- g.acronym node.attr("groupacronym#{suffix}") if node.attr("groupacronym#{suffix}")
64
- if node.attr("groupyearstart#{suffix}")
65
- g.period do |p|
66
- period.start node.attr("groupyearstart#{suffix}")
67
- period.end node.attr("groupyearend#{suffix}") if node.attr("groupacronym#{suffix}")
68
- end
69
- end
63
+ metadata_committee2(node, g, suffix, "")
70
64
  end
71
65
  if node.attr("subgroup#{suffix}")
72
66
  a.subgroup **attr_code(type: node.attr("subgrouptype#{suffix}")) do |g|
73
- g.name node.attr("subgroup#{suffix}")
74
- g.acronym node.attr("subgroupacronym#{suffix}") if node.attr("subgroupacronym#{suffix}")
75
- if node.attr("subgroupyearstart#{suffix}")
76
- g.period do |p|
77
- period.start node.attr("subgroupyearstart#{suffix}")
78
- period.end node.attr("subgroupyearend#{suffix}") if node.attr("subgroupyearend#{suffix}")
79
- end
80
- end
67
+ metadata_committee2(node, g, suffix, "sub")
81
68
  end
82
69
  end
83
70
  if node.attr("workgroup#{suffix}")
84
71
  a.workgroup **attr_code(type: node.attr("workgrouptype#{suffix}")) do |g|
85
- g.name node.attr("workgroup#{suffix}")
86
- g.acronym node.attr("workgroupacronym#{suffix}") if node.attr("workgroupacronym#{suffix}")
87
- if node.attr("workgroupyearstart#{suffix}")
88
- g.period do |p|
89
- period.start node.attr("workgroupyearstart#{suffix}")
90
- period.end node.attr("workgroupyearend#{suffix}") if node.attr("wokrgroupyearend#{suffix}")
91
- end
92
- end
72
+ metadata_committee2(node, g, suffix, "work")
93
73
  end
94
74
  end
95
75
  end
96
76
  end
97
77
 
78
+ def metadata_committee2(node, g, suffix, prefix)
79
+ g.name node.attr("#{prefix}group#{suffix}")
80
+ g.acronym node.attr("#{prefix}groupacronym#{suffix}") if node.attr("#{prefix}groupacronym#{suffix}")
81
+ if node.attr("#{prefix}groupyearstart#{suffix}")
82
+ g.period do |p|
83
+ p.start node.attr("#{prefix}groupyearstart#{suffix}")
84
+ p.end node.attr("#{prefix}groupyearend#{suffix}") if node.attr("#{prefix}groupacronym#{suffix}")
85
+ end
86
+ end
87
+ end
88
+
98
89
  def metadata_id(node, xml)
99
- itu_id(node, xml)
100
90
  provisional_id(node, xml)
91
+ itu_id(node, xml)
101
92
  end
102
93
 
103
94
  def provisional_id(node, xml)
@@ -170,9 +161,9 @@ module Asciidoctor
170
161
  end
171
162
 
172
163
  def metadata_ext(node, xml)
173
- metadata_doctype(node, ext)
174
- metadata_committee(node, ext)
175
- metadata_ics(node, ext)
164
+ metadata_doctype(node, xml)
165
+ metadata_committee(node, xml)
166
+ metadata_ics(node, xml)
176
167
  metadata_keywords(node, xml)
177
168
  metadata_recommendationstatus(node, xml)
178
169
  metadata_ip_notice(node, xml)
@@ -71,18 +71,6 @@
71
71
  </choice>
72
72
  </element>
73
73
  </define>
74
- <define name="biblionote">
75
- <element name="note">
76
- <optional>
77
- <!-- Biblio date notes can be footnoted -->
78
- <attribute name="type"/>
79
- </optional>
80
- <optional>
81
- <attribute name="reference"/>
82
- </optional>
83
- <ref name="FormattedString"/>
84
- </element>
85
- </define>
86
74
  <define name="sections">
87
75
  <element name="sections">
88
76
  <ref name="clause"/>
@@ -29,8 +29,8 @@ module Asciidoctor
29
29
  end
30
30
 
31
31
  def approval_validate(xmldoc)
32
- s = xmldoc.at("//bibdata/recommendationstatus") || return
33
- process = s.at("./@process").text
32
+ s = xmldoc.at("//bibdata/ext/recommendationstatus/approvalstage") || return
33
+ process = s["process"]
34
34
  if process == "aap" and %w(determined in-force).include? s.text
35
35
  warn "Recommendation Status #{s.text} inconsistent with AAP"
36
36
  end
@@ -41,15 +41,11 @@ module Asciidoctor
41
41
 
42
42
  def itu_identifier_validate(xmldoc)
43
43
  s = xmldoc.xpath("//bibdata/docidentifier[@type = 'ITU']").each do |x|
44
- /^ITU-[RTF] [AD-VX-Z]\.[0-9]+$/.match x.text or
45
- warn "#{x.text} does not match ITU document identifier conventions"
44
+ /^ITU-[RTF] [AD-VX-Z]\.[0-9]+$/.match(x.text) or
45
+ warn("#{x.text} does not match ITU document identifier conventions")
46
46
  end
47
47
  end
48
48
 
49
49
  end
50
50
  end
51
51
  end
52
-
53
- DocumentType =
54
- "recommendation" | "recommendation-supplement" | "recommendation-amendment" | "recommendation-corrigendum" | "recommendation-errata" |
55
- "recommendation-annex" | "focus-group" | "implementers-guide" | "technical-paper" | "technical-report" | "joint-itu-iso-iec"
@@ -36,7 +36,7 @@ module IsoDoc
36
36
 
37
37
  def annex_name(annex, name, div)
38
38
  div.h1 **{ class: "Annex" } do |t|
39
- t << "#{get_anchors[annex['id']][:label]} "
39
+ t << "#{anchor(annex['id'], :label)} "
40
40
  t.br
41
41
  t.b do |b|
42
42
  name&.children&.each { |c2| parse(c2, b) }
@@ -44,14 +44,6 @@ module IsoDoc
44
44
  end
45
45
  end
46
46
 
47
- def term_defs_boilerplate(div, source, term, preface)
48
- if source.empty? && term.nil?
49
- div << @no_terms_boilerplate
50
- else
51
- div << term_defs_boilerplate_cont(source, term)
52
- end
53
- end
54
-
55
47
  def i18n_init(lang, script)
56
48
  super
57
49
  end
@@ -102,7 +94,7 @@ module IsoDoc
102
94
  f = isoxml.at(ns(q)) or return num
103
95
  out.div do |div|
104
96
  num = num + 1
105
- clause_name(num, "References", div, nil)
97
+ clause_name(num, @normref_lbl, div, nil)
106
98
  norm_ref_preface(f, div)
107
99
  biblio_list(f, div, false)
108
100
  end
@@ -141,17 +133,33 @@ module IsoDoc
141
133
  end
142
134
  end
143
135
 
144
- ELSEWHERE_TERMS = "This Recommendation uses the following terms defined elsewhere:"
145
- HERE_TERMS = "This Recommendation defines the following terms:"
136
+ def terms_defs_title(node)
137
+ t = node.at(ns("./title")) and return t.text
138
+ super
139
+ end
140
+
141
+ def terms_defs(node, out, num)
142
+ f = node.at(ns(IsoDoc::Convert::TERM_CLAUSE)) or return num
143
+ out.div **attr_code(id: f["id"]) do |div|
144
+ num = num + 1
145
+ clause_name(num, terms_defs_title(f), div, nil)
146
+ if f.at(ns("./clause | ./terms | ./term")).nil? then out.p "None."
147
+ else
148
+ f.children.reject { |c1| c1.name == "title" }.each do |c1|
149
+ parse(c1, div)
150
+ end
151
+ end
152
+ end
153
+ num
154
+ end
146
155
 
147
156
  def terms_parse(node, out)
148
157
  out.div **attr_code(id: node["id"]) do |div|
149
158
  clause_parse_title(node, div, node.at(ns("./title")), out)
150
159
  title = node.at(ns("./title"))&.text&.downcase
151
- title == "terms defined elsewhere" and out.p ELSEWHERE_TERMS
152
- title == "terms defined in this recommendation" and out.p HERE_TERMS
153
- content = node.at(ns("./clause | ./term"))
154
- if content.nil? then out.p "None."
160
+ title == "terms defined elsewhere" and out.p @labels["elsewhere_terms"]
161
+ title == "terms defined in this recommendation" and out.p @labels["here_terms"]
162
+ if node.at(ns("./clause | ./term")).nil? then out.p "None."
155
163
  else
156
164
  node.children.reject { |c1| c1.name == "title" }.each do |c1|
157
165
  parse(c1, div)
@@ -163,12 +171,12 @@ module IsoDoc
163
171
  def termdef_parse1(node, div, term, defn, source)
164
172
  div.p **{ class: "TermNum", id: node["id"] } do |p|
165
173
  p.b do |b|
166
- b << get_anchors[node["id"]][:label]
174
+ b << anchor(node["id"], :label)
167
175
  insert_tab(b, 1)
168
176
  term.children.each { |n| parse(n, b) }
169
177
  end
170
178
  source and p << " [#{source.value}]"
171
- p << ":"
179
+ p << ": "
172
180
  defn and defn.children.each { |n| parse(n, p) }
173
181
  end
174
182
  end
@@ -205,6 +213,13 @@ module IsoDoc
205
213
  out.a(**{ "href": "#" + node["bibitemid"] }) { |l| l << linkend }
206
214
  end
207
215
  end
216
+
217
+ def middle_title(out)
218
+ out.p(**{ class: "zzSTDTitle1" }) do |p|
219
+ id = @meta.get[:docidentifier] and p << "Recommendation #{id}"
220
+ end
221
+ out.p(**{ class: "zzSTDTitle2" }) { |p| p << @meta.get[:doctitle] }
222
+ end
208
223
  end
209
224
  end
210
225
  end
@@ -944,7 +944,7 @@ span.doc-title {
944
944
  .prefatory-section {
945
945
  padding: 0 3em 0 6em; }
946
946
 
947
- .zzSTDTitle1, .MsoCommentText {
947
+ .zzSTDTitle1, .zzSTDTitle2, .MsoCommentText {
948
948
  display: none; }
949
949
 
950
950
  .coverpage {
@@ -20,7 +20,7 @@ module IsoDoc
20
20
  super
21
21
  end
22
22
 
23
- def html_toc(docxml)
23
+ def html_toc(docxml)
24
24
  docxml
25
25
  end
26
26
 
@@ -1,2 +1,8 @@
1
1
  termsdef: Definitions
2
2
  termnote: NOTE %
3
+ normref: References
4
+ elsewhere_terms: >-
5
+ This Recommendation uses the following terms defined elsewhere:
6
+ here_terms: >-
7
+ This Recommendation defines the following terms:
8
+
@@ -37,16 +37,6 @@ module IsoDoc
37
37
  set(:docidentifier, dn&.text)
38
38
  end
39
39
 
40
- def status_abbr(status)
41
- case status
42
- when "working-draft" then "wd"
43
- when "committee-draft" then "cd"
44
- when "draft-standard" then "d"
45
- else
46
- ""
47
- end
48
- end
49
-
50
40
  def unpublished(status)
51
41
  %w(in-force-prepublished).include? status.downcase
52
42
  end
@@ -64,11 +64,6 @@ module IsoDoc
64
64
  docxml
65
65
  end
66
66
 
67
- def middle_title(out)
68
- out.p(**{ class: "zzSTDTitle1" }) { |p| p << "Recommendation " + @meta.get[:docidentifier] }
69
- out.p(**{ class: "zzSTDTitle2" }) { |p| p << @meta.get[:doctitle] }
70
- end
71
-
72
67
  def word_preface(docxml)
73
68
  super
74
69
  abstractbox = docxml.at("//div[@id='abstractbox']")
data/lib/metanorma/itu.rb CHANGED
@@ -3,8 +3,8 @@ require "metanorma/itu/processor"
3
3
  module Metanorma
4
4
  module ITU
5
5
 
6
- ORGANIZATION_NAME_SHORT = "Acme"
7
- ORGANIZATION_NAME_LONG = "Acme Corp."
6
+ ORGANIZATION_NAME_SHORT = "ITU"
7
+ ORGANIZATION_NAME_LONG = "International Telecommunication Union"
8
8
  DOCUMENT_NAMESPACE = "https://open.ribose.com/standards/itu"
9
9
 
10
10
  end
@@ -19,7 +19,7 @@ module Metanorma
19
19
  end
20
20
 
21
21
  def version
22
- "Metanorma::Acme #{Metanorma::ITU::VERSION}"
22
+ "Metanorma::ITU #{Metanorma::ITU::VERSION}"
23
23
  end
24
24
 
25
25
  def input_to_isodoc(file, filename)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ITU
3
- VERSION = "0.0.1"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -22,12 +22,13 @@ Gem::Specification.new do |spec|
22
22
  spec.bindir = "exe"
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
25
26
 
26
27
  spec.add_dependency "asciidoctor", "~> 1.5.7"
27
28
  spec.add_dependency "htmlentities", "~> 4.3.4"
28
29
  spec.add_dependency "ruby-jing"
29
- spec.add_dependency "metanorma-standoc", "~> 1.1.0"
30
- spec.add_dependency "isodoc", "~> 0.9.0"
30
+ spec.add_dependency "metanorma-standoc", "~> 1.2.0"
31
+ spec.add_dependency "isodoc", "~> 0.10.0"
31
32
 
32
33
  spec.add_development_dependency "bundler", "~> 2.0.1"
33
34
  spec.add_development_dependency "byebug", "~> 9.1"
@@ -40,5 +41,4 @@ Gem::Specification.new do |spec|
40
41
  spec.add_development_dependency "simplecov", "~> 0.15"
41
42
  spec.add_development_dependency "timecop", "~> 0.9"
42
43
  spec.add_development_dependency "metanorma", "~> 0.3.0"
43
- spec.add_development_dependency "metanorma-cli", "~> 1.1.2"
44
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-itu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-22 00:00:00.000000000 Z
11
+ date: 2019-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.1.0
61
+ version: 1.2.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.1.0
68
+ version: 1.2.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: isodoc
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.9.0
75
+ version: 0.10.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.9.0
82
+ version: 0.10.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -234,20 +234,6 @@ dependencies:
234
234
  - - "~>"
235
235
  - !ruby/object:Gem::Version
236
236
  version: 0.3.0
237
- - !ruby/object:Gem::Dependency
238
- name: metanorma-cli
239
- requirement: !ruby/object:Gem::Requirement
240
- requirements:
241
- - - "~>"
242
- - !ruby/object:Gem::Version
243
- version: 1.1.2
244
- type: :development
245
- prerelease: false
246
- version_requirements: !ruby/object:Gem::Requirement
247
- requirements:
248
- - - "~>"
249
- - !ruby/object:Gem::Version
250
- version: 1.1.2
251
237
  description: 'Metanorma for the ITU.
252
238
 
253
239
  '
@@ -266,6 +252,9 @@ files:
266
252
  - README.adoc
267
253
  - Rakefile
268
254
  - appveyor.yml
255
+ - bin/console
256
+ - bin/rspec
257
+ - bin/setup
269
258
  - lib/asciidoctor/itu.rb
270
259
  - lib/asciidoctor/itu/biblio.rng
271
260
  - lib/asciidoctor/itu/converter.rb
@@ -312,7 +301,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
312
301
  requirements:
313
302
  - - ">="
314
303
  - !ruby/object:Gem::Version
315
- version: '0'
304
+ version: 2.4.0
316
305
  required_rubygems_version: !ruby/object:Gem::Requirement
317
306
  requirements:
318
307
  - - ">="
@@ -320,7 +309,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
320
309
  version: '0'
321
310
  requirements: []
322
311
  rubyforge_project:
323
- rubygems_version: 2.7.6
312
+ rubygems_version: 2.7.7
324
313
  signing_key:
325
314
  specification_version: 4
326
315
  summary: Metanorma for the ITU