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