muwu 3.2.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.
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} +32 -11
  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 +9 -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 +134 -148
  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 +137 -152
  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 +15 -27
  46. data/lib/muwu/render_html_partial_builder/render_subcontents_builder.rb +3 -15
  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
@@ -10,19 +10,19 @@ module Muwu
10
10
  :href_document_next,
11
11
  :href_document_prev
12
12
  )
13
-
14
-
13
+
14
+
15
15
  def render
16
16
  @destination.margin_to_zero
17
17
  @destination.padding_vertical(1) do
18
- write_tag_div_open
18
+ # write_tag_div_open
19
19
  # render_heading
20
20
  write_tag_nav_open
21
21
  render_prev
22
22
  render_home
23
23
  render_next
24
24
  write_tag_nav_close
25
- write_tag_div_close
25
+ # write_tag_div_close
26
26
  end
27
27
  end
28
28
 
@@ -30,23 +30,23 @@ module Muwu
30
30
  def render_heading
31
31
  write_tag_heading
32
32
  end
33
-
34
-
33
+
34
+
35
35
  def render_prev
36
36
  write_tag_a_prev
37
37
  end
38
-
39
-
38
+
39
+
40
40
  def render_home
41
41
  write_tag_a_home
42
42
  end
43
-
44
-
43
+
44
+
45
45
  def render_next
46
46
  write_tag_a_next
47
47
  end
48
-
49
-
48
+
49
+
50
50
  def write_tag_a_home
51
51
  @destination.write_line tag_a_home
52
52
  end
@@ -60,37 +60,37 @@ module Muwu
60
60
  def write_tag_a_prev
61
61
  @destination.write_line tag_a_prev
62
62
  end
63
-
64
-
63
+
64
+
65
65
  def write_tag_div_close
66
66
  @destination.write_line tag_div_close
67
67
  end
68
-
69
-
68
+
69
+
70
70
  def write_tag_div_open
71
71
  @destination.write_line tag_div_open
72
72
  end
73
-
74
-
73
+
74
+
75
75
  def write_tag_heading
76
76
  @destination.write_line tag_heading
77
77
  end
78
-
79
-
78
+
79
+
80
80
  def write_tag_nav_open
81
81
  @destination.write_line tag_nav_open
82
82
  end
83
-
84
-
83
+
84
+
85
85
  def write_tag_nav_close
86
86
  @destination.write_line tag_nav_close
87
87
  end
88
-
89
-
90
-
88
+
89
+
90
+
91
91
  private
92
-
93
-
92
+
93
+
94
94
  def tag_a_home
95
95
  "<a class='document_link' href='#{@href_document_home}'>[home]</a>"
96
96
  end
@@ -104,33 +104,33 @@ module Muwu
104
104
  def tag_a_prev
105
105
  "<a class='document_link' href='#{@href_document_prev}'>[prev]</a>"
106
106
  end
107
-
108
-
107
+
108
+
109
109
  def tag_div_close
110
110
  "</div>"
111
111
  end
112
-
113
-
112
+
113
+
114
114
  def tag_div_open
115
115
  "<div class='navigator'>"
116
116
  end
117
-
118
-
117
+
118
+
119
119
  def tag_heading
120
120
  "<h1>#{@heading}</h1>"
121
121
  end
122
-
123
-
122
+
123
+
124
124
  def tag_nav_close
125
125
  "</nav>"
126
126
  end
127
-
128
-
127
+
128
+
129
129
  def tag_nav_open
130
- "<nav class='document_links'>"
130
+ "<nav data-document-block='navigator' class='document_links'>"
131
131
  end
132
132
 
133
133
 
134
134
  end
135
135
  end
136
- end
136
+ end
@@ -1,16 +1,14 @@
1
1
  module Muwu
2
2
  module RenderHtmlPartial
3
3
  class Subcontents
4
-
5
-
4
+
5
+
6
6
  include Muwu
7
-
8
-
7
+
8
+
9
9
  attr_accessor(
10
10
  :destination,
11
- :href_helper,
12
11
  :html_attr_id,
13
- :item_depth_max,
14
12
  :project,
15
13
  :sections,
16
14
  :text_root_block,
@@ -18,11 +16,11 @@ module Muwu
18
16
  :text_root_name,
19
17
  :will_render_section_numbers
20
18
  )
21
-
22
-
19
+
20
+
23
21
 
24
22
  public
25
-
23
+
26
24
 
27
25
  def render
28
26
  @destination.margin_to_zero
@@ -30,178 +28,178 @@ module Muwu
30
28
  write_tag_div_open
31
29
  render_project_title
32
30
  @text_root_blocks.each do |text_root_block|
33
- render_contents_element(text_root_block.sections)
31
+ render_contents_element(text_root_block.topics)
34
32
  end
35
33
  write_tag_div_close
36
34
  end
37
35
  @destination.margin_to_zero
38
36
  end
39
37
 
40
-
41
- def render_contents_element(sections)
38
+
39
+ def render_contents_element(topics)
42
40
  @destination.margin_indent do
43
41
  case @will_render_section_numbers
44
42
  when false
45
- render_ol(sections)
43
+ render_ol(topics)
46
44
  when true
47
- render_table(sections)
45
+ render_table(topics)
48
46
  end
49
47
  end
50
48
  end
51
-
52
-
53
- def render_ol(sections)
49
+
50
+
51
+ def render_ol(topics)
54
52
  write_tag_ol_open
55
- @destination.margin_indent do
56
- sections.each do |section|
57
- render_ol_li(section)
53
+ @destination.margin_indent do
54
+ topics.each do |topic|
55
+ render_ol_li(topic)
58
56
  end
59
57
  end
60
58
  write_tag_ol_close
61
59
  end
62
-
63
-
64
- def render_ol_li(section)
65
- if task_depth_is_within_range(section)
66
- case section
67
- when ManifestTask::TextReadfile
68
- write_tag_li_open
69
- render_ol_li_heading(section)
70
- write_tag_li_close_inline
71
- when ManifestTask::TextGroup
72
- write_tag_li_open
73
- @destination.margin_indent do
74
- render_ol_li_heading_and_text_item(section)
60
+
61
+
62
+ def render_ol_li(topic)
63
+ if topic.is_distinct
64
+ html_id = Helper::HrefHelper.id_subcontents_item(topic)
65
+ if topic.is_parent_heading
66
+ write_tag_li_open(html_id)
67
+ @destination.margin_indent do
68
+ render_ol_li_heading_and_topics(topic)
75
69
  end
76
70
  write_tag_li_close_outline
71
+ elsif topic.is_not_parent_heading
72
+ write_tag_li_open(html_id)
73
+ render_ol_li_heading(topic)
74
+ write_tag_li_close_inline
77
75
  end
78
76
  end
79
77
  end
80
-
81
-
82
- def render_ol_li_heading(text_item)
83
- render_tag_a_section_heading(text_item)
78
+
79
+
80
+ def render_ol_li_heading(topic)
81
+ render_tag_a_section_heading(topic)
84
82
  end
85
-
86
-
87
- def render_ol_li_heading_and_text_item(text_item)
88
- render_tag_a_section_heading(text_item, trailing_line_feed: true)
89
- render_ol(text_item.sections)
83
+
84
+
85
+ def render_ol_li_heading_and_topics(topic)
86
+ render_tag_a_section_heading(topic, trailing_line_feed: true)
87
+ render_ol(topic.subtopics)
90
88
  end
91
-
92
-
89
+
90
+
93
91
  def render_project_title
94
92
  write_tag_h1_title
95
93
  end
96
94
 
97
95
 
98
- def render_table(sections)
96
+ def render_table(topics)
99
97
  write_tag_table_open
100
- @destination.margin_indent do
101
- sections.each do |section|
102
- render_table_tr(section)
98
+ @destination.margin_indent do
99
+ topics.each do |topic|
100
+ render_table_tr(topic)
103
101
  end
104
102
  end
105
103
  write_tag_table_close
106
104
  end
107
105
 
108
106
 
109
- def render_table_tr(section)
110
- if task_depth_is_within_range(section)
111
- html_id = ['subcontents', @text_root_name, section.numbering.join('_')].join('_')
107
+ def render_table_tr(topic)
108
+ if topic.is_distinct
109
+ html_id = Helper::HrefHelper.id_subcontents_item(topic)
112
110
  write_tag_tr_open(html_id)
113
- @destination.margin_indent do
114
- if section.is_parent_heading
115
- render_table_tr_td_number(section)
116
- render_table_tr_td_heading_and_text_item(section)
117
- elsif section.is_not_parent_heading
118
- render_table_tr_td_number(section)
119
- render_table_tr_td_heading(section)
111
+ @destination.margin_indent do
112
+ if topic.is_parent_heading
113
+ render_table_tr_td_number(topic)
114
+ render_table_tr_td_heading_and_topic(topic)
115
+ elsif topic.is_not_parent_heading
116
+ render_table_tr_td_number(topic)
117
+ render_table_tr_td_heading(topic)
120
118
  end
121
119
  end
122
120
  write_tag_tr_close
123
121
  end
124
122
  end
125
-
126
123
 
127
- def render_table_tr_td_heading(text_item)
128
- write_tag_td_open(attr_list: "class='heading'")
129
- render_tag_a_section_heading(text_item)
124
+
125
+ def render_table_tr_td_heading(topic)
126
+ write_tag_td_open(attr_list: "data-subcontents='table-topic'")
127
+ render_tag_a_section_heading(topic)
130
128
  write_tag_td_close_inline
131
129
  end
132
-
133
130
 
134
- def render_table_tr_td_heading_and_text_item(text_item)
135
- write_tag_td_open(attr_list: "class='heading'")
136
- render_tag_a_section_heading(text_item, trailing_line_feed: true)
131
+
132
+ def render_table_tr_td_heading_and_topic(topic)
133
+ write_tag_td_open(attr_list: "data-subcontents='table-topic'")
134
+ render_tag_a_section_heading(topic, trailing_line_feed: true)
137
135
  @destination.margin_indent do
138
- render_table(text_item.sections)
136
+ render_table(topic.subtopics)
139
137
  end
140
138
  write_tag_td_close_outline
141
139
  end
142
140
 
143
141
 
144
- def render_table_tr_td_number(text_item)
145
- write_tag_td_open(attr_list: "class='number'")
146
- render_tag_a_section_number(text_item, attr_list: "tabindex='-1'")
142
+ def render_table_tr_td_number(topic)
143
+ write_tag_td_open(attr_list: "data-subcontents='table-number'")
144
+ render_tag_a_section_number(topic, attr_list: "tabindex='-1'")
147
145
  write_tag_td_close_inline
148
146
  end
149
-
150
147
 
151
- def render_tag_a_section_heading(text_item, trailing_line_feed: false)
152
- href = @href_helper.to_text_item(text_item)
148
+
149
+ def render_tag_a_section_heading(topic, trailing_line_feed: false)
150
+ href = Helper::HrefHelper.link_to_topic_header(topic, from: :subcontents)
153
151
  write_tag_a_open(href)
154
- write_text_section_heading(text_item)
152
+ write_text_section_heading(topic)
155
153
  write_tag_a_close
156
154
  if trailing_line_feed
157
155
  write_lf
158
156
  end
159
157
  end
160
-
161
158
 
162
- def render_tag_a_section_number(text_object, attr_list: nil)
163
- href = @href_helper.to_text_item(text_object)
159
+
160
+ def render_tag_a_section_number(topic, attr_list: nil)
161
+ href = Helper::HrefHelper.link_to_topic_header(topic, from: :subcontents)
164
162
  write_tag_a_open(href, attr_list: attr_list)
165
- write_text_section_number(text_object)
163
+ write_text_section_number(topic)
166
164
  write_tag_a_close
167
165
  end
168
-
169
-
166
+
167
+
170
168
  def write_lf
171
169
  @destination.write_lf
172
170
  end
173
-
174
-
171
+
172
+
175
173
  def write_tag_a_close
176
174
  @destination.write_inline tag_a_close
177
175
  end
178
-
179
-
180
- def write_tag_a_open(href_id, attr_list: nil)
181
- @destination.write_inline tag_a_open(href_id, attr_list: attr_list)
176
+
177
+
178
+ def write_tag_a_open(href, attr_list: nil)
179
+ @destination.write_inline tag_a_open(href, attr_list: attr_list)
182
180
  end
183
-
184
-
181
+
182
+
185
183
  def write_tag_div_close
186
184
  @destination.write_line tag_div_close
187
185
  end
188
-
189
-
186
+
187
+
190
188
  def write_tag_div_open
191
189
  @destination.write_line tag_div_open
192
190
  end
193
-
194
-
191
+
192
+
195
193
  def write_tag_h1_title
196
194
  @destination.write_line tag_h1_title
197
195
  end
198
-
199
-
196
+
197
+
200
198
  def write_tag_li_close
201
199
  write_tag_li_close_outline
202
200
  end
203
-
204
-
201
+
202
+
205
203
  def write_tag_li_close_inline
206
204
  @destination.write_inline_end tag_li_close
207
205
  end
@@ -210,28 +208,28 @@ module Muwu
210
208
  def write_tag_li_close_outline
211
209
  @destination.write_line tag_li_close
212
210
  end
213
-
214
-
215
- def write_tag_li_open
216
- @destination.write_inline_indented tag_li_open
211
+
212
+
213
+ def write_tag_li_open(html_id)
214
+ @destination.write_inline_indented tag_li_open(html_id)
217
215
  end
218
-
219
-
216
+
217
+
220
218
  def write_tag_ol_close
221
219
  @destination.write_line tag_ol_close
222
220
  end
223
-
224
-
221
+
222
+
225
223
  def write_tag_ol_open
226
224
  @destination.write_line tag_ol_open
227
225
  end
228
-
229
-
226
+
227
+
230
228
  def write_tag_table_close
231
229
  @destination.write_line tag_table_close
232
230
  end
233
-
234
-
231
+
232
+
235
233
  def write_tag_table_open
236
234
  @destination.write_line tag_table_open
237
235
  end
@@ -240,17 +238,17 @@ module Muwu
240
238
  def write_tag_td_close
241
239
  write_tag_td_close_outline
242
240
  end
243
-
241
+
244
242
 
245
243
  def write_tag_td_close_inline
246
244
  @destination.write_inline_end tag_td_close
247
245
  end
248
-
246
+
249
247
 
250
248
  def write_tag_td_close_outline
251
249
  @destination.write_line tag_td_close
252
250
  end
253
-
251
+
254
252
 
255
253
  def write_tag_td_open(attr_list: nil)
256
254
  @destination.write_inline_indented tag_td_open(attr_list: attr_list)
@@ -260,59 +258,59 @@ module Muwu
260
258
  def write_tag_tr_close
261
259
  @destination.write_line tag_tr_close
262
260
  end
263
-
264
-
261
+
262
+
265
263
  def write_tag_tr_open(html_id)
266
264
  @destination.write_line tag_tr_open(html_id)
267
265
  end
268
-
269
-
270
- def write_text_section_heading(text_item)
271
- @destination.write_inline text_item.heading
266
+
267
+
268
+ def write_text_section_heading(topic)
269
+ @destination.write_inline topic.heading
272
270
  end
273
-
274
-
275
- def write_text_section_number(text_item)
276
- @destination.write_inline text_item.numbering.join('.')
271
+
272
+
273
+ def write_text_section_number(topic)
274
+ @destination.write_inline topic.numbering.join('.')
277
275
  end
278
-
276
+
279
277
 
280
278
 
281
279
  private
282
-
283
-
280
+
281
+
284
282
  def tag_a_close
285
283
  "</a>"
286
284
  end
287
-
288
-
285
+
286
+
289
287
  def tag_a_open(href_id, attr_list: nil)
290
288
  ["<a", "class='document_link'", "href='#{href_id}'", attr_list].compact.join(' ').concat('>')
291
289
  end
292
-
293
-
290
+
291
+
294
292
  def tag_div_close
295
293
  "</div>"
296
294
  end
297
295
 
298
296
 
299
297
  def tag_div_open
300
- "<div class='subcontents' data-text_root_name='#{@text_root_name}' id='#{@html_attr_id}'>"
298
+ "<div data-document-block='subcontents' data-text_root_name='#{@text_root_name}' id='#{@html_attr_id}'>"
301
299
  end
302
300
 
303
301
 
304
302
  def tag_h1_title
305
- "<h1>#{@project.title}</h1>"
303
+ "<h1 data-subcontents='heading'>#{@project.title}</h1>"
306
304
  end
307
-
305
+
308
306
 
309
307
  def tag_li_close
310
308
  "</li>"
311
309
  end
312
310
 
313
311
 
314
- def tag_li_open
315
- "<li>"
312
+ def tag_li_open(html_id)
313
+ "<li data-subcontents='list-topic' id='#{html_id}'>"
316
314
  end
317
315
 
318
316
 
@@ -322,7 +320,7 @@ module Muwu
322
320
 
323
321
 
324
322
  def tag_ol_open
325
- "<ol>"
323
+ "<ol data-subcontents='list'>"
326
324
  end
327
325
 
328
326
 
@@ -332,10 +330,10 @@ module Muwu
332
330
 
333
331
 
334
332
  def tag_table_open
335
- "<table class='document_links'>"
333
+ "<table data-subcontents='table'>"
336
334
  end
337
-
338
-
335
+
336
+
339
337
  def tag_td_close
340
338
  "</td>"
341
339
  end
@@ -354,21 +352,8 @@ module Muwu
354
352
  def tag_tr_open(html_id)
355
353
  "<tr id='#{html_id}'>"
356
354
  end
357
-
358
-
359
- def task_depth_is_within_range(text_item)
360
- result = nil
361
- if @item_depth_max == nil
362
- result = true
363
- elsif text_item.section_depth <= @item_depth_max
364
- result = true
365
- elsif text_item.section_depth > @item_depth_max
366
- result = false
367
- end
368
- result
369
- end
370
-
371
-
355
+
356
+
372
357
  end
373
358
  end
374
359
  end
@@ -4,32 +4,32 @@ module Muwu
4
4
 
5
5
 
6
6
  include Muwu
7
-
8
-
7
+
8
+
9
9
  attr_accessor(
10
- :destination,
10
+ :destination,
11
11
  :html_attr_id,
12
12
  :project,
13
13
  :text_root_name,
14
- :sections,
14
+ :topics,
15
15
  :will_render_end_links,
16
16
  :will_render_section_numbers
17
17
  )
18
-
18
+
19
19
 
20
20
  def render
21
21
  @destination.padding_vertical(1) do
22
22
  render_tag_div_open
23
- render_sections
23
+ render_topics
24
24
  render_tag_div_close
25
25
  end
26
26
  end
27
27
 
28
28
 
29
- def render_sections
29
+ def render_topics
30
30
  @destination.padding_vertical(1) do
31
- @sections.each do |section|
32
- section.render
31
+ @topics.each do |topic|
32
+ topic.render
33
33
  end
34
34
  end
35
35
  end
@@ -65,8 +65,8 @@ module Muwu
65
65
 
66
66
 
67
67
  def tag_div_open
68
- "<div class='text' data-text_root_name='#{@text_root_name}' id='#{@html_attr_id}'>"
69
- end
68
+ "<div data-document-block='text' data-text_root_name='#{@text_root_name}' id='#{@html_attr_id}'>"
69
+ end
70
70
 
71
71
 
72
72
  end