metanorma-mpfa 0.5.14 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,7 +31,6 @@ module IsoDoc
31
31
  htmlstylesheet: html_doc_path("htmlstyle.scss"),
32
32
  htmlcoverpage: html_doc_path("html_rsd_titlepage.html"),
33
33
  htmlintropage: html_doc_path("html_rsd_intro.html"),
34
- scripts: html_doc_path("scripts.html"),
35
34
  wordstylesheet: html_doc_path("wordstyle.scss"),
36
35
  standardstylesheet: html_doc_path("rsd.scss"),
37
36
  header: html_doc_path("header.html"),
@@ -3,18 +3,18 @@ module IsoDoc
3
3
  class Xref < IsoDoc::Xref
4
4
  FRONT_CLAUSE = "//*[parent::preface]".freeze
5
5
 
6
- def initial_anchor_names(d)
7
- d.xpath(ns(self.class::FRONT_CLAUSE)).each do |c|
6
+ def initial_anchor_names(doc)
7
+ doc.xpath(ns(self.class::FRONT_CLAUSE)).each do |c|
8
8
  preface_names(c)
9
9
  sequential_asset_names(c)
10
10
  end
11
- middle_section_asset_names(d)
12
- clause_names(d, 0)
13
- termnote_anchor_names(d)
14
- termexample_anchor_names(d)
11
+ middle_section_asset_names(doc)
12
+ clause_names(doc, 0)
13
+ termnote_anchor_names(doc)
14
+ termexample_anchor_names(doc)
15
15
  end
16
16
 
17
- def annex_name_lbl(clause, num)
17
+ def annex_name_lbl(_clause, num)
18
18
  l10n("<strong>#{@labels['annex']} #{num}</strong>")
19
19
  end
20
20
 
@@ -31,20 +31,20 @@ module IsoDoc
31
31
  def container_names(clause, lvl)
32
32
  if clause["container"]
33
33
  @anchors[clause["id"]] =
34
- { label: nil, xref: clause.at(ns("./title"))&.text, level: lvl+1 }
34
+ { label: nil, xref: clause.at(ns("./title"))&.text, level: lvl + 1 }
35
35
  end
36
36
  clause.xpath(ns("./clause | ./term | ./terms | "\
37
37
  "./definitions")).each do |c|
38
- container_names(c, clause["container"] ? lvl+1 : lvl)
38
+ container_names(c, clause["container"] ? lvl + 1 : lvl)
39
39
  end
40
40
  end
41
41
 
42
- def sect_names(clause, num, i, lvl, prev_lvl)
42
+ def sect_names(clause, num, i, lvl, _prev_lvl)
43
43
  return i if clause.nil?
44
+
44
45
  curr = i
45
46
  if !clause["container"]
46
- retlvl = lvl
47
- i+=1
47
+ i += 1
48
48
  curr = i
49
49
  name = num.nil? ? i.to_s : "#{num}.#{i}"
50
50
  @anchors[clause["id"]] = { label: name, level: lvl + 1,
@@ -57,28 +57,29 @@ module IsoDoc
57
57
  if clause["container"]
58
58
  i, lvl = sect_names(c, num, i, lvl, lvl)
59
59
  else
60
- j, prev = sect_names(c, name, j, lvl+1, prev)
60
+ j, prev = sect_names(c, name, j, lvl + 1, prev)
61
61
  end
62
62
  end
63
- i = j if j >0
63
+ i = j if j.positive?
64
64
  i = curr if lvl < prev
65
65
  [i, prev]
66
66
  end
67
67
 
68
- def annex_naming(c, num, lvl, i)
69
- if c["guidance"] then annex_names1(c, "#{num}E", lvl + 1)
68
+ def annex_naming(clause, num, lvl, idx)
69
+ if clause["guidance"] then annex_names1(clause, "#{num}E", lvl + 1)
70
70
  else
71
- i+= 1 unless c["container"]
72
- annex_names1(c, "#{num}.#{i}", lvl + 1)
71
+ idx += 1 unless clause["container"]
72
+ annex_names1(clause, "#{num}.#{idx}", lvl + 1)
73
73
  end
74
- i
74
+ idx
75
75
  end
76
76
 
77
77
  def annex_names(clause, num)
78
- @anchors[clause["id"]] = { label: annex_name_lbl(clause, num), value: num,
79
- xref: l10n("#{@labels['annex']} #{num}"), level: 1 }
78
+ @anchors[clause["id"]] =
79
+ { label: annex_name_lbl(clause, num), value: num,
80
+ xref: l10n("#{@labels['annex']} #{num}"), level: 1 }
80
81
  if a = single_annex_special_section(clause)
81
- annex_names1(a, "#{num}", 1)
82
+ annex_names1(a, num.to_s, 1)
82
83
  else
83
84
  i = 0
84
85
  clause.xpath(ns("./clause | ./references")).each do |c|
@@ -90,8 +91,11 @@ module IsoDoc
90
91
  end
91
92
 
92
93
  def annex_names1(clause, num, level)
93
- clause["container"] or @anchors[clause["id"]] =
94
- { label: num, xref: l10n("#{@labels['annex']} #{num}"), level: level }
94
+ unless clause["container"]
95
+ @anchors[clause["id"]] =
96
+ { label: num,
97
+ xref: l10n("#{@labels['annex']} #{num}"), level: level }
98
+ end
95
99
  i = 0
96
100
  clause.xpath(ns("./clause | ./references")).each do |c|
97
101
  i = annex_naming(c, num, level, i)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module MPFA
3
- VERSION = "0.5.14"
3
+ VERSION = "0.6.2".freeze
4
4
  end
5
5
  end
@@ -1,4 +1,4 @@
1
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path("lib", __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require "metanorma/mpfa/version"
4
4
 
@@ -29,18 +29,18 @@ Gem::Specification.new do |spec|
29
29
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
30
30
 
31
31
  spec.add_dependency "htmlentities", "~> 4.3.4"
32
- spec.add_dependency "metanorma-standoc", "~> 1.8.0"
33
- spec.add_dependency "isodoc", "~> 1.5.0"
32
+ spec.add_dependency "isodoc", "~> 1.6.0"
33
+ spec.add_dependency "metanorma-standoc", "~> 1.9.0"
34
34
  spec.add_dependency "twitter_cldr"
35
35
 
36
36
  spec.add_development_dependency "byebug", "~> 9.1"
37
- spec.add_development_dependency "sassc", "2.4.0"
38
37
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
39
38
  spec.add_development_dependency "guard", "~> 2.14"
40
39
  spec.add_development_dependency "guard-rspec", "~> 4.7"
41
- spec.add_development_dependency "rake", "~> 12.0"
40
+ spec.add_development_dependency "rake", "~> 13.0"
42
41
  spec.add_development_dependency "rspec", "~> 3.6"
43
- spec.add_development_dependency "rubocop", "= 0.54.0"
42
+ spec.add_development_dependency "rubocop", "~> 1.5.2"
43
+ spec.add_development_dependency "sassc", "2.4.0"
44
44
  spec.add_development_dependency "simplecov", "~> 0.15"
45
45
  spec.add_development_dependency "timecop", "~> 0.9"
46
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-mpfa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.14
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-22 00:00:00.000000000 Z
11
+ date: 2021-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -25,33 +25,33 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 4.3.4
27
27
  - !ruby/object:Gem::Dependency
28
- name: metanorma-standoc
28
+ name: isodoc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.8.0
33
+ version: 1.6.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.8.0
40
+ version: 1.6.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: isodoc
42
+ name: metanorma-standoc
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.5.0
47
+ version: 1.9.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.5.0
54
+ version: 1.9.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: twitter_cldr
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '9.1'
83
- - !ruby/object:Gem::Dependency
84
- name: sassc
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - '='
88
- - !ruby/object:Gem::Version
89
- version: 2.4.0
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - '='
95
- - !ruby/object:Gem::Version
96
- version: 2.4.0
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: equivalent-xml
99
85
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +128,14 @@ dependencies:
142
128
  requirements:
143
129
  - - "~>"
144
130
  - !ruby/object:Gem::Version
145
- version: '12.0'
131
+ version: '13.0'
146
132
  type: :development
147
133
  prerelease: false
148
134
  version_requirements: !ruby/object:Gem::Requirement
149
135
  requirements:
150
136
  - - "~>"
151
137
  - !ruby/object:Gem::Version
152
- version: '12.0'
138
+ version: '13.0'
153
139
  - !ruby/object:Gem::Dependency
154
140
  name: rspec
155
141
  requirement: !ruby/object:Gem::Requirement
@@ -166,18 +152,32 @@ dependencies:
166
152
  version: '3.6'
167
153
  - !ruby/object:Gem::Dependency
168
154
  name: rubocop
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 1.5.2
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 1.5.2
167
+ - !ruby/object:Gem::Dependency
168
+ name: sassc
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - '='
172
172
  - !ruby/object:Gem::Version
173
- version: 0.54.0
173
+ version: 2.4.0
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - '='
179
179
  - !ruby/object:Gem::Version
180
- version: 0.54.0
180
+ version: 2.4.0
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: simplecov
183
183
  requirement: !ruby/object:Gem::Requirement