muwu 2.5.1

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 (126) hide show
  1. checksums.yaml +7 -0
  2. data/bin/muwu +5 -0
  3. data/lib/muwu.rb +38 -0
  4. data/lib/muwu/cli/cli.rb +143 -0
  5. data/lib/muwu/cli/cli_help.rb +28 -0
  6. data/lib/muwu/cli/help/compile +22 -0
  7. data/lib/muwu/cli/help/concat +8 -0
  8. data/lib/muwu/cli/help/heading +2 -0
  9. data/lib/muwu/cli/help/inspect +7 -0
  10. data/lib/muwu/cli/help/new +8 -0
  11. data/lib/muwu/cli/help/reset +14 -0
  12. data/lib/muwu/cli/help/summary +14 -0
  13. data/lib/muwu/controller/controller.rb +120 -0
  14. data/lib/muwu/controller/controller_interaction.rb +146 -0
  15. data/lib/muwu/default/default.rb +51 -0
  16. data/lib/muwu/destination/destination.rb +212 -0
  17. data/lib/muwu/destination_builder/destination_builder.rb +127 -0
  18. data/lib/muwu/helper/hash_helper.rb +37 -0
  19. data/lib/muwu/helper/html_href_helper.rb +101 -0
  20. data/lib/muwu/helper/outline_helper.rb +160 -0
  21. data/lib/muwu/helper/regexp_lib.rb +101 -0
  22. data/lib/muwu/helper/sanitizer_helper.rb +50 -0
  23. data/lib/muwu/manifest/manifest.rb +158 -0
  24. data/lib/muwu/manifest_builder/manifest_builder.rb +102 -0
  25. data/lib/muwu/manifest_task/contents.rb +42 -0
  26. data/lib/muwu/manifest_task/document_css.rb +25 -0
  27. data/lib/muwu/manifest_task/document_html.rb +69 -0
  28. data/lib/muwu/manifest_task/document_js.rb +25 -0
  29. data/lib/muwu/manifest_task/metadata.rb +35 -0
  30. data/lib/muwu/manifest_task/navigator.rb +29 -0
  31. data/lib/muwu/manifest_task/subcontents.rb +48 -0
  32. data/lib/muwu/manifest_task/text.rb +51 -0
  33. data/lib/muwu/manifest_task/text_item.rb +124 -0
  34. data/lib/muwu/manifest_task/title.rb +34 -0
  35. data/lib/muwu/manifest_task_builder/contents_builder.rb +88 -0
  36. data/lib/muwu/manifest_task_builder/document_css_builder.rb +63 -0
  37. data/lib/muwu/manifest_task_builder/document_html_builder.rb +210 -0
  38. data/lib/muwu/manifest_task_builder/document_js_builder.rb +69 -0
  39. data/lib/muwu/manifest_task_builder/metadata_builder.rb +118 -0
  40. data/lib/muwu/manifest_task_builder/navigator_builder.rb +78 -0
  41. data/lib/muwu/manifest_task_builder/subcontents_builder.rb +90 -0
  42. data/lib/muwu/manifest_task_builder/text_builder.rb +125 -0
  43. data/lib/muwu/manifest_task_builder/text_item_builder.rb +314 -0
  44. data/lib/muwu/manifest_task_builder/title_builder.rb +122 -0
  45. data/lib/muwu/project/project.rb +430 -0
  46. data/lib/muwu/project_builder/assets/config/css/base/html_elements.scss +138 -0
  47. data/lib/muwu/project_builder/assets/config/css/base/index.scss +11 -0
  48. data/lib/muwu/project_builder/assets/config/css/base/mixin_text_section_heading.scss +23 -0
  49. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_contents.scss +58 -0
  50. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_metadata.scss +17 -0
  51. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_navigator.scss +13 -0
  52. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_subcontents.scss +58 -0
  53. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_text.scss +48 -0
  54. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_title.scss +22 -0
  55. data/lib/muwu/project_builder/assets/config/css/colors/dark.scss +32 -0
  56. data/lib/muwu/project_builder/assets/config/css/colors/index.scss +1 -0
  57. data/lib/muwu/project_builder/assets/config/css/colors/light.scss +34 -0
  58. data/lib/muwu/project_builder/assets/config/css/extensions/index.scss +1 -0
  59. data/lib/muwu/project_builder/assets/config/css/index.scss +19 -0
  60. data/lib/muwu/project_builder/assets/config/css_debugger/debug_section_text.scss +27 -0
  61. data/lib/muwu/project_builder/project_reader.rb +144 -0
  62. data/lib/muwu/project_builder/project_reset_css.rb +95 -0
  63. data/lib/muwu/project_builder/project_starter.rb +27 -0
  64. data/lib/muwu/project_builder/project_validator.rb +157 -0
  65. data/lib/muwu/project_builder/project_writer.rb +127 -0
  66. data/lib/muwu/project_exception/css_manifest_file_not_found.rb +23 -0
  67. data/lib/muwu/project_exception/dry_output_recommended_with_multiple_documents.rb +19 -0
  68. data/lib/muwu/project_exception/metadata_file_not_found.rb +24 -0
  69. data/lib/muwu/project_exception/metadata_value_not_given.rb +42 -0
  70. data/lib/muwu/project_exception/multiple_documents_outlined_with_stdout.rb +18 -0
  71. data/lib/muwu/project_exception/multiple_formats_requested_with_stdout.rb +18 -0
  72. data/lib/muwu/project_exception/navigator_not_recommended_with_stdout.rb +23 -0
  73. data/lib/muwu/project_exception/navigators_will_be_generated_automatically.rb +23 -0
  74. data/lib/muwu/project_exception/option_key_not_understood.rb +23 -0
  75. data/lib/muwu/project_exception/option_not_validatable.rb +23 -0
  76. data/lib/muwu/project_exception/option_value_not_understood.rb +24 -0
  77. data/lib/muwu/project_exception/options_file_not_found.rb +24 -0
  78. data/lib/muwu/project_exception/outline_file_not_found.rb +24 -0
  79. data/lib/muwu/project_exception/outline_step_not_understood.rb +23 -0
  80. data/lib/muwu/project_exception/output_already_open.rb +18 -0
  81. data/lib/muwu/project_exception/output_not_open.rb +18 -0
  82. data/lib/muwu/project_exception/subcontents_will_be_generated_automatically copy.rb +23 -0
  83. data/lib/muwu/project_exception/target_project_folder_already_exists.rb +24 -0
  84. data/lib/muwu/project_exception/text_source_file_not_found.rb +26 -0
  85. data/lib/muwu/project_exception_handler/fatal.rb +39 -0
  86. data/lib/muwu/project_options/project_options.rb +54 -0
  87. data/lib/muwu/project_options_builder/project_option_validator.rb +37 -0
  88. data/lib/muwu/project_options_builder/project_option_validator_key.rb +56 -0
  89. data/lib/muwu/project_options_builder/project_option_validator_value.rb +300 -0
  90. data/lib/muwu/project_options_builder/project_options_reader.rb +80 -0
  91. data/lib/muwu/render_concat/render_concat.rb +80 -0
  92. data/lib/muwu/render_html/render_html.rb +101 -0
  93. data/lib/muwu/render_html/render_markup_to_html.rb +87 -0
  94. data/lib/muwu/render_html_builder/render_css_builder.rb +34 -0
  95. data/lib/muwu/render_html_builder/render_html_builder.rb +34 -0
  96. data/lib/muwu/render_html_builder/render_js_builder.rb +34 -0
  97. data/lib/muwu/render_html_partial/js_library/_init_bare.js +7 -0
  98. data/lib/muwu/render_html_partial/js_library/_zepto.min.js +2 -0
  99. data/lib/muwu/render_html_partial/js_library/init.js +10 -0
  100. data/lib/muwu/render_html_partial/js_library/navigation.js +140 -0
  101. data/lib/muwu/render_html_partial/render_contents.rb +369 -0
  102. data/lib/muwu/render_html_partial/render_document_css.rb +45 -0
  103. data/lib/muwu/render_html_partial/render_document_html.rb +397 -0
  104. data/lib/muwu/render_html_partial/render_document_js.rb +37 -0
  105. data/lib/muwu/render_html_partial/render_js_library.rb +54 -0
  106. data/lib/muwu/render_html_partial/render_metadata.rb +120 -0
  107. data/lib/muwu/render_html_partial/render_navigator.rb +136 -0
  108. data/lib/muwu/render_html_partial/render_subcontents.rb +374 -0
  109. data/lib/muwu/render_html_partial/render_text.rb +74 -0
  110. data/lib/muwu/render_html_partial/render_text_item.rb +230 -0
  111. data/lib/muwu/render_html_partial/render_title.rb +71 -0
  112. data/lib/muwu/render_html_partial_builder/render_contents_builder.rb +100 -0
  113. data/lib/muwu/render_html_partial_builder/render_document_css_builder.rb +46 -0
  114. data/lib/muwu/render_html_partial_builder/render_document_html_builder.rb +211 -0
  115. data/lib/muwu/render_html_partial_builder/render_document_js_builder.rb +52 -0
  116. data/lib/muwu/render_html_partial_builder/render_metadata_builder.rb +47 -0
  117. data/lib/muwu/render_html_partial_builder/render_navigator_builder.rb +74 -0
  118. data/lib/muwu/render_html_partial_builder/render_subcontents_builder.rb +85 -0
  119. data/lib/muwu/render_html_partial_builder/render_text_builder.rb +86 -0
  120. data/lib/muwu/render_html_partial_builder/render_text_item_builder.rb +274 -0
  121. data/lib/muwu/render_html_partial_builder/render_title_builder.rb +47 -0
  122. data/lib/muwu/render_inspector/render_inspector.rb +224 -0
  123. data/lib/muwu/var/deflistdiv.rb +239 -0
  124. data/lib/muwu_loader.rb +35 -0
  125. data/test/what_no_tests.md +5 -0
  126. metadata +251 -0
@@ -0,0 +1,74 @@
1
+ module Muwu
2
+ module RenderHtmlPartial
3
+ class Text
4
+
5
+
6
+ include Muwu
7
+
8
+
9
+ attr_accessor(
10
+ :destination,
11
+ :html_attr_id,
12
+ :project,
13
+ :text_root_name,
14
+ :sections,
15
+ :will_render_end_links,
16
+ :will_render_section_numbers
17
+ )
18
+
19
+
20
+ def render
21
+ @destination.padding_vertical(1) do
22
+ render_tag_div_open
23
+ render_sections
24
+ render_tag_div_close
25
+ end
26
+ end
27
+
28
+
29
+ def render_sections
30
+ @destination.padding_vertical(1) do
31
+ @sections.each do |section|
32
+ section.render
33
+ end
34
+ end
35
+ end
36
+
37
+
38
+ def render_tag_div_close
39
+ write_tag_div_close
40
+ end
41
+
42
+
43
+ def render_tag_div_open
44
+ write_tag_div_open
45
+ end
46
+
47
+
48
+ def write_tag_div_close
49
+ @destination.write_line tag_div_close
50
+ end
51
+
52
+
53
+ def write_tag_div_open
54
+ @destination.write_line tag_div_open
55
+ end
56
+
57
+
58
+
59
+ private
60
+
61
+
62
+ def tag_div_close
63
+ "</div>"
64
+ end
65
+
66
+
67
+ def tag_div_open
68
+ "<div class='text' data-text_root_name='#{@text_root_name}' id='#{@html_attr_id}'>"
69
+ end
70
+
71
+
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,230 @@
1
+ module Muwu
2
+ module RenderHtmlPartial
3
+ class TextItem
4
+
5
+
6
+ include Muwu
7
+
8
+
9
+ require 'commonmarker'
10
+
11
+
12
+ attr_accessor(
13
+ :destination,
14
+ :distinct,
15
+ :does_have_source_text,
16
+ :end_links,
17
+ :heading,
18
+ :heading_origin,
19
+ :html_attr_id,
20
+ :is_parent_heading,
21
+ :markup_renderer,
22
+ :numbering,
23
+ :project,
24
+ :section_depth,
25
+ :section_number_as_attr,
26
+ :section_number_as_text,
27
+ :sections,
28
+ :source_filename_absolute,
29
+ :source_filename_relative,
30
+ :subsections_are_distinct,
31
+ :text_root_name,
32
+ :will_render_section_number
33
+ )
34
+
35
+
36
+ def render
37
+ @destination.padding_vertical(1) do
38
+ write_tag_section_open
39
+ render_section_number
40
+ render_heading
41
+ render_text
42
+ if (@is_parent_heading == true) && (@subsections_are_distinct == true)
43
+ render_end_links
44
+ render_sections
45
+ elsif (@is_parent_heading == true) && (@subsections_are_distinct == false)
46
+ render_sections
47
+ render_end_links
48
+ elsif (@is_parent_heading == false)
49
+ render_end_links
50
+ end
51
+ write_tag_section_close
52
+ end
53
+ end
54
+
55
+
56
+ def render_end_links
57
+ if @end_links && @end_links.any?
58
+ write_tag_nav_open
59
+ @end_links.each_pair do |name, href|
60
+ render_end_link(name, href)
61
+ end
62
+ write_tag_nav_close
63
+ end
64
+ end
65
+
66
+
67
+ def render_end_link(name, href)
68
+ write_tag_nav_a(name, href)
69
+ end
70
+
71
+
72
+ def render_heading
73
+ if heading_origin_is_basename_or_outline
74
+ write_tag_heading
75
+ end
76
+ end
77
+
78
+
79
+ def render_section_number
80
+ if @will_render_section_number
81
+ write_tag_span_section_number
82
+ end
83
+ end
84
+
85
+
86
+ def render_sections
87
+ @destination.padding_vertical(1) do
88
+ @sections.each do |section|
89
+ section.render
90
+ end
91
+ end
92
+ end
93
+
94
+
95
+ def render_text
96
+ if (source_file_exists == true)
97
+ write_text_source_to_html
98
+ end
99
+ end
100
+
101
+
102
+ def write_tag_heading
103
+ @destination.write_line tag_heading
104
+ end
105
+
106
+
107
+ def write_tag_nav_a(name, href)
108
+ @destination.write_line tag_nav_a(name, href)
109
+ end
110
+
111
+
112
+ def write_tag_nav_close
113
+ @destination.write_line tag_nav_close
114
+ end
115
+
116
+
117
+ def write_tag_nav_open
118
+ @destination.write_line tag_nav_end_links_open
119
+ end
120
+
121
+
122
+ def write_tag_section_open
123
+ @destination.write_line tag_section_open
124
+ end
125
+
126
+
127
+ def write_tag_section_close
128
+ @destination.write_line tag_section_close
129
+ end
130
+
131
+
132
+ def write_tag_span_section_number
133
+ @destination.write_line tag_span_section_number
134
+ end
135
+
136
+
137
+ def write_text_file_missing
138
+ @destination.write_line tag_div_file_missing
139
+ end
140
+
141
+
142
+ def write_text_source_to_html
143
+ @destination.write_inline source_to_html
144
+ end
145
+
146
+
147
+
148
+ private
149
+
150
+
151
+ def heading_origin_is_basename_or_outline
152
+ [:basename, :outline].include?(@heading_origin)
153
+ end
154
+
155
+
156
+ def source_file_exists
157
+ if @source_filename_absolute
158
+ File.exists?(@source_filename_absolute)
159
+ end
160
+ end
161
+
162
+
163
+ def source_to_html
164
+ @markup_renderer.render(@source_filename_absolute)
165
+ end
166
+
167
+
168
+ def tag_nav_a(name, href)
169
+ "<a class='document_link' href='#{href}'>[#{name}]</a>"
170
+ end
171
+
172
+
173
+ def tag_nav_close
174
+ "</nav>"
175
+ end
176
+
177
+
178
+ def tag_nav_open
179
+ "<nav>"
180
+ end
181
+
182
+
183
+ def tag_nav_end_links_open
184
+ "<nav class='document_links'>"
185
+ end
186
+
187
+
188
+ def tag_div_file_missing
189
+ "<div class='compiler_warning file_missing'>#{@source_filename_relative}</div>"
190
+ end
191
+
192
+
193
+ def tag_heading
194
+ "<h1>#{@heading}</h1>"
195
+ end
196
+
197
+
198
+ def tag_section_close
199
+ "</section>"
200
+ end
201
+
202
+
203
+ def tag_section_open
204
+ "<section data-section_depth='#{@section_depth}' data-section_number='#{@section_number_as_text}' data-source='#{@source_filename_relative}' id='#{@html_attr_id}'>"
205
+ end
206
+
207
+
208
+ def tag_section_with_source_open
209
+ "<section data-section_depth='#{@section_depth}' data-section_number='#{@section_number_as_text}' data-source='#{@source_filename_relative}' id='#{@html_attr_id}'>"
210
+ end
211
+
212
+
213
+ def tag_section_without_source_open
214
+ "<section data-section_depth='#{@section_depth}' data-section_number='#{@section_number_as_text}' id='#{@html_attr_id}'>"
215
+ end
216
+
217
+
218
+ def tag_span_file_missing
219
+ "<span class='compiler_warning file_missing'>#{@source_filename_relative}</span>"
220
+ end
221
+
222
+
223
+ def tag_span_section_number
224
+ "<span class='section_number'>#{@section_number_as_text}</span>"
225
+ end
226
+
227
+
228
+ end
229
+ end
230
+ end
@@ -0,0 +1,71 @@
1
+ module Muwu
2
+ module RenderHtmlPartial
3
+ class Title
4
+
5
+
6
+ include Muwu
7
+
8
+
9
+ attr_accessor(
10
+ :destination,
11
+ :metadata
12
+ )
13
+
14
+
15
+ def render
16
+ @destination.margin_to_zero
17
+ @destination.padding_vertical(1) do
18
+ write_tag_div_open
19
+ render_title_metadata
20
+ write_tag_div_close
21
+ end
22
+ @destination.margin_to_zero
23
+ end
24
+
25
+
26
+ def render_title_metadata
27
+ @destination.margin_indent do
28
+ @metadata.each_pair do |key, value|
29
+ write_tag_h1(key, value)
30
+ end
31
+ end
32
+ end
33
+
34
+
35
+ def write_tag_div_close
36
+ @destination.write_line tag_div_close
37
+ end
38
+
39
+
40
+ def write_tag_div_open
41
+ @destination.write_line tag_div_open
42
+ end
43
+
44
+
45
+ def write_tag_h1(key, value)
46
+ @destination.write_line tag_h1(key, value)
47
+ end
48
+
49
+
50
+
51
+ private
52
+
53
+
54
+ def tag_h1(key, value)
55
+ "<h1 data-metadata_key='#{key.downcase}'>#{value}</h1>"
56
+ end
57
+
58
+
59
+ def tag_div_close
60
+ "</div>"
61
+ end
62
+
63
+
64
+ def tag_div_open
65
+ "<div class='title'>"
66
+ end
67
+
68
+
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,100 @@
1
+ module Muwu
2
+ module RenderHtmlPartialBuilder
3
+ class ContentsBuilder
4
+
5
+
6
+ include Muwu
7
+
8
+
9
+ attr_accessor(
10
+ :task_contents,
11
+ :project,
12
+ :renderer,
13
+ :text_root_name
14
+ )
15
+
16
+
17
+ def self.build
18
+ builder = new
19
+ yield(builder)
20
+ builder.renderer
21
+ end
22
+
23
+
24
+ def initialize
25
+ @renderer = RenderHtmlPartial::Contents.new
26
+ end
27
+
28
+
29
+ def build_from_manifest_task_contents(task_contents)
30
+ @project = task_contents.project
31
+ @task_contents = task_contents
32
+ @text_root_name = task_contents.text_root_name
33
+ phase_1_set_text_root_name
34
+ phase_2_set_destination
35
+ phase_2_set_href_helper
36
+ phase_2_set_html_attr_id
37
+ phase_2_set_item_depth_max
38
+ phase_2_set_project
39
+ phase_2_set_sections
40
+ phase_2_set_will_render_section_numbers
41
+ end
42
+
43
+
44
+ def phase_1_set_text_root_name
45
+ @renderer.text_root_name = @text_root_name
46
+ end
47
+
48
+
49
+ def phase_2_set_destination
50
+ @renderer.destination = @task_contents.destination
51
+ end
52
+
53
+
54
+ def phase_2_set_href_helper
55
+ @renderer.href_helper = Helper::HtmlHrefHelper.new(@task_contents)
56
+ end
57
+
58
+
59
+ def phase_2_set_html_attr_id
60
+ @renderer.html_attr_id = ['contents', @text_root_name].join('_')
61
+ end
62
+
63
+
64
+ def phase_2_set_item_depth_max
65
+ @renderer.item_depth_max = @project.options.render_sections_distinctly_depth_max
66
+ end
67
+
68
+
69
+ def phase_2_set_project
70
+ @renderer.project = @project
71
+ end
72
+
73
+
74
+ def phase_2_set_sections
75
+ @renderer.sections = determine_sections
76
+ end
77
+
78
+
79
+ def phase_2_set_will_render_section_numbers
80
+ @renderer.will_render_section_numbers = @project.options.render_section_numbers
81
+ end
82
+
83
+
84
+
85
+ private
86
+
87
+
88
+ def determine_sections
89
+ determine_text_root_blocks.map { |trb| trb.sections }.flatten
90
+ end
91
+
92
+
93
+ def determine_text_root_blocks
94
+ @task_contents.text_blocks_by_name(@text_root_name)
95
+ end
96
+
97
+
98
+ end
99
+ end
100
+ end