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