muwu 3.2.0 → 4.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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/lib/muwu/cli/help/summary +1 -1
  3. data/lib/muwu/cli/help/view +2 -2
  4. data/lib/muwu/controller/controller_interaction.rb +10 -4
  5. data/lib/muwu/default/default.rb +2 -8
  6. data/lib/muwu/helper/html_href_helper.rb +77 -77
  7. data/lib/muwu/helper/outline_helper.rb +22 -24
  8. data/lib/muwu/helper/regexp_lib.rb +26 -51
  9. data/lib/muwu/helper/sanitizer_helper.rb +5 -5
  10. data/lib/muwu/manifest/manifest.rb +52 -70
  11. data/lib/muwu/manifest_task/document_html.rb +16 -22
  12. data/lib/muwu/manifest_task/text.rb +13 -13
  13. data/lib/muwu/manifest_task/{text_item.rb → topic.rb} +9 -9
  14. data/lib/muwu/manifest_task_builder/text_builder.rb +24 -24
  15. data/lib/muwu/manifest_task_builder/{text_item_builder.rb → topic_builder.rb} +48 -74
  16. data/lib/muwu/project/project.rb +0 -8
  17. data/lib/muwu/project_builder/assets/config/css/base/html_elements.scss +57 -62
  18. data/lib/muwu/project_builder/assets/config/css/base/index.scss +3 -2
  19. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_contents.scss +35 -57
  20. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_metadata.scss +2 -14
  21. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_navigator.scss +6 -11
  22. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_subcontents.scss +35 -57
  23. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_text.scss +2 -48
  24. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_title.scss +18 -23
  25. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_topic.scss +38 -0
  26. data/lib/muwu/project_builder/assets/config/css/colors/dark.scss +33 -31
  27. data/lib/muwu/project_builder/assets/config/css/colors/index.scss +2 -1
  28. data/lib/muwu/project_builder/assets/config/css/colors/light.scss +33 -33
  29. data/lib/muwu/project_builder/project_validator.rb +7 -7
  30. data/lib/muwu/project_exception/{lynx_not_available.rb → no_html_viewer_configured.rb} +2 -2
  31. data/lib/muwu/project_exception/{text_source_file_not_found.rb → topic_source_file_not_found.rb} +6 -7
  32. data/lib/muwu/project_options/project_options.rb +4 -1
  33. data/lib/muwu/project_options_builder/project_option_validator_key.rb +17 -19
  34. data/lib/muwu/project_options_builder/project_option_validator_value.rb +42 -59
  35. data/lib/muwu/render_concat/render_concat.rb +22 -22
  36. data/lib/muwu/render_html_partial/js_library/navigation.js +1 -1
  37. data/lib/muwu/render_html_partial/render_contents.rb +139 -139
  38. data/lib/muwu/render_html_partial/render_document_html.rb +2 -2
  39. data/lib/muwu/render_html_partial/render_metadata.rb +25 -37
  40. data/lib/muwu/render_html_partial/render_navigator.rb +39 -39
  41. data/lib/muwu/render_html_partial/render_subcontents.rb +142 -143
  42. data/lib/muwu/render_html_partial/render_text.rb +11 -11
  43. data/lib/muwu/render_html_partial/render_title.rb +21 -21
  44. data/lib/muwu/render_html_partial/{render_text_item.rb → render_topic.rb} +62 -35
  45. data/lib/muwu/render_html_partial_builder/render_contents_builder.rb +17 -23
  46. data/lib/muwu/render_html_partial_builder/render_subcontents_builder.rb +3 -9
  47. data/lib/muwu/render_html_partial_builder/render_text_builder.rb +11 -11
  48. data/lib/muwu/render_html_partial_builder/render_topic_builder.rb +281 -0
  49. data/lib/muwu/render_inspector/render_inspector.rb +58 -58
  50. data/lib/muwu/viewer/viewer.rb +2 -2
  51. data/lib/muwu.rb +2 -7
  52. metadata +30 -78
  53. data/lib/muwu/project_builder/assets/config/css/base/mixin_text_section_heading.scss +0 -24
  54. data/lib/muwu/render_html/render_markup_to_html.rb +0 -87
  55. data/lib/muwu/render_html_partial_builder/render_text_item_builder.rb +0 -274
  56. data/lib/muwu/var/deflistdiv.rb +0 -239
@@ -3,20 +3,20 @@ module Muwu
3
3
 
4
4
 
5
5
  include Muwu
6
-
7
-
6
+
7
+
8
8
  attr_accessor(
9
9
  :documents,
10
10
  :options,
11
11
  :project
12
12
  )
13
-
14
-
13
+
14
+
15
15
  def initialize
16
16
  @documents = []
17
17
  end
18
-
19
-
18
+
19
+
20
20
  def inspect
21
21
  ["#{self.to_s}", "{", inspect_instance_variables, "}"].join(' ')
22
22
  end
@@ -24,13 +24,13 @@ module Muwu
24
24
 
25
25
  def inspect_instance_variables
26
26
  self.instance_variables.map { |v| "#{v}=#<#{instance_variable_get(v).class}>" }.join(", ")
27
- end
28
-
29
-
30
-
27
+ end
28
+
29
+
30
+
31
31
  public
32
-
33
-
32
+
33
+
34
34
  def contents_block_by_name(text_root_name)
35
35
  matching_contents = []
36
36
  documents_html.each do |document_html|
@@ -38,48 +38,56 @@ module Muwu
38
38
  end
39
39
  matching_contents.flatten[0]
40
40
  end
41
-
42
-
41
+
42
+
43
+ def contents_block_filename_for(text_root_name)
44
+ contents_block = contents_block_by_name(text_root_name)
45
+ if contents_block
46
+ contents_block.destination.output_filename
47
+ end
48
+ end
49
+
50
+
43
51
  def documents_count
44
52
  @documents.length
45
53
  end
46
-
47
-
54
+
55
+
48
56
  def documents_css
49
57
  @documents.select { |d| ManifestTask::DocumentCss === d }
50
58
  end
51
-
52
-
59
+
60
+
53
61
  def documents_css_count
54
62
  documents_css.length
55
63
  end
56
-
57
-
64
+
65
+
58
66
  def documents_html
59
- @documents.select { |d| ManifestTask::DocumentHtml === d }
67
+ @documents.select { |d| ManifestTask::DocumentHtml === d }
60
68
  end
61
-
62
-
69
+
70
+
63
71
  def documents_html_count
64
72
  documents_html.length
65
73
  end
66
-
67
-
74
+
75
+
68
76
  def documents_js
69
77
  @documents.select { |d| ManifestTask::DocumentJs === d }
70
78
  end
71
-
72
-
79
+
80
+
73
81
  def documents_js_count
74
82
  documents_js.length
75
83
  end
76
-
77
-
84
+
85
+
78
86
  def does_have_documents
79
87
  documents_count > 0
80
88
  end
81
-
82
-
89
+
90
+
83
91
  def does_have_documents_css
84
92
  documents_css_count > 0
85
93
  end
@@ -98,44 +106,18 @@ module Muwu
98
106
  def does_not_have_documents
99
107
  documents_count == 0
100
108
  end
101
-
102
-
109
+
110
+
103
111
  def find_document_html_by_index(index)
104
112
  documents_html.select { |document_html| document_html.index == index }[0]
105
113
  end
106
-
107
-
108
- # def outline_has_more_than_one_text_block
109
- # outline_text_blocks_count > 1
110
- # end
111
- #
112
- #
113
- # def outline_has_only_one_text_block
114
- # outline_text_blocks_count = 1
115
- # end
116
- #
117
- #
118
- # def outline_text_blocks
119
- # text_sections = []
120
- # project_outline.flatten.select{ |step| Hash === step }.each do |step|
121
- # if step.flatten[0] =~ REGEXP.outline_text
122
- # text_sections << step
123
- # end
124
- # end
125
- # text_sections
126
- # end
127
- #
128
- #
129
- # def outline_text_blocks_count
130
- # outline_text_blocks.count
131
- # end
132
- #
133
- #
134
- # def project_outline
135
- # @project.outline
136
- # end
137
-
138
-
114
+
115
+
116
+ def has_contents_for(text_root_name)
117
+ ManifestTask::Contents === contents_block_by_name(text_root_name)
118
+ end
119
+
120
+
139
121
  def text_blocks
140
122
  text_blocks = []
141
123
  documents_html.each do |document_html|
@@ -143,8 +125,8 @@ module Muwu
143
125
  end
144
126
  text_blocks.flatten
145
127
  end
146
-
147
-
128
+
129
+
148
130
  def text_blocks_by_name(text_root_name)
149
131
  matching_text_blocks = []
150
132
  documents_html.each do |document_html|
@@ -152,7 +134,7 @@ module Muwu
152
134
  end
153
135
  matching_text_blocks.flatten
154
136
  end
155
-
156
-
137
+
138
+
157
139
  end
158
140
  end
@@ -7,7 +7,6 @@ module Muwu
7
7
  :destination,
8
8
  :css_filename,
9
9
  :css_include_method,
10
- # :filename,
11
10
  :index,
12
11
  :js_filename,
13
12
  :js_include_method,
@@ -15,8 +14,8 @@ module Muwu
15
14
  :project,
16
15
  :tasks
17
16
  )
18
-
19
-
17
+
18
+
20
19
  def inspect
21
20
  ["#{self.to_s}", "{", inspect_instance_variables, "}"].join(' ')
22
21
  end
@@ -25,35 +24,35 @@ module Muwu
25
24
  def inspect_instance_variables
26
25
  self.instance_variables.map { |v| "#{v}=#<#{instance_variable_get(v).class}>" }.join(", ")
27
26
  end
28
-
29
-
27
+
28
+
30
29
  public
31
-
32
-
30
+
31
+
33
32
  def contents_blocks
34
33
  @tasks.select { |task| ManifestTask::Contents === task }
35
34
  end
36
-
37
-
35
+
36
+
38
37
  def contents_blocks_by_name(text_root_name)
39
- contents_blocks.select { |task| task.text_root_name.downcase == text_root_name.downcase }
38
+ contents_blocks.select { |contents| contents.text_root_name.downcase == text_root_name.downcase }
40
39
  end
41
-
42
-
40
+
41
+
43
42
  def filename
44
43
  @destination.output_filename
45
44
  end
46
-
47
-
45
+
46
+
48
47
  def text_blocks
49
48
  @tasks.select { |task| ManifestTask::Text === task }
50
49
  end
51
-
52
-
50
+
51
+
53
52
  def text_blocks_by_name(text_root_name)
54
53
  text_blocks.select { |task| task.text_root_name.strip.downcase == text_root_name.strip.downcase }
55
54
  end
56
-
55
+
57
56
 
58
57
  def will_generate_subcontents_automatically
59
58
  if @project.options.generate_subcontents_automatically
@@ -62,11 +61,6 @@ module Muwu
62
61
  return false
63
62
  end
64
63
  end
65
-
66
-
67
-
68
- public
69
-
70
64
 
71
65
 
72
66
  end
@@ -3,15 +3,15 @@ module Muwu
3
3
  class Text
4
4
 
5
5
 
6
- attr_accessor(
7
- :destination,
6
+ attr_accessor(
7
+ :destination,
8
8
  :naming,
9
9
  :numbering,
10
10
  :project,
11
- :sections
11
+ :topics
12
12
  )
13
-
14
-
13
+
14
+
15
15
  def inspect
16
16
  ["#{self.to_s}", "{", inspect_instance_variables, "}"].join(' ')
17
17
  end
@@ -19,23 +19,23 @@ module Muwu
19
19
 
20
20
  def inspect_instance_variables
21
21
  self.instance_variables.map { |v| "#{v}=#<#{instance_variable_get(v).class}>" }.join(", ")
22
- end
22
+ end
23
+
24
+
23
25
 
24
-
25
-
26
26
  public
27
27
 
28
-
28
+
29
29
  def naming_downcase
30
30
  @naming.map {|n| n.downcase}
31
31
  end
32
-
33
-
32
+
33
+
34
34
  def naming_downcase_without_text_root
35
35
  naming_without_text_root.map {|n| n.downcase}
36
36
  end
37
-
38
-
37
+
38
+
39
39
  def naming_without_text_root
40
40
  @naming[1..-1]
41
41
  end
@@ -1,6 +1,6 @@
1
1
  module Muwu
2
2
  module ManifestTask
3
- class TextItem
3
+ class Topic
4
4
 
5
5
 
6
6
  include Muwu
@@ -10,12 +10,13 @@ module Muwu
10
10
  :destination,
11
11
  :heading,
12
12
  :heading_origin,
13
+ :id,
13
14
  :naming,
14
15
  :numbering,
15
16
  :outline,
16
17
  :project,
17
- :sections,
18
- :source_filename
18
+ :source_filename,
19
+ :subtopics,
19
20
  )
20
21
 
21
22
 
@@ -33,8 +34,8 @@ module Muwu
33
34
  public
34
35
 
35
36
 
36
- def does_have_child_sections
37
- is_parent_heading && (@sections.length >= 1)
37
+ def does_have_subtopics
38
+ is_parent_heading && (@subtopics.length >= 1)
38
39
  end
39
40
 
40
41
 
@@ -44,7 +45,7 @@ module Muwu
44
45
 
45
46
 
46
47
  def is_parent_heading
47
- Array === @sections
48
+ Array === @subtopics
48
49
  end
49
50
 
50
51
 
@@ -64,13 +65,12 @@ module Muwu
64
65
 
65
66
 
66
67
  def numbering_to_depth_max
67
- # using a truthy conditional because the option could be an integer, nil, or a boolean false
68
68
  if @project.options.render_sections_distinctly_depth_max
69
69
  index_min = 0
70
70
  index_max = @project.options.render_sections_distinctly_depth_max - 1
71
71
  if index_max >= index_min
72
72
  @numbering[index_min..index_max]
73
- else # fallback to @numbering so code doesn't break
73
+ else
74
74
  @numbering
75
75
  end
76
76
  else
@@ -84,7 +84,7 @@ module Muwu
84
84
  end
85
85
 
86
86
 
87
- def section_depth
87
+ def topic_depth
88
88
  @numbering.length
89
89
  end
90
90
 
@@ -35,15 +35,15 @@ module Muwu
35
35
  set_destination
36
36
  set_naming
37
37
  set_numbering
38
- set_sections
38
+ set_topics
39
39
  end
40
40
 
41
-
41
+
42
42
  def set_destination
43
43
  @text.destination = @parent_document.destination
44
44
  end
45
45
 
46
-
46
+
47
47
  def set_naming
48
48
  @text.naming = [determine_text_block_name]
49
49
  end
@@ -52,15 +52,15 @@ module Muwu
52
52
  def set_numbering
53
53
  @text.numbering = []
54
54
  end
55
-
55
+
56
56
 
57
57
  def set_project
58
58
  @text.project = @project
59
59
  end
60
-
61
-
62
- def set_sections
63
- @text.sections = build_sections
60
+
61
+
62
+ def set_topics
63
+ @text.topics = build_topics
64
64
  end
65
65
 
66
66
 
@@ -68,24 +68,24 @@ module Muwu
68
68
  private
69
69
 
70
70
 
71
- def build_sections
72
- sections = []
71
+ def build_topic(step, section_numbering)
72
+ ManifestTaskBuilders::TopicBuilder.build do |b|
73
+ b.build_from_outline_fragment_text(step, section_numbering, @text)
74
+ end
75
+ end
76
+
77
+
78
+ def build_topics
79
+ topics = []
73
80
  child_steps = determine_text_block_steps
74
81
  if child_steps.empty? == false
75
82
  child_section_numbering = section_number_extend(@text.numbering)
76
83
  child_steps.each do |step|
77
84
  child_section_numbering = section_number_find(child_section_numbering, step)
78
- sections << build_text_item(step, child_section_numbering)
85
+ topics << build_topic(step, child_section_numbering)
79
86
  end
80
87
  end
81
- sections
82
- end
83
-
84
-
85
- def build_text_item(step, section_numbering)
86
- ManifestTaskBuilders::TextItemBuilder.build do |b|
87
- b.build_from_outline_fragment_text(step, section_numbering, @text)
88
- end
88
+ topics
89
89
  end
90
90
 
91
91
 
@@ -98,8 +98,8 @@ module Muwu
98
98
  end
99
99
  text_block_name
100
100
  end
101
-
102
-
101
+
102
+
103
103
  def determine_text_block_steps
104
104
  @outline_text.flatten[1]
105
105
  end
@@ -111,15 +111,15 @@ module Muwu
111
111
  number_outgoing
112
112
  end
113
113
 
114
-
114
+
115
115
  def section_number_find(number_incoming, step)
116
116
  number_outgoing = number_incoming.clone
117
117
  sorted_outline_steps = @project.outline_text_blocks_named(@text.text_root_name)
118
118
  number_outgoing[-1] = sorted_outline_steps.index(step) + 1
119
119
  number_outgoing
120
120
  end
121
-
122
-
121
+
122
+
123
123
  end
124
124
  end
125
125
  end