muwu 4.0.0 → 5.0.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: 5e6d222cd47218dfdadbdebbeec54a34e9a21d3fd712ea8d41167a3e4202fa76
4
- data.tar.gz: 68fa281753870cecb29570f3f56897ebb8f764a6f793a4600a55c04b54d42144
3
+ metadata.gz: 4ac0e19a295355e6ff874c375f90d4ad726202b1b0233180180ce19210d097f9
4
+ data.tar.gz: 0b0503893e8a2731a5b9ccb73105d40eb1365190d9291f93e93c7368a0da38ef
5
5
  SHA512:
6
- metadata.gz: 610febd5bb1e383bf2c185b4861a0029d30566e2bd445bdac8ee0c381e4b073142f9c805d0275e439c7be6d9d6217270418d2dcc5765bdf1d6584dae03a61a50
7
- data.tar.gz: d5bf793b752727bc8dc9d527645996fd32dadf42a74041852ea123f7b1df39b43dac2a4ca9553bf40cd704f9d8cffc2f39714e1678d91271a2953bda73631c4d
6
+ metadata.gz: e56dbd4b69207106cbc8e746256918cce305e43668ffb7d884a90186ef874be3946574122c539588182dc4834bac5ffd3c1af266c9a8346d004e81be0e50d820
7
+ data.tar.gz: b56e9b4fa50bc60a561f36ab8c7f08edfc8cfee754e129432270fd9711c6a0c28ce4063ae63170ad4591b22015a3dbf52b16753ab61ff58021977a78b4841bcc
@@ -7,17 +7,17 @@ module Muwu
7
7
 
8
8
 
9
9
  def id_contents_item(topic)
10
- hyphenate(['contents', topic.text_root_name, topic.id])
10
+ hyphenate(['contents', topic.text_root_name, topic.numbering_for_display])
11
11
  end
12
12
 
13
13
 
14
14
  def id_subcontents_item(topic)
15
- hyphenate(['subcontents', topic.text_root_name, topic.id])
15
+ hyphenate(['subcontents', topic.text_root_name, topic.numbering_for_display])
16
16
  end
17
17
 
18
18
 
19
19
  def id_topic_header(topic)
20
- hyphenate(['text', topic.text_root_name, topic.id])
20
+ hyphenate(['text', topic.text_root_name, topic.numbering_for_display])
21
21
  end
22
22
 
23
23
 
@@ -34,11 +34,27 @@ module Muwu
34
34
  public
35
35
 
36
36
 
37
+ def depth
38
+ numbering.length
39
+ end
40
+
41
+
37
42
  def does_have_subtopics
38
43
  is_parent_heading && (@subtopics.length >= 1)
39
44
  end
40
45
 
41
46
 
47
+ def is_distinct
48
+ if project.options.topic_depth_max == nil
49
+ true
50
+ elsif depth <= project.options.topic_depth_max
51
+ true
52
+ elsif depth > project.options.topic_depth_max
53
+ false
54
+ end
55
+ end
56
+
57
+
42
58
  def is_not_parent_heading
43
59
  is_parent_heading == false
44
60
  end
@@ -65,9 +81,9 @@ module Muwu
65
81
 
66
82
 
67
83
  def numbering_to_depth_max
68
- if @project.options.render_sections_distinctly_depth_max
84
+ if @project.options.topic_depth_max
69
85
  index_min = 0
70
- index_max = @project.options.render_sections_distinctly_depth_max - 1
86
+ index_max = @project.options.topic_depth_max - 1
71
87
  if index_max >= index_min
72
88
  @numbering[index_min..index_max]
73
89
  else
@@ -79,6 +95,11 @@ module Muwu
79
95
  end
80
96
 
81
97
 
98
+ def numbering_for_display
99
+ numbering_to_depth_max.join('.')
100
+ end
101
+
102
+
82
103
  def project_directory
83
104
  @project.working_directory
84
105
  end
@@ -48,6 +48,11 @@ module Muwu
48
48
  public
49
49
 
50
50
 
51
+ def topic_depth_max
52
+ render_sections_distinctly_depth_max
53
+ end
54
+
55
+
51
56
  def set_option(key, value)
52
57
  if Default::PROJECT_OPTIONS.has_key?(key)
53
58
  key_ivsym = "@#{key.to_s}"
@@ -12,7 +12,6 @@ module Muwu
12
12
  attr_accessor(
13
13
  :destination,
14
14
  :html_attr_id,
15
- :item_depth_max,
16
15
  :project,
17
16
  :topics,
18
17
  :text_root_name,
@@ -65,7 +64,7 @@ module Muwu
65
64
 
66
65
 
67
66
  def render_ol_li(topic)
68
- if task_depth_is_within_range(topic)
67
+ if topic.is_distinct
69
68
  html_id = Helper::HrefHelper.id_contents_item(topic)
70
69
  if topic.is_parent_heading
71
70
  write_tag_li_open(html_id)
@@ -105,7 +104,7 @@ module Muwu
105
104
 
106
105
 
107
106
  def render_table_tr(topic)
108
- if task_depth_is_within_range(topic)
107
+ if topic.is_distinct
109
108
  html_id = Helper::HrefHelper.id_contents_item(topic)
110
109
  write_tag_tr_open(html_id)
111
110
  @destination.margin_indent do
@@ -354,19 +353,6 @@ module Muwu
354
353
  end
355
354
 
356
355
 
357
- def task_depth_is_within_range(topic)
358
- result = nil
359
- if @item_depth_max == nil
360
- result = true
361
- elsif topic.topic_depth <= @item_depth_max
362
- result = true
363
- elsif topic.topic_depth > @item_depth_max
364
- result = false
365
- end
366
- result
367
- end
368
-
369
-
370
356
  end
371
357
  end
372
358
  end
@@ -9,7 +9,6 @@ module Muwu
9
9
  attr_accessor(
10
10
  :destination,
11
11
  :html_attr_id,
12
- :item_depth_max,
13
12
  :project,
14
13
  :sections,
15
14
  :text_root_block,
@@ -61,7 +60,7 @@ module Muwu
61
60
 
62
61
 
63
62
  def render_ol_li(topic)
64
- if task_depth_is_within_range(topic)
63
+ if topic.is_distinct
65
64
  html_id = Helper::HrefHelper.id_subcontents_item(topic)
66
65
  if topic.is_parent_heading
67
66
  write_tag_li_open(html_id)
@@ -106,7 +105,7 @@ module Muwu
106
105
 
107
106
 
108
107
  def render_table_tr(topic)
109
- if task_depth_is_within_range(topic)
108
+ if topic.is_distinct
110
109
  html_id = Helper::HrefHelper.id_subcontents_item(topic)
111
110
  write_tag_tr_open(html_id)
112
111
  @destination.margin_indent do
@@ -355,19 +354,6 @@ module Muwu
355
354
  end
356
355
 
357
356
 
358
- def task_depth_is_within_range(topic)
359
- result = nil
360
- if @item_depth_max == nil
361
- result = true
362
- elsif topic.topic_depth <= @item_depth_max
363
- result = true
364
- elsif topic.topic_depth > @item_depth_max
365
- result = false
366
- end
367
- result
368
- end
369
-
370
-
371
357
  end
372
358
  end
373
359
  end
@@ -191,7 +191,7 @@ module Muwu
191
191
  data_source_class << "#{source_relative_segments[i]}-#{node.name}"
192
192
  end
193
193
  node['data-topic-source-class'] = data_source_class.join(' ')
194
- node['data-topic-id-class'] = "#{id}-#{node.name}"
194
+ node['data-topic-id-class'] = "#{@id}-#{node.name}"
195
195
  end
196
196
  end
197
197
  end
@@ -33,7 +33,6 @@ module Muwu
33
33
  phase_1_set_text_root_name
34
34
  phase_2_set_destination
35
35
  phase_2_set_html_attr_id
36
- phase_2_set_item_depth_max
37
36
  phase_2_set_project
38
37
  phase_2_set_topics
39
38
  phase_2_set_will_render_section_numbers
@@ -55,11 +54,6 @@ module Muwu
55
54
  end
56
55
 
57
56
 
58
- def phase_2_set_item_depth_max
59
- @renderer.item_depth_max = @project.options.render_sections_distinctly_depth_max
60
- end
61
-
62
-
63
57
  def phase_2_set_project
64
58
  @renderer.project = @project
65
59
  end
@@ -32,7 +32,6 @@ module Muwu
32
32
  @text_root_name = task_subcontents.text_root_name
33
33
  set_destination
34
34
  set_html_attr_id
35
- set_item_depth_max
36
35
  set_project
37
36
  set_text_root_blocks
38
37
  set_will_render_section_numbers
@@ -49,11 +48,6 @@ module Muwu
49
48
  end
50
49
 
51
50
 
52
- def set_item_depth_max
53
- @renderer.item_depth_max = @project.options.render_sections_distinctly_depth_max
54
- end
55
-
56
-
57
51
  def set_project
58
52
  @renderer.project = @project
59
53
  end
@@ -103,12 +103,12 @@ module Muwu
103
103
 
104
104
 
105
105
  def phase_1_set_depth
106
- @renderer.depth = @manifest_topic.topic_depth
106
+ @renderer.depth = @manifest_topic.depth
107
107
  end
108
108
 
109
109
 
110
110
  def phase_1_set_numbering_as_text
111
- @renderer.numbering_as_text = @manifest_topic.numbering.join('.')
111
+ @renderer.numbering_as_text = @manifest_topic.numbering_for_display
112
112
  end
113
113
 
114
114
 
@@ -199,7 +199,7 @@ module Muwu
199
199
  def render_inspector_manifest_task_topic(topic)
200
200
  puts_line [
201
201
  indent("| Topic #{topic.id}"),
202
- topic.numbering.inspect,
202
+ topic.numbering_for_display,
203
203
  topic.heading.inspect,
204
204
  topic.source_filename,
205
205
  ('!!' if topic.source_file_does_not_exist)
data/lib/muwu.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Muwu
2
2
 
3
- VERSION = '4.0.0'
3
+ VERSION = '5.0.0'
4
4
 
5
5
  GEM_HOME_LIB = File.absolute_path(File.join(File.dirname(__FILE__)))
6
6
  GEM_HOME_LIB_MUWU = File.absolute_path(File.join(GEM_HOME_LIB, 'muwu'))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muwu
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eli Harrison