isodoc 1.4.0 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf37a37eb402d844a36b33e3911c67d3ebcbef7bf7f864dfc0e9f3a8aca7603c
4
- data.tar.gz: cc3645b92e85d43e2c6e49cfce67cc13d0f656cf1c16d67247cb7053eceba394
3
+ metadata.gz: a6b9025bfaedc51dd8e707cd191e5cca2790abe37859c2d7612058f67e4e4f3f
4
+ data.tar.gz: f176dde82d63fbc4664db489c8ca6411db6a573c6d8dbc5a1e70320b4db61fed
5
5
  SHA512:
6
- metadata.gz: 83bfcc73e86c73c9373bf9b42170ebc58c4ae50e4a0789cacddefa05c5b80fe1c59559e3abde2071e79aa3fd839d7844b3c0145ca89ed09b9d6d7e09b1e03de9
7
- data.tar.gz: 11fbb6a5a6a19eadae64d22dd032185eaed46a1dd007f188e26cc73153e75ceb16ec3c64c8613c8dc05e0263fafab98655287e23993c34ebcf815096dca50bda
6
+ metadata.gz: 3d35f5d9a2ec0ff9cb2990ef937d2bc16a35b3b221c7c59003f37e5b446d34aac101517f1325831c2d40d9a2a0c5cca93eea525e3fd0c31b4ec0e5c6cb9ac552
7
+ data.tar.gz: f1b47eb92f282d86e41eab040c8fcaf566e0b4eb3052eca61edd630a28746331c2dce84349cd055cd1edb9260a903fc9c3adf87019dfd75dbff85322f22714e5
@@ -16,17 +16,17 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '2.6', '2.5', '2.4' ]
19
+ ruby: [ '2.7', '2.6', '2.5', '2.4' ]
20
20
  os: [ ubuntu-latest, windows-latest, macos-latest ]
21
21
  experimental: [ false ]
22
22
  include:
23
- - ruby: '2.7'
23
+ - ruby: '3.0'
24
24
  os: 'ubuntu-latest'
25
25
  experimental: true
26
- - ruby: '2.7'
26
+ - ruby: '3.0'
27
27
  os: 'windows-latest'
28
28
  experimental: true
29
- - ruby: '2.7'
29
+ - ruby: '3.0'
30
30
  os: 'macos-latest'
31
31
  experimental: true
32
32
  steps:
@@ -35,35 +35,19 @@ jobs:
35
35
  - uses: ruby/setup-ruby@v1
36
36
  with:
37
37
  ruby-version: ${{ matrix.ruby }}
38
+ bundler-cache: true
38
39
 
39
- - uses: actions/cache@v2
40
- with:
41
- path: vendor/bundle
42
- key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
43
- restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
44
-
45
- - run: bundle config set path 'vendor/bundle'
46
-
47
- - run: bundle install --jobs 4 --retry 3
48
-
49
- - name: Install Inkscape macOS
50
- if: matrix.os == 'macos-latest'
51
- run: |
52
- brew cask install inkscape
53
- inkscape --version
54
-
55
- - name: Install Inkscape Ubuntu
56
- if: matrix.os == 'ubuntu-latest'
57
- run: |
58
- sudo add-apt-repository ppa:inkscape.dev/stable
59
- sudo apt update
60
- sudo apt install inkscape
61
- inkscape --version
62
-
63
- - name: Install Inkscape Windows
64
- if: matrix.os == 'windows-latest'
65
- run: |
66
- choco install --no-progress -y inkscape
67
- inkscape --version
40
+ - uses: metanorma/metanorma-build-scripts/inkscape-setup-action@master
68
41
 
69
42
  - run: bundle exec rake
43
+
44
+ tests-passed:
45
+ needs: rake
46
+ runs-on: ubuntu-latest
47
+ steps:
48
+ - uses: peter-evans/repository-dispatch@v1
49
+ with:
50
+ token: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
51
+ repository: ${{ github.repository }}
52
+ event-type: notify
53
+ client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
data/isodoc.gemspec CHANGED
@@ -30,11 +30,11 @@ Gem::Specification.new do |spec|
30
30
 
31
31
  spec.add_dependency "asciimath"
32
32
  spec.add_dependency "htmlentities", "~> 4.3.4"
33
- spec.add_dependency "nokogiri", ">= 1.10.4"
33
+ spec.add_dependency "nokogiri", "~> 1.10.4"
34
34
  spec.add_dependency "thread_safe"
35
35
  spec.add_dependency "uuidtools"
36
36
  spec.add_dependency "html2doc", "~> 1.0.0"
37
- spec.add_dependency "liquid"
37
+ spec.add_dependency "liquid", "~> 4"
38
38
  spec.add_dependency "twitter_cldr"
39
39
  spec.add_dependency "roman-numerals"
40
40
  spec.add_dependency "metanorma", "~> 1.2.0"
@@ -50,4 +50,5 @@ Gem::Specification.new do |spec|
50
50
  spec.add_development_dependency "rubocop", "= 0.54.0"
51
51
  spec.add_development_dependency "simplecov", "~> 0.15"
52
52
  spec.add_development_dependency "timecop", "~> 0.9"
53
+ spec.add_development_dependency "rexml"
53
54
  end
@@ -9,6 +9,7 @@ module IsoDoc
9
9
  class Convert < ::IsoDoc::Common
10
10
  attr_accessor :options
11
11
  attr_accessor :i18n
12
+ attr_accessor :meta
12
13
 
13
14
  # htmlstylesheet: Generic stylesheet for HTML
14
15
  # wordstylesheet: Generic stylesheet for Word
@@ -39,7 +39,7 @@ module IsoDoc::Function
39
39
  "uri[@type = 'citation']"))
40
40
  return href unless url
41
41
  href = suffix_url(url.text)
42
- anchor = node&.at(ns(".//locality[@type = 'anchor']"))&.text
42
+ anchor = node&.at(ns(".//locality[@type = 'anchor']"))&.text&.strip
43
43
  anchor and href += "##{anchor}"
44
44
  href
45
45
  end
@@ -71,5 +71,11 @@ module IsoDoc::Function
71
71
  node.children.each { |n| parse(n, e) }
72
72
  end
73
73
  end
74
+
75
+ def underline_parse(node, out)
76
+ out.u do |e|
77
+ node.children.each { |n| parse(n, e) }
78
+ end
79
+ end
74
80
  end
75
81
  end
@@ -87,7 +87,7 @@ module IsoDoc::Function
87
87
 
88
88
  def omit_docid_prefix(prefix)
89
89
  return true if prefix.nil? || prefix.empty?
90
- return %w(ISO IEC ITU W3C metanorma).include? prefix
90
+ return %w(ISO IEC IEV ITU W3C metanorma).include? prefix
91
91
  end
92
92
 
93
93
  def date_note_process(b, ref)
@@ -109,7 +109,7 @@ module IsoDoc::Function
109
109
  @meta.get
110
110
  end
111
111
 
112
- def middle_title(out)
112
+ def middle_title(_isoxml, out)
113
113
  out.p(**{ class: "zzSTDTitle1" }) { |p| p << @meta.get[:doctitle] }
114
114
  end
115
115
 
@@ -120,7 +120,7 @@ module IsoDoc::Function
120
120
  end
121
121
 
122
122
  def middle(isoxml, out)
123
- middle_title(out)
123
+ middle_title(isoxml, out)
124
124
  middle_admonitions(isoxml, out)
125
125
  i = scope isoxml, out, 0
126
126
  i = norm_ref isoxml, out, i
@@ -157,6 +157,7 @@ module IsoDoc::Function
157
157
  when "sub" then sub_parse(node, out)
158
158
  when "tt" then tt_parse(node, out)
159
159
  when "strike" then strike_parse(node, out)
160
+ when "underline" then underline_parse(node, out)
160
161
  when "keyword" then keyword_parse(node, out)
161
162
  when "smallcap" then smallcap_parse(node, out)
162
163
  when "br" then br_parse(node, out)
@@ -152,8 +152,8 @@ module IsoDoc::Function
152
152
  def populate_template(docxml, _format = nil)
153
153
  meta = @meta
154
154
  .get
155
- .merge(@labels || {})
156
- .merge(@meta.labels || {})
155
+ .merge(@labels ? {labels: @labels} : {})
156
+ .merge(@meta.labels ? {labels: @meta.labels} : {})
157
157
  .merge(fonts_options || {})
158
158
  template = liquid(docxml)
159
159
  template.render(meta.map { |k, v| [k.to_s, empty2nil(v)] }.to_h)
@@ -161,7 +161,7 @@ module IsoDoc::Function
161
161
  end
162
162
 
163
163
  def save_dataimage(uri, _relative_dir = true)
164
- %r{^data:image/(?<imgtype>[^;]+);base64,(?<imgdata>.+)$} =~ uri
164
+ %r{^data:(image|application)/(?<imgtype>[^;]+);base64,(?<imgdata>.+)$} =~ uri
165
165
  imgtype.sub!(/\+[a-z0-9]+$/, '') # svg+xml
166
166
  imgtype = 'png' unless /^[a-z0-9]+$/.match imgtype
167
167
  Tempfile.open(['image', ".#{imgtype}"]) do |f|
@@ -173,7 +173,7 @@ module IsoDoc::Function
173
173
  end
174
174
 
175
175
  def image_localfile(i)
176
- if /^data:image/.match? i['src']
176
+ if /^data:/.match? i['src']
177
177
  save_dataimage(i['src'], false)
178
178
  elsif %r{^([A-Z]:)?/}.match? i['src']
179
179
  i['src']
@@ -111,6 +111,12 @@ module IsoDoc::HtmlFunction
111
111
  sourcecode_name_parse(node, out, name)
112
112
  end
113
113
 
114
+ def underline_parse(node, out)
115
+ out.span **{ style: "text-decoration: underline;" } do |e|
116
+ node.children.each { |n| parse(n, e) }
117
+ end
118
+ end
119
+
114
120
  def table_long_strings_cleanup(docxml)
115
121
  end
116
122
  end
@@ -137,7 +137,7 @@ module IsoDoc::HtmlFunction
137
137
  docxml.xpath("//*[local-name() = 'img']").each do |i|
138
138
  i["width"], i["height"] = Html2Doc.image_resize(i, image_localfile(i),
139
139
  @maxheight, @maxwidth)
140
- next if /^data:image/.match i["src"]
140
+ next if /^data:/.match i["src"]
141
141
  @datauriimage ? datauri(i) : move_image1(i)
142
142
  end
143
143
  docxml
@@ -145,9 +145,10 @@ module IsoDoc::HtmlFunction
145
145
 
146
146
  def datauri(i)
147
147
  type = i["src"].split(".")[-1]
148
+ supertype = type == "xml" ? "application" : "image"
148
149
  bin = IO.binread(image_localfile(i))
149
150
  data = Base64.strict_encode64(bin)
150
- i["src"] = "data:image/#{type};base64,#{data}"
151
+ i["src"] = "data:#{supertype}/#{type};base64,#{data}"
151
152
  end
152
153
 
153
154
  def image_suffix(i)
@@ -9,6 +9,12 @@ module IsoDoc
9
9
  docxml.xpath(ns("//figure")).each do |f|
10
10
  figure1(f)
11
11
  end
12
+ docxml.xpath(ns("//svgmap")).each do |s|
13
+ if f = s.at(ns("./figure")) then s.replace(f)
14
+ else
15
+ s.remove
16
+ end
17
+ end
12
18
  end
13
19
 
14
20
  def figure1(f)
@@ -211,7 +211,11 @@ module IsoDoc
211
211
  def mathml1(f, locale)
212
212
  localize_maths(f, locale)
213
213
  return unless f.elements.size == 1 && f.elements.first.name == "mn"
214
- f.replace(f.at("./m:mn", MATHML).children)
214
+ if f.parent.name == "stem"
215
+ f.parent.replace(f.at("./m:mn", MATHML).children)
216
+ else
217
+ f.replace(f.at("./m:mn", MATHML).children)
218
+ end
215
219
  end
216
220
 
217
221
  def variant(docxml)
@@ -47,7 +47,7 @@ module IsoDoc
47
47
  end
48
48
 
49
49
  def index(docxml)
50
- docxml.xpath(ns("//index | //index-xref")).each do |f|
50
+ docxml.xpath(ns("//index | //index-xref | //indexsect")).each do |f|
51
51
  f.remove
52
52
  end
53
53
  end
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "1.4.0".freeze
2
+ VERSION = "1.5.2".freeze
3
3
  end
@@ -24,7 +24,7 @@ module IsoDoc::WordFunction
24
24
 
25
25
  def imgsrc(node)
26
26
  ret = svg_to_emf(node) and return ret
27
- return node["src"] unless %r{^data:image/}.match node["src"]
27
+ return node["src"] unless %r{^data:}.match node["src"]
28
28
  save_dataimage(node["src"])
29
29
  end
30
30
 
@@ -45,7 +45,7 @@ module IsoDoc::WordFunction
45
45
  def svg_to_emf(node)
46
46
  return unless node["mimetype"] == "image/svg+xml"
47
47
  uri = node["src"]
48
- %r{^data:image/}.match(uri) and uri = save_dataimage(uri)
48
+ %r{^data:}.match(uri) and uri = save_dataimage(uri)
49
49
  ret = svg_to_emf_filename(uri)
50
50
  File.exists?(ret) and return ret
51
51
  exe = inkscape_installed? or return nil
@@ -96,7 +96,7 @@ module IsoDoc::WordFunction
96
96
  def generate_header(filename, _dir)
97
97
  return nil unless @header
98
98
  template = IsoDoc::Common.liquid(File.read(@header, encoding: "UTF-8"))
99
- meta = @meta.get.merge(@labels || {}).merge(@meta.labels || {})
99
+ meta = @meta.get.merge(@labels ? { labels: @labels } : {}).merge(@meta.labels ? { labels: @meta.labels } : {})
100
100
  meta[:filename] = filename
101
101
  params = meta.map { |k, v| [k.to_s, v] }.to_h
102
102
  Tempfile.open(%w(header html), :encoding => "utf-8") do |f|
@@ -2,41 +2,56 @@ require "roman-numerals"
2
2
 
3
3
  module IsoDoc::XrefGen
4
4
  class Counter
5
- def initialize(num = 0)
5
+ def initialize(num = 0, opts = {numerals: :arabic})
6
6
  @num = num
7
7
  @letter = ""
8
8
  @subseq = ""
9
9
  @letter_override = nil
10
10
  @number_override = nil
11
+ @style = opts[:numerals]
11
12
  @base = ""
13
+ if num.is_a? String
14
+ if /^\d+$/.match(num)
15
+ @num = num.to_i
16
+ else
17
+ @num = nil
18
+ @base = num[0..-2]
19
+ @letter = num[-1]
20
+ end
21
+ end
12
22
  end
13
23
 
14
24
  def new_subseq_increment(node)
15
25
  @subseq = node["subsequence"]
16
- @num += 1
26
+ @num += 1 unless @num.nil?
17
27
  @letter = node["subsequence"] ? "a" : ""
18
28
  @base = ""
19
29
  if node["number"]
20
- /^(?<b>.*?)(?<n>\d*)(?<a>[a-z]*)$/ =~ node["number"]
30
+ /^(?<b>.*?)(?<n>\d*)(?<a>[a-zA-Z]*)$/ =~ node["number"]
21
31
  if !n.empty? || !a.empty?
22
32
  @letter_override = @letter = a unless a.empty?
23
33
  @number_override = @num = n.to_i unless n.empty?
24
34
  @base = b
25
35
  else
26
36
  @letter_override = node["number"]
27
- @letter = @letter_override if /^[a-z]$/.match(@letter_override)
37
+ @letter = @letter_override if /^[a-zA-Z]$/.match(@letter_override)
28
38
  end
29
39
  end
30
40
  end
31
41
 
32
42
  def sequence_increment(node)
33
43
  if node["number"]
34
- @base = ""
35
- @number_override = node["number"]
44
+ @base = @letter_override = @number_override = ""
36
45
  /^(?<b>.*?)(?<n>\d+)$/ =~ node["number"]
37
- unless n.nil? || n.empty?
46
+ if blank?(n)
47
+ @num = nil
48
+ @base = node["number"][0..-2]
49
+ @letter = @letter_override = node["number"][-1]
50
+ else
51
+ @number_override = node["number"]
38
52
  @num = n.to_i
39
53
  @base = b
54
+ @letter = ""
40
55
  end
41
56
  else
42
57
  @num += 1
@@ -47,9 +62,20 @@ module IsoDoc::XrefGen
47
62
  if node["number"]
48
63
  @base = ""
49
64
  @letter_override = node["number"]
50
- /^(?<b>.*?)(?<n>\d*)(?<a>[a-z]+)$/ =~ node["number"]
51
- unless a.empty?
52
- @letter = a
65
+ /^(?<b>.*?)(?<n>\d*)(?<a>[a-zA-Z])$/ =~ node["number"]
66
+ if blank?(a)
67
+ if /^\d+$/.match(node["number"])
68
+ @letter_override = @letter = ""
69
+ @number_override = @num = node["number"].to_i
70
+ else
71
+ /^(?<b>.*)(?<a>[a-zA-Z])$/ =~ node["number"]
72
+ unless blank?(a)
73
+ @letter = @letter_override = a
74
+ @base = b
75
+ end
76
+ end
77
+ else
78
+ @letter_override = @letter = a
53
79
  @base = b
54
80
  @number_override = @num = n.to_i unless n.empty?
55
81
  end
@@ -58,11 +84,15 @@ module IsoDoc::XrefGen
58
84
  end
59
85
  end
60
86
 
87
+ def blank?(x)
88
+ x.nil? || x.empty?
89
+ end
90
+
61
91
  def increment(node)
62
92
  return self if node["unnumbered"]
63
93
  @letter_override = nil
64
94
  @number_override = nil
65
- if node["subsequence"] != @subseq
95
+ if node["subsequence"] != @subseq && !(blank?(node["subsequence"]) && blank?(@subseq))
66
96
  new_subseq_increment(node)
67
97
  elsif @letter.empty?
68
98
  sequence_increment(node)
@@ -73,7 +103,9 @@ module IsoDoc::XrefGen
73
103
  end
74
104
 
75
105
  def print
76
- "#{@base}#{@number_override || @num}#{@letter_override || @letter}"
106
+ num = @number_override || @num
107
+ num_out = @style == :roman && !num.nil? ? RomanNumerals.to_roman(num) : num
108
+ "#{@base}#{num_out}#{@letter_override || @letter}"
77
109
  end
78
110
 
79
111
  def ol_type(list, depth)
@@ -1,23 +1,25 @@
1
1
  module IsoDoc::XrefGen
2
2
  module Sections
3
3
  def back_anchor_names(docxml)
4
- docxml.xpath(ns("//annex")).each_with_index do |c, i|
5
- annex_names(c, (65 + i).chr.to_s)
4
+ i = Counter.new("@")
5
+ docxml.xpath(ns("//annex")).each do |c|
6
+ i.increment(c)
7
+ annex_names(c, i.print)
8
+ end
9
+ docxml.xpath(ns(@klass.bibliography_xpath)).each do |b|
10
+ preface_names(b)
11
+ end
12
+ docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
13
+ reference_names(ref)
6
14
  end
7
- docxml.xpath(
8
- ns(@klass.bibliography_xpath)).each do |b|
9
- preface_names(b)
10
- end
11
- docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
12
- reference_names(ref)
13
- end
14
15
  end
15
16
 
16
17
  def initial_anchor_names(d)
17
18
  d.xpath(ns("//preface/*")).each { |c| c.element? and preface_names(c) }
18
19
  # potentially overridden in middle_section_asset_names()
19
20
  sequential_asset_names(d.xpath(ns("//preface/*")))
20
- n = section_names(d.at(ns("//clause[@type = 'scope']")), 0, 1)
21
+ n = Counter.new
22
+ n = section_names(d.at(ns("//clause[@type = 'scope']")), n, 1)
21
23
  n = section_names(d.at(ns(@klass.norm_ref_xpath)), n, 1)
22
24
  n = section_names(d.at(ns("//sections/terms | "\
23
25
  "//sections/clause[descendant::terms]")), n, 1)
@@ -52,8 +54,7 @@ module IsoDoc::XrefGen
52
54
  label = title || parent_title
53
55
  @anchors[clause["id"]] =
54
56
  { label: nil, level: level, xref: label, type: "clause" }
55
- clause.xpath(ns(SUBCLAUSES)).
56
- each_with_index do |c, i|
57
+ clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
57
58
  preface_names1(c, c.at(ns("./title"))&.text, "#{label} #{i+1}",
58
59
  level + 1)
59
60
  end
@@ -67,21 +68,22 @@ module IsoDoc::XrefGen
67
68
  sequential_asset_names(d.xpath(ns(middle_sections)))
68
69
  end
69
70
 
70
- def clause_names(docxml, sect_num)
71
+ def clause_names(docxml, n)
71
72
  docxml.xpath(ns(@klass.middle_clause(docxml))).each_with_index do |c, i|
72
- section_names(c, (i + sect_num), 1)
73
+ section_names(c, n, 1)
73
74
  end
74
75
  end
75
76
 
76
77
  def section_names(clause, num, lvl)
77
78
  return num if clause.nil?
78
- num = num + 1
79
+ num.increment(clause)
79
80
  @anchors[clause["id"]] =
80
- { label: num.to_s, xref: l10n("#{@labels["clause"]} #{num}"), level: lvl,
81
+ { label: num.print, xref: l10n("#{@labels["clause"]} #{num.print}"), level: lvl,
81
82
  type: "clause" }
82
- clause.xpath(ns(SUBCLAUSES)).
83
- each_with_index do |c, i|
84
- section_names1(c, "#{num}.#{i + 1}", lvl + 1)
83
+ i = Counter.new
84
+ clause.xpath(ns(SUBCLAUSES)).each do |c|
85
+ i.increment(c)
86
+ section_names1(c, "#{num.print}.#{i.print}", lvl + 1)
85
87
  end
86
88
  num
87
89
  end
@@ -90,9 +92,10 @@ module IsoDoc::XrefGen
90
92
  @anchors[clause["id"]] =
91
93
  { label: num, level: level, xref: l10n("#{@labels["clause"]} #{num}"),
92
94
  type: "clause" }
93
- clause.xpath(ns(SUBCLAUSES)).
94
- each_with_index do |c, i|
95
- section_names1(c, "#{num}.#{i + 1}", level + 1)
95
+ i = Counter.new
96
+ clause.xpath(ns(SUBCLAUSES)).each do |c|
97
+ i.increment(c)
98
+ section_names1(c, "#{num}.#{i.print}", level + 1)
96
99
  end
97
100
  end
98
101
 
@@ -118,8 +121,10 @@ module IsoDoc::XrefGen
118
121
  if a = single_annex_special_section(clause)
119
122
  annex_names1(a, "#{num}", 1)
120
123
  else
121
- clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
122
- annex_names1(c, "#{num}.#{i + 1}", 2)
124
+ i = Counter.new
125
+ clause.xpath(ns(SUBCLAUSES)).each do |c|
126
+ i.increment(c)
127
+ annex_names1(c, "#{num}.#{i.print}", 2)
123
128
  end
124
129
  end
125
130
  hierarchical_asset_names(clause, num)
@@ -128,8 +133,10 @@ module IsoDoc::XrefGen
128
133
  def annex_names1(clause, num, level)
129
134
  @anchors[clause["id"]] = { label: num, xref: "#{@labels["annex"]} #{num}",
130
135
  level: level, type: "clause" }
131
- clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
132
- annex_names1(c, "#{num}.#{i + 1}", level + 1)
136
+ i = Counter.new
137
+ clause.xpath(ns(SUBCLAUSES)).each_with_index do |c|
138
+ i.increment(c)
139
+ annex_names1(c, "#{num}.#{i.print}", level + 1)
133
140
  end
134
141
  end
135
142