muwu 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
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,138 @@
1
+ //
2
+ // Default HTML rendering inherits pre-determined style settings, which are
3
+ // not always consistent across web browsers. The following CSS declarations
4
+ // let us build up our stylesheet from scratch more predictably.
5
+ //
6
+ // In defense of `content-box`:
7
+ //
8
+ // Many popular style frameworks insist on `padding-box`, representing a
9
+ // print-media mindset. In print, the media is a fixed size, the content is
10
+ // filled from the outside inwards, and the layout editor can make decisions
11
+ // knowing the result. However, the web browser has a variable media size, the
12
+ // content is filled from the inside outwards, and the layout editor is better
13
+ // off making as few assumptions as possible about how a viewer will size the
14
+ // final product. When we superimpose the `padding-box` mindset from print
15
+ // media, the resulting documents are less likely to adapt to the viewport
16
+ // size, and less likely to zoom properly (the padding size would remain
17
+ // proportional, while the content box could shrink). An HTML document with
18
+ // adequately-defined heirarchial organization has no need for `padding-box`
19
+ // sizing, and a layout editor working with a mindset of variable-size media
20
+ // can successfully rely on `content-box` sizing.
21
+ //
22
+
23
+ * {
24
+ box-sizing: content-box;
25
+ line-height: 1.16667;
26
+ margin: 0;
27
+ padding: 0;
28
+ text-indent: 0;
29
+ font-size: 1rem;
30
+ }
31
+
32
+
33
+ html {
34
+ width: 100%;
35
+ }
36
+
37
+ body {
38
+ margin-left: auto;
39
+ margin-right: auto;
40
+ max-width: 50rem;
41
+ }
42
+
43
+ blockquote {
44
+ margin: 1rem 2rem;
45
+ }
46
+
47
+ code {
48
+ font-size: 1rem;
49
+ padding: 0rem 0.15rem;
50
+ }
51
+
52
+ dl {
53
+ margin: 1rem 0;
54
+ div {
55
+ dt {
56
+ display: list-item;
57
+ list-style-type: none;
58
+ font-weight: bold;
59
+ p {
60
+ display: inline;
61
+ }
62
+ }
63
+ dd {
64
+ display: list-item;
65
+ list-style-type: none;
66
+ p {
67
+ display: inline;
68
+ }
69
+ }
70
+ }
71
+ }
72
+
73
+ img {
74
+ display: block;
75
+ margin-left: auto;
76
+ margin-right: auto;
77
+ }
78
+
79
+ h1, h2, h3, h4, h5, h6 {
80
+ font-size: 1.125rem;
81
+ }
82
+
83
+ hr {
84
+ margin: 1rem 0;
85
+ border-width: 0;
86
+ }
87
+
88
+ ol {
89
+ margin: 1rem;
90
+ ol, ul {
91
+ margin: 0rem 1rem;
92
+ }
93
+ }
94
+
95
+ p {
96
+ margin: 1rem 0rem;
97
+ }
98
+
99
+ pre {
100
+ font-size: 0.9rem;
101
+ margin: 1rem 0;
102
+ >code {
103
+ font-size: 0.8rem;
104
+ padding: 0rem 0rem;
105
+ }
106
+ }
107
+
108
+ q {
109
+ quotes: '“' '”';
110
+ }
111
+
112
+ ul {
113
+ margin: 1rem;
114
+ ol, ul {
115
+ margin: 0rem 1rem;
116
+ }
117
+ }
118
+
119
+
120
+
121
+
122
+ @media screen {
123
+ html {
124
+ body {
125
+ padding: 1.5rem;
126
+ }
127
+ }
128
+ }
129
+
130
+ @media print {
131
+ html {
132
+ body {
133
+ ol, ul {
134
+ page-break-inside: avoid;
135
+ }
136
+ }
137
+ }
138
+ }
@@ -0,0 +1,11 @@
1
+ @import 'html_elements';
2
+ @import 'section_muwu_contents';
3
+ @import 'section_muwu_metadata';
4
+ @import 'section_muwu_navigator';
5
+ @import 'section_muwu_text';
6
+ @import 'section_muwu_title';
7
+ @import 'section_muwu_subcontents';
8
+
9
+ // A better approach to CSS would be to assign classes to elements via the
10
+ // html renderer. Until such functionality exists, messy selector chaining
11
+ // is the incumbent design.
@@ -0,0 +1,23 @@
1
+ @mixin text_section_heading($font-size, $margin-bottom) {
2
+ >.section_number {
3
+ font-size: $font-size;
4
+ & + h1:first-of-type,
5
+ & + h2:first-of-type,
6
+ & + h3:first-of-type,
7
+ & + h4:first-of-type,
8
+ & + h5:first-of-type,
9
+ & + h6:first-of-type {
10
+ font-size: $font-size;
11
+ margin-bottom: $margin-bottom;
12
+ }
13
+ }
14
+ >h1:first-child,
15
+ >h2:first-child,
16
+ >h3:first-child,
17
+ >h4:first-child,
18
+ >h5:first-child,
19
+ >h6:first-child {
20
+ font-size: $font-size;
21
+ margin-bottom: $margin-bottom;
22
+ }
23
+ }
@@ -0,0 +1,58 @@
1
+ body >div.contents {
2
+ margin: 4em 0;
3
+ >h1 {
4
+ font-size: 1.25em;
5
+ margin: 0 0 2rem 0;
6
+ text-align: left;
7
+ }
8
+ .compiler_warning {
9
+ background-color: #ffa;
10
+ td {
11
+ a {
12
+ color: #A00;
13
+ }
14
+ }
15
+ }
16
+ >table {
17
+ border-collapse: collapse;
18
+ tr {
19
+ td {
20
+ vertical-align: top;
21
+ padding: 0.3rem 0.4rem;
22
+ table {
23
+ border-collapse: collapse;
24
+ margin-top: 0.2rem;
25
+ margin-bottom: -0.2rem;
26
+ }
27
+ }
28
+ td:first-child {
29
+ padding-left: 0rem;
30
+ }
31
+ td:last-child {
32
+ padding-right: 0rem;
33
+ }
34
+ td.heading {
35
+ text-align: left;
36
+ }
37
+ td.number {
38
+ text-align: right;
39
+ }
40
+ }
41
+ }
42
+ >ol {
43
+ list-style-type: none;
44
+ display: block;
45
+ margin: 0rem;
46
+ li {
47
+ margin: 0.5rem 0rem;
48
+ a {
49
+ display: inline;
50
+ }
51
+ ol {
52
+ list-style-type: none;
53
+ display: block;
54
+ margin: 0rem 1rem;
55
+ }
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,17 @@
1
+ body >div.metadata {
2
+ margin: 4em 0;
3
+ dl {
4
+ div {
5
+ margin: 1rem 0;
6
+ dt {
7
+ font-weight: bold;
8
+ display: block;
9
+ }
10
+ dd {
11
+ display: block;
12
+ }
13
+ }
14
+ }
15
+ }
16
+
17
+
@@ -0,0 +1,13 @@
1
+ body >div.navigator {
2
+ margin: 0.5rem 0;
3
+ nav.document_links {
4
+ width: 100%;
5
+ display: flex;
6
+ justify-content: space-around;
7
+ a.document_link {
8
+ font-size: 0.8rem;
9
+ padding: 0.5rem;
10
+ }
11
+ }
12
+ }
13
+
@@ -0,0 +1,58 @@
1
+ body >div.subcontents {
2
+ margin: 4em 0;
3
+ >h1 {
4
+ font-size: 1.75em;
5
+ margin: 0 0 2rem 0;
6
+ text-align: left;
7
+ }
8
+ .compiler_warning {
9
+ background-color: #ffa;
10
+ td {
11
+ a {
12
+ color: #A00;
13
+ }
14
+ }
15
+ }
16
+ >table {
17
+ border-collapse: collapse;
18
+ tr {
19
+ td {
20
+ vertical-align: top;
21
+ padding: 0.3rem 0.4rem;
22
+ table {
23
+ border-collapse: collapse;
24
+ margin-top: 0.2rem;
25
+ margin-bottom: -0.2rem;
26
+ }
27
+ }
28
+ td:first-child {
29
+ padding-left: 0rem;
30
+ }
31
+ td:last-child {
32
+ padding-right: 0rem;
33
+ }
34
+ td.heading {
35
+ text-align: left;
36
+ }
37
+ td.number {
38
+ text-align: right;
39
+ }
40
+ }
41
+ }
42
+ >ol {
43
+ list-style-type: none;
44
+ display: block;
45
+ margin: 0rem 0.5rem;
46
+ li {
47
+ margin: 0.5rem 0rem;
48
+ a {
49
+ display: inline;
50
+ }
51
+ ol {
52
+ list-style-type: none;
53
+ display: block;
54
+ margin: 0rem 1.5rem;
55
+ }
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,48 @@
1
+ @import 'mixin_text_section_heading';
2
+
3
+ body >div.text {
4
+ margin: 6rem 0rem;
5
+ ol {
6
+ padding-left: 1rem;
7
+ }
8
+ ul {
9
+ padding-left: 1rem;
10
+ }
11
+
12
+ section[data-section_depth] {
13
+ >.section_number {
14
+ font-weight: bold;
15
+ display: block;
16
+ text-decoration: none;
17
+ }
18
+ nav.document_links {
19
+ width: 100%;
20
+ margin: 2rem 0rem 4rem 0rem;
21
+ text-align: right;
22
+ a.document_link {
23
+ font-size: 0.75em;
24
+ margin: 0rem 0.5rem
25
+ }
26
+ }
27
+ }
28
+
29
+ section[data-section_depth='1'] {
30
+ margin: 6rem 0;
31
+ @include text_section_heading(1.5rem, 2rem);
32
+ }
33
+
34
+ section[data-section_depth='2'] {
35
+ margin: 4rem 0;
36
+ @include text_section_heading(1.375rem, 1.5rem);
37
+ }
38
+
39
+ section[data-section_depth='3'] {
40
+ margin: 2rem 0;
41
+ @include text_section_heading(1.25rem, 1.5rem);
42
+ section[data-section_depth] {
43
+ margin: 2rem 0;
44
+ @include text_section_heading(1rem, 1.5rem);
45
+ }
46
+ }
47
+
48
+ }
@@ -0,0 +1,22 @@
1
+ body >div.title {
2
+ margin: 4em 0;
3
+ text-align: left;
4
+ h1 {
5
+ display: block;
6
+ font-weight: bold;
7
+ margin: 0.5rem 0;
8
+ }
9
+ [data-metadata_key='title'] {
10
+ font-size: 2.0em;
11
+ }
12
+ [data-metadata_key='subtitle'] {
13
+ font-size: 1.5em;
14
+ }
15
+ [data-metadata_key='author'] {
16
+ margin: 2rem 0rem;
17
+ font-size: 1.25em;
18
+ }
19
+ h1:first-child {
20
+ margin-top: 0;
21
+ }
22
+ }
@@ -0,0 +1,32 @@
1
+ html {
2
+ color: #fffff8;
3
+ background-color: #101010;
4
+ }
5
+
6
+ div.contents .document_link {
7
+ color: #f8fff0;
8
+ }
9
+ div.navigator .document_link {
10
+ color: #f0f8ff;
11
+ }
12
+ div.subcontents .document_link {
13
+ color: #f8fff0;
14
+ }
15
+ div.text .document_link {
16
+ color: #f8fff0;
17
+ }
18
+
19
+ // a {
20
+ // color: inherit;
21
+ // }
22
+
23
+ img {
24
+ border-width: 0px;
25
+ border-color: #7f7f7f;
26
+ border-style: solid;
27
+ }
28
+
29
+ pre {
30
+ background-color: #000000;
31
+ border: 1px #7f7f7f solid;
32
+ }
@@ -0,0 +1,34 @@
1
+ html {
2
+ background-color: #f4f4f0;
3
+ color: #080808;
4
+ }
5
+
6
+ div.contents .document_link {
7
+ color: #002040;
8
+ }
9
+ div.navigator .document_link {
10
+ color: #204000;
11
+ }
12
+ div.subcontents .document_link {
13
+ color: #002040;
14
+ }
15
+ div.text .document_link {
16
+ color: #002040;
17
+ }
18
+
19
+ // a {
20
+ // color: inherit;
21
+ // }
22
+
23
+ img {
24
+ border-width: 0px;
25
+ border-color: #000000;
26
+ border-style: solid;
27
+ }
28
+
29
+ pre {
30
+ background-color: #fcfcfc;
31
+ border: 1px #e0e0e0 solid;
32
+ }
33
+
34
+