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