metanorma-mpfa 0.6.1 → 0.6.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.6.1".freeze
3
+ VERSION = "0.6.6".freeze
4
4
  end
5
5
  end
@@ -26,11 +26,11 @@ Gem::Specification.new do |spec|
26
26
  spec.bindir = "exe"
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ["lib"]
29
- spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
29
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
30
30
 
31
31
  spec.add_dependency "htmlentities", "~> 4.3.4"
32
- spec.add_dependency "isodoc", "~> 1.6.0"
33
- spec.add_dependency "metanorma-standoc", "~> 1.9.0"
32
+ spec.add_dependency "isodoc", "~> 1.7.0"
33
+ spec.add_dependency "metanorma-standoc", "~> 1.10.0"
34
34
  spec.add_dependency "twitter_cldr"
35
35
 
36
36
  spec.add_development_dependency "byebug", "~> 9.1"
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.6.1
4
+ version: 0.6.6
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-04-26 00:00:00.000000000 Z
11
+ date: 2021-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.6.0
33
+ version: 1.7.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.6.0
40
+ version: 1.7.0
41
41
  - !ruby/object:Gem::Dependency
42
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.9.0
47
+ version: 1.10.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.9.0
54
+ version: 1.10.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: twitter_cldr
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -290,7 +290,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
290
290
  requirements:
291
291
  - - ">="
292
292
  - !ruby/object:Gem::Version
293
- version: 2.4.0
293
+ version: 2.5.0
294
294
  required_rubygems_version: !ruby/object:Gem::Requirement
295
295
  requirements:
296
296
  - - ">="