metanorma-iho 0.2.9 → 0.2.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,9 @@ require "isodoc/generic/xref"
2
2
 
3
3
  module IsoDoc
4
4
  module IHO
5
+ class Counter < IsoDoc::XrefGen::Counter
6
+ end
7
+
5
8
  class Xref < IsoDoc::Generic::Xref
6
9
  def annex_name_lbl(clause, num)
7
10
  lbl = clause["obligation"] == "informative" ?
@@ -19,9 +22,11 @@ module IsoDoc
19
22
  if a = single_annex_special_section(clause)
20
23
  annex_names1(a, "#{num}", 1)
21
24
  else
25
+ i = Counter.new
22
26
  clause.xpath(ns("./clause | ./references | ./terms | ./definitions")).
23
- each_with_index do |c, i|
24
- annex_names1(c, "#{num}.#{i + 1}", 2)
27
+ each do |c|
28
+ i.increment(c)
29
+ annex_names1(c, "#{num}.#{i.print}", 2)
25
30
  end
26
31
  end
27
32
  hierarchical_asset_names(clause, num)
@@ -29,13 +34,18 @@ module IsoDoc
29
34
 
30
35
  def back_anchor_names(docxml)
31
36
  super
37
+ i = Counter.new
32
38
  docxml.xpath(ns("//annex[@obligation = 'informative']")).
33
- each_with_index do |c, i|
34
- annex_names(c, i + 1)
39
+ each do |c|
40
+ i.increment(c)
41
+ annex_names(c, i.print)
35
42
  end
43
+ i = Counter.new("@")
36
44
  docxml.xpath(ns("//annex[not(@obligation = 'informative')]")).
37
- each_with_index do |c, i|
38
- annex_names(c, (65 + i + (i > 7 ? 1 : 0)).chr.to_s)
45
+ each do |c|
46
+ i.increment(c)
47
+ i.increment(c) if i.print == "I"
48
+ annex_names(c, i.print)
39
49
  end
40
50
  end
41
51
 
@@ -45,16 +55,20 @@ module IsoDoc
45
55
  @anchors[clause["id"]] =
46
56
  { label: num, xref: l10n("#{lbl} #{num}"),
47
57
  level: level, type: "clause" }
58
+ i = Counter.new
48
59
  clause.xpath(ns("./clause | ./references | ./terms | ./definitions")).
49
- each_with_index do |c, i|
50
- annex_names1(c, "#{num}.#{i + 1}", level + 1)
60
+ each do |c|
61
+ i.increment(c)
62
+ annex_names1(c, "#{num}.#{i.print}", level + 1)
51
63
  end
52
64
  end
53
65
 
54
66
  def appendix_names(clause, num)
55
- clause.xpath(ns("./appendix")).each_with_index do |c, i|
67
+ i = Counter.new
68
+ clause.xpath(ns("./appendix")).each_with_index do |c|
69
+ i.increment(c)
56
70
  @anchors[c["id"]] =
57
- anchor_struct(i + 1, nil, @labels["appendix"], "clause")
71
+ anchor_struct(i.print, nil, @labels["appendix"], "clause")
58
72
  @anchors[c["id"]][:level] = 2
59
73
  @anchors[c["id"]][:container] = clause["id"]
60
74
  end
@@ -64,9 +78,10 @@ module IsoDoc
64
78
  @anchors[clause["id"]] =
65
79
  { label: num, level: level, xref: l10n("#{@labels["subclause"]} #{num}"),
66
80
  type: "clause" }
67
- clause.xpath(ns(SUBCLAUSES)).
68
- each_with_index do |c, i|
69
- section_names1(c, "#{num}.#{i + 1}", level + 1)
81
+ i = Counter.new
82
+ clause.xpath(ns(SUBCLAUSES)).each_with_index do |c|
83
+ i.increment(c)
84
+ section_names1(c, "#{num}.#{i.print}", level + 1)
70
85
  end
71
86
  end
72
87
  end
@@ -15,6 +15,20 @@ module Metanorma
15
15
  )
16
16
  end
17
17
 
18
+ def fonts_manifest
19
+ {
20
+ "Arial" => nil,
21
+ "Cambria Math" => nil,
22
+ "Courier" => nil,
23
+ "Fira Code" => nil,
24
+ "Source Sans Pro" => [ "Light" ],
25
+ "Source Serif Pro" => nil,
26
+ "Source Code Pro" => [ "Light" ],
27
+ "Source Han Sans" => nil,
28
+ "STIX Two Math" => nil,
29
+ }
30
+ end
31
+
18
32
  def version
19
33
  "Metanorma::IHO #{Metanorma::IHO::VERSION}"
20
34
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IHO
3
- VERSION = "0.2.9"
3
+ VERSION = "0.2.14"
4
4
  end
5
5
  end
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
28
28
 
29
29
  spec.add_dependency "htmlentities", "~> 4.3.4"
30
- spec.add_dependency 'metanorma-generic', '~> 1.8.0'
30
+ spec.add_dependency 'metanorma-generic', '~> 1.9.0'
31
31
 
32
32
  spec.add_development_dependency "byebug", "~> 9.1"
33
33
  spec.add_development_dependency "sassc", "2.4.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-14 00:00:00.000000000 Z
11
+ date: 2021-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.8.0
33
+ version: 1.9.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.9.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: byebug
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -189,6 +189,7 @@ extensions: []
189
189
  extra_rdoc_files: []
190
190
  files:
191
191
  - ".github/workflows/rake.yml"
192
+ - ".rubocop.yml"
192
193
  - CODE_OF_CONDUCT.md
193
194
  - Gemfile
194
195
  - LICENSE
@@ -235,7 +236,6 @@ files:
235
236
  - lib/isodoc/iho/xref.rb
236
237
  - lib/metanorma-iho.rb
237
238
  - lib/metanorma/iho.rb
238
- - lib/metanorma/iho/fonts_manifest.yaml
239
239
  - lib/metanorma/iho/processor.rb
240
240
  - lib/metanorma/iho/version.rb
241
241
  - metanorma-iho.gemspec
@@ -259,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
259
  - !ruby/object:Gem::Version
260
260
  version: '0'
261
261
  requirements: []
262
- rubygems_version: 3.0.3
262
+ rubygems_version: 3.1.4
263
263
  signing_key:
264
264
  specification_version: 4
265
265
  summary: metanorma-iho lets you write IHO in AsciiDoc.
@@ -1,8 +0,0 @@
1
- ---
2
- Source Sans Pro:
3
- - Light
4
- Source Serif Pro:
5
- Source Code Pro:
6
- - Light
7
- Source Han Sans:
8
- FiraCode: