muwu 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/muwu +5 -0
- data/lib/muwu.rb +38 -0
- data/lib/muwu/cli/cli.rb +143 -0
- data/lib/muwu/cli/cli_help.rb +28 -0
- data/lib/muwu/cli/help/compile +22 -0
- data/lib/muwu/cli/help/concat +8 -0
- data/lib/muwu/cli/help/heading +2 -0
- data/lib/muwu/cli/help/inspect +7 -0
- data/lib/muwu/cli/help/new +8 -0
- data/lib/muwu/cli/help/reset +14 -0
- data/lib/muwu/cli/help/summary +14 -0
- data/lib/muwu/controller/controller.rb +120 -0
- data/lib/muwu/controller/controller_interaction.rb +146 -0
- data/lib/muwu/default/default.rb +51 -0
- data/lib/muwu/destination/destination.rb +212 -0
- data/lib/muwu/destination_builder/destination_builder.rb +127 -0
- data/lib/muwu/helper/hash_helper.rb +37 -0
- data/lib/muwu/helper/html_href_helper.rb +101 -0
- data/lib/muwu/helper/outline_helper.rb +160 -0
- data/lib/muwu/helper/regexp_lib.rb +101 -0
- data/lib/muwu/helper/sanitizer_helper.rb +50 -0
- data/lib/muwu/manifest/manifest.rb +158 -0
- data/lib/muwu/manifest_builder/manifest_builder.rb +102 -0
- data/lib/muwu/manifest_task/contents.rb +42 -0
- data/lib/muwu/manifest_task/document_css.rb +25 -0
- data/lib/muwu/manifest_task/document_html.rb +69 -0
- data/lib/muwu/manifest_task/document_js.rb +25 -0
- data/lib/muwu/manifest_task/metadata.rb +35 -0
- data/lib/muwu/manifest_task/navigator.rb +29 -0
- data/lib/muwu/manifest_task/subcontents.rb +48 -0
- data/lib/muwu/manifest_task/text.rb +51 -0
- data/lib/muwu/manifest_task/text_item.rb +124 -0
- data/lib/muwu/manifest_task/title.rb +34 -0
- data/lib/muwu/manifest_task_builder/contents_builder.rb +88 -0
- data/lib/muwu/manifest_task_builder/document_css_builder.rb +63 -0
- data/lib/muwu/manifest_task_builder/document_html_builder.rb +210 -0
- data/lib/muwu/manifest_task_builder/document_js_builder.rb +69 -0
- data/lib/muwu/manifest_task_builder/metadata_builder.rb +118 -0
- data/lib/muwu/manifest_task_builder/navigator_builder.rb +78 -0
- data/lib/muwu/manifest_task_builder/subcontents_builder.rb +90 -0
- data/lib/muwu/manifest_task_builder/text_builder.rb +125 -0
- data/lib/muwu/manifest_task_builder/text_item_builder.rb +314 -0
- data/lib/muwu/manifest_task_builder/title_builder.rb +122 -0
- data/lib/muwu/project/project.rb +430 -0
- data/lib/muwu/project_builder/assets/config/css/base/html_elements.scss +138 -0
- data/lib/muwu/project_builder/assets/config/css/base/index.scss +11 -0
- data/lib/muwu/project_builder/assets/config/css/base/mixin_text_section_heading.scss +23 -0
- data/lib/muwu/project_builder/assets/config/css/base/section_muwu_contents.scss +58 -0
- data/lib/muwu/project_builder/assets/config/css/base/section_muwu_metadata.scss +17 -0
- data/lib/muwu/project_builder/assets/config/css/base/section_muwu_navigator.scss +13 -0
- data/lib/muwu/project_builder/assets/config/css/base/section_muwu_subcontents.scss +58 -0
- data/lib/muwu/project_builder/assets/config/css/base/section_muwu_text.scss +48 -0
- data/lib/muwu/project_builder/assets/config/css/base/section_muwu_title.scss +22 -0
- data/lib/muwu/project_builder/assets/config/css/colors/dark.scss +32 -0
- data/lib/muwu/project_builder/assets/config/css/colors/index.scss +1 -0
- data/lib/muwu/project_builder/assets/config/css/colors/light.scss +34 -0
- data/lib/muwu/project_builder/assets/config/css/extensions/index.scss +1 -0
- data/lib/muwu/project_builder/assets/config/css/index.scss +19 -0
- data/lib/muwu/project_builder/assets/config/css_debugger/debug_section_text.scss +27 -0
- data/lib/muwu/project_builder/project_reader.rb +144 -0
- data/lib/muwu/project_builder/project_reset_css.rb +95 -0
- data/lib/muwu/project_builder/project_starter.rb +27 -0
- data/lib/muwu/project_builder/project_validator.rb +157 -0
- data/lib/muwu/project_builder/project_writer.rb +127 -0
- data/lib/muwu/project_exception/css_manifest_file_not_found.rb +23 -0
- data/lib/muwu/project_exception/dry_output_recommended_with_multiple_documents.rb +19 -0
- data/lib/muwu/project_exception/metadata_file_not_found.rb +24 -0
- data/lib/muwu/project_exception/metadata_value_not_given.rb +42 -0
- data/lib/muwu/project_exception/multiple_documents_outlined_with_stdout.rb +18 -0
- data/lib/muwu/project_exception/multiple_formats_requested_with_stdout.rb +18 -0
- data/lib/muwu/project_exception/navigator_not_recommended_with_stdout.rb +23 -0
- data/lib/muwu/project_exception/navigators_will_be_generated_automatically.rb +23 -0
- data/lib/muwu/project_exception/option_key_not_understood.rb +23 -0
- data/lib/muwu/project_exception/option_not_validatable.rb +23 -0
- data/lib/muwu/project_exception/option_value_not_understood.rb +24 -0
- data/lib/muwu/project_exception/options_file_not_found.rb +24 -0
- data/lib/muwu/project_exception/outline_file_not_found.rb +24 -0
- data/lib/muwu/project_exception/outline_step_not_understood.rb +23 -0
- data/lib/muwu/project_exception/output_already_open.rb +18 -0
- data/lib/muwu/project_exception/output_not_open.rb +18 -0
- data/lib/muwu/project_exception/subcontents_will_be_generated_automatically copy.rb +23 -0
- data/lib/muwu/project_exception/target_project_folder_already_exists.rb +24 -0
- data/lib/muwu/project_exception/text_source_file_not_found.rb +26 -0
- data/lib/muwu/project_exception_handler/fatal.rb +39 -0
- data/lib/muwu/project_options/project_options.rb +54 -0
- data/lib/muwu/project_options_builder/project_option_validator.rb +37 -0
- data/lib/muwu/project_options_builder/project_option_validator_key.rb +56 -0
- data/lib/muwu/project_options_builder/project_option_validator_value.rb +300 -0
- data/lib/muwu/project_options_builder/project_options_reader.rb +80 -0
- data/lib/muwu/render_concat/render_concat.rb +80 -0
- data/lib/muwu/render_html/render_html.rb +101 -0
- data/lib/muwu/render_html/render_markup_to_html.rb +87 -0
- data/lib/muwu/render_html_builder/render_css_builder.rb +34 -0
- data/lib/muwu/render_html_builder/render_html_builder.rb +34 -0
- data/lib/muwu/render_html_builder/render_js_builder.rb +34 -0
- data/lib/muwu/render_html_partial/js_library/_init_bare.js +7 -0
- data/lib/muwu/render_html_partial/js_library/_zepto.min.js +2 -0
- data/lib/muwu/render_html_partial/js_library/init.js +10 -0
- data/lib/muwu/render_html_partial/js_library/navigation.js +140 -0
- data/lib/muwu/render_html_partial/render_contents.rb +369 -0
- data/lib/muwu/render_html_partial/render_document_css.rb +45 -0
- data/lib/muwu/render_html_partial/render_document_html.rb +397 -0
- data/lib/muwu/render_html_partial/render_document_js.rb +37 -0
- data/lib/muwu/render_html_partial/render_js_library.rb +54 -0
- data/lib/muwu/render_html_partial/render_metadata.rb +120 -0
- data/lib/muwu/render_html_partial/render_navigator.rb +136 -0
- data/lib/muwu/render_html_partial/render_subcontents.rb +374 -0
- data/lib/muwu/render_html_partial/render_text.rb +74 -0
- data/lib/muwu/render_html_partial/render_text_item.rb +230 -0
- data/lib/muwu/render_html_partial/render_title.rb +71 -0
- data/lib/muwu/render_html_partial_builder/render_contents_builder.rb +100 -0
- data/lib/muwu/render_html_partial_builder/render_document_css_builder.rb +46 -0
- data/lib/muwu/render_html_partial_builder/render_document_html_builder.rb +211 -0
- data/lib/muwu/render_html_partial_builder/render_document_js_builder.rb +52 -0
- data/lib/muwu/render_html_partial_builder/render_metadata_builder.rb +47 -0
- data/lib/muwu/render_html_partial_builder/render_navigator_builder.rb +74 -0
- data/lib/muwu/render_html_partial_builder/render_subcontents_builder.rb +85 -0
- data/lib/muwu/render_html_partial_builder/render_text_builder.rb +86 -0
- data/lib/muwu/render_html_partial_builder/render_text_item_builder.rb +274 -0
- data/lib/muwu/render_html_partial_builder/render_title_builder.rb +47 -0
- data/lib/muwu/render_inspector/render_inspector.rb +224 -0
- data/lib/muwu/var/deflistdiv.rb +239 -0
- data/lib/muwu_loader.rb +35 -0
- data/test/what_no_tests.md +5 -0
- metadata +251 -0
@@ -0,0 +1,122 @@
|
|
1
|
+
module Muwu
|
2
|
+
module ManifestTaskBuilders
|
3
|
+
class TitleBuilder
|
4
|
+
|
5
|
+
|
6
|
+
include Muwu
|
7
|
+
include Helper
|
8
|
+
|
9
|
+
|
10
|
+
attr_accessor(
|
11
|
+
:outline_fragment_title,
|
12
|
+
:parent_document,
|
13
|
+
:project,
|
14
|
+
:task
|
15
|
+
)
|
16
|
+
|
17
|
+
|
18
|
+
def self.build
|
19
|
+
builder = new
|
20
|
+
yield(builder)
|
21
|
+
builder.task
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
def initialize
|
26
|
+
@task = ManifestTask::Title.new
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
def build_from_outline(outline_fragment_title, parent_document)
|
31
|
+
@destination = parent_document.destination
|
32
|
+
@outline_fragment_title = outline_fragment_title
|
33
|
+
@parent_document = parent_document
|
34
|
+
@project = parent_document.project
|
35
|
+
phase_1_set_parent
|
36
|
+
phase_1_set_project
|
37
|
+
phase_2_set_destination
|
38
|
+
phase_2_set_metadata
|
39
|
+
phase_3_validate_metadata_values_exist
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
def phase_1_set_parent
|
44
|
+
@task.parent_document = @parent_document
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
def phase_1_set_project
|
49
|
+
@task.project = @project
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
def phase_2_set_destination
|
54
|
+
@task.destination = @destination
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
def phase_2_set_metadata
|
59
|
+
@task.metadata = determine_metadata
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
def phase_3_validate_metadata_values_exist
|
64
|
+
ProjectValidator.new(@project).validate_task_title(@task)
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
|
72
|
+
def determine_metadata
|
73
|
+
case @outline_fragment_title
|
74
|
+
when Hash
|
75
|
+
determine_metadata_selected
|
76
|
+
when String
|
77
|
+
determine_metadata_default
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
def determine_metadata_default
|
83
|
+
metadata = {}
|
84
|
+
@project.options.render_title_section_metadata.each do |key|
|
85
|
+
metadata[key] = @project.metadata[key]
|
86
|
+
end
|
87
|
+
metadata
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
def determine_metadata_selected
|
92
|
+
metadata = {}
|
93
|
+
keys = @outline_fragment_title.flatten[1]
|
94
|
+
keys.each do |key|
|
95
|
+
if key =~ RegexpLib.metadata_key_date_of_this_edition
|
96
|
+
metadata.merge!(determine_metadata_date_of_this_edition(key: key))
|
97
|
+
else
|
98
|
+
metadata.merge!(determine_metadata_selected_and_validate(key))
|
99
|
+
end
|
100
|
+
end
|
101
|
+
metadata
|
102
|
+
end
|
103
|
+
|
104
|
+
|
105
|
+
def determine_metadata_selected_and_validate(key)
|
106
|
+
metadata = @project.metadata.select { |k,v| k.downcase == key.downcase }
|
107
|
+
if metadata.empty?
|
108
|
+
metadata = {key => nil}
|
109
|
+
end
|
110
|
+
metadata
|
111
|
+
end
|
112
|
+
|
113
|
+
|
114
|
+
def determine_metadata_date_of_this_edition(key: 'date of this edition')
|
115
|
+
metadata = {key => @project.metadata["date of this edition"]}
|
116
|
+
metadata
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,430 @@
|
|
1
|
+
module Muwu
|
2
|
+
class Project
|
3
|
+
|
4
|
+
|
5
|
+
include Muwu
|
6
|
+
include Helper
|
7
|
+
|
8
|
+
|
9
|
+
attr_accessor(
|
10
|
+
:exceptions,
|
11
|
+
:instance_date,
|
12
|
+
:javascript_libraries_requested,
|
13
|
+
:manifest,
|
14
|
+
:metadata,
|
15
|
+
:options,
|
16
|
+
:outline,
|
17
|
+
:slug,
|
18
|
+
:working_directory
|
19
|
+
)
|
20
|
+
|
21
|
+
|
22
|
+
def initialize
|
23
|
+
@exceptions = []
|
24
|
+
@instance_date = Time.now.strftime('%Y-%m-%d')
|
25
|
+
@metadata = {}
|
26
|
+
@outline = []
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
def inspect
|
31
|
+
["#{self.to_s}", "{", inspect_instance_variables, "}"].join(' ')
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
def inspect_instance_variables
|
36
|
+
self.instance_variables.map { |v| "#{v}=#<#{instance_variable_get(v).class}>" }.join(", ")
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
public
|
42
|
+
|
43
|
+
|
44
|
+
def css_manifest_file_does_exist
|
45
|
+
File.exists?(css_manifest_filename) == true
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
def css_manifest_filename
|
50
|
+
File.absolute_path(File.join(path_css, 'index.scss'))
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
def css_basename
|
55
|
+
if @options.output_file_css_basename.to_s == ''
|
56
|
+
SanitizerHelper::sanitize_destination_file_basename(slug).downcase
|
57
|
+
else
|
58
|
+
SanitizerHelper::sanitize_destination_file_basename(@options.output_file_css_basename).downcase
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
def default_text_block_name
|
64
|
+
Default::PROJECT_OUTLINE[:default_text_block_name]
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
def does_not_have_crucial_files
|
69
|
+
exceptions_include?(ProjectException::MetadataFileNotFound) &&
|
70
|
+
exceptions_include?(ProjectException::OptionsFileNotFound) &&
|
71
|
+
exceptions_include?(ProjectException::OutlineFileNotFound)
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
def exceptions_add(exception)
|
76
|
+
@exceptions << exception
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
def exceptions_fatal
|
81
|
+
@exceptions.select{ |e| e.type == :fatal }
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
def exceptions_include?(exception)
|
86
|
+
@exceptions.map{ |e| e.class }.include?(exception)
|
87
|
+
end
|
88
|
+
|
89
|
+
|
90
|
+
def has_multiple_html_documents
|
91
|
+
@manifest.documents_html_count > 1
|
92
|
+
end
|
93
|
+
|
94
|
+
|
95
|
+
def html_basename
|
96
|
+
if @options.output_file_html_basename.to_s == ''
|
97
|
+
SanitizerHelper::sanitize_destination_file_basename('index').downcase
|
98
|
+
else
|
99
|
+
SanitizerHelper::sanitize_destination_file_basename(@options.output_file_html_basename).downcase
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
def js_basename
|
105
|
+
if @options.output_file_js_basename.to_s == ''
|
106
|
+
SanitizerHelper::sanitize_destination_file_basename(slug).downcase
|
107
|
+
else
|
108
|
+
SanitizerHelper::sanitize_destination_file_basename(@options.output_file_js_basename).downcase
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
def metadata_file_does_exist
|
114
|
+
File.exists?(metadata_filename) == true
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
def metadata_file_does_not_exist
|
119
|
+
File.exists?(metadata_filename) == false
|
120
|
+
end
|
121
|
+
|
122
|
+
|
123
|
+
def metadata_filename
|
124
|
+
determine_project_asset_filepath(:metadata)
|
125
|
+
end
|
126
|
+
|
127
|
+
|
128
|
+
def options_file_does_exist
|
129
|
+
File.exists?(options_filename) == true
|
130
|
+
end
|
131
|
+
|
132
|
+
|
133
|
+
def options_file_does_not_exist
|
134
|
+
File.exists?(options_filename) == false
|
135
|
+
end
|
136
|
+
|
137
|
+
|
138
|
+
def options_filename
|
139
|
+
determine_project_asset_filepath(:options)
|
140
|
+
end
|
141
|
+
|
142
|
+
|
143
|
+
def outline_file_does_exist
|
144
|
+
File.exists?(outline_filename) == true
|
145
|
+
end
|
146
|
+
|
147
|
+
|
148
|
+
def outline_file_does_not_exist
|
149
|
+
File.exists?(outline_filename) == false
|
150
|
+
end
|
151
|
+
|
152
|
+
|
153
|
+
def outline_filename
|
154
|
+
determine_project_asset_filepath(:outline)
|
155
|
+
end
|
156
|
+
|
157
|
+
|
158
|
+
def outline_has_more_than_one_document
|
159
|
+
outline_length > 1
|
160
|
+
end
|
161
|
+
|
162
|
+
|
163
|
+
def outline_has_only_one_document
|
164
|
+
outline_length == 1
|
165
|
+
end
|
166
|
+
|
167
|
+
|
168
|
+
def outline_length
|
169
|
+
outline.length
|
170
|
+
end
|
171
|
+
|
172
|
+
|
173
|
+
def outline_text_block_names
|
174
|
+
result = []
|
175
|
+
outline_text_blocks.each do |text_block|
|
176
|
+
text_block_name = determine_text_block_name(text_block)
|
177
|
+
if text_block_name == ''
|
178
|
+
result << 'main'
|
179
|
+
else
|
180
|
+
result << text_block_name
|
181
|
+
end
|
182
|
+
end
|
183
|
+
result.uniq
|
184
|
+
end
|
185
|
+
|
186
|
+
|
187
|
+
def outline_text_blocks
|
188
|
+
@outline.flatten.select { |outline_step| (Hash === outline_step) && (RegexpLib.outline_text =~ outline_step.flatten[0]) }
|
189
|
+
end
|
190
|
+
|
191
|
+
|
192
|
+
def outline_text_blocks_named(text_root_name)
|
193
|
+
result = []
|
194
|
+
outline_text_blocks.each do |text_block|
|
195
|
+
text_block_name = determine_text_block_name(text_block)
|
196
|
+
if text_block_name == text_root_name.downcase
|
197
|
+
result.concat(text_block.flatten[1])
|
198
|
+
end
|
199
|
+
end
|
200
|
+
result
|
201
|
+
end
|
202
|
+
|
203
|
+
|
204
|
+
def outline_text_pathnames
|
205
|
+
@options.outline_text_pathnames
|
206
|
+
end
|
207
|
+
|
208
|
+
|
209
|
+
def outline_text_pathnames_are_explicit
|
210
|
+
@options.outline_text_pathnames == 'explicit'
|
211
|
+
end
|
212
|
+
|
213
|
+
|
214
|
+
def outline_text_pathnames_are_flexible
|
215
|
+
@options.outline_text_pathnames == 'flexible'
|
216
|
+
end
|
217
|
+
|
218
|
+
|
219
|
+
def outline_text_pathnames_are_implicit
|
220
|
+
@options.outline_text_pathnames == 'implicit'
|
221
|
+
end
|
222
|
+
|
223
|
+
|
224
|
+
def outlined_documents
|
225
|
+
@outline
|
226
|
+
end
|
227
|
+
|
228
|
+
|
229
|
+
def outlined_documents_by_index
|
230
|
+
result = {}
|
231
|
+
@outline.each_index do |index|
|
232
|
+
result[index] = @outline[index]
|
233
|
+
end
|
234
|
+
result
|
235
|
+
end
|
236
|
+
|
237
|
+
|
238
|
+
def output_destination
|
239
|
+
@options.output_destination
|
240
|
+
end
|
241
|
+
|
242
|
+
|
243
|
+
def output_destination_requests_stdout
|
244
|
+
@options.output_destination == 'stdout'
|
245
|
+
end
|
246
|
+
|
247
|
+
|
248
|
+
def output_formats_several
|
249
|
+
@options.output_formats.length > 1
|
250
|
+
end
|
251
|
+
|
252
|
+
|
253
|
+
def path_config
|
254
|
+
File.absolute_path(File.join(@working_directory, 'config'))
|
255
|
+
end
|
256
|
+
|
257
|
+
|
258
|
+
def path_css
|
259
|
+
File.absolute_path(File.join(path_config, 'css'))
|
260
|
+
end
|
261
|
+
|
262
|
+
|
263
|
+
def path_css_base
|
264
|
+
File.absolute_path(File.join(path_css, 'base'))
|
265
|
+
end
|
266
|
+
|
267
|
+
|
268
|
+
def path_css_colors
|
269
|
+
File.absolute_path(File.join(path_css, 'colors'))
|
270
|
+
end
|
271
|
+
|
272
|
+
|
273
|
+
def path_css_extensions
|
274
|
+
File.absolute_path(File.join(path_css, 'extensions'))
|
275
|
+
end
|
276
|
+
|
277
|
+
|
278
|
+
def path_images
|
279
|
+
File.absolute_path(File.join(@working_directory, 'images'))
|
280
|
+
end
|
281
|
+
|
282
|
+
|
283
|
+
def path_outline
|
284
|
+
@working_directory
|
285
|
+
end
|
286
|
+
|
287
|
+
|
288
|
+
def path_text
|
289
|
+
File.absolute_path(File.join(@working_directory, 'text'))
|
290
|
+
end
|
291
|
+
|
292
|
+
|
293
|
+
def slug
|
294
|
+
if @metadata.has_key?('slug')
|
295
|
+
@metadata['slug']
|
296
|
+
else
|
297
|
+
working_directory_name
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
|
302
|
+
def sort_outline_text_blocks
|
303
|
+
result = []
|
304
|
+
outline_text_blocks.each do |text_block|
|
305
|
+
text_block_name = determine_text_block_name(text_block)
|
306
|
+
text_block_contents = determine_text_block_contents(text_block)
|
307
|
+
existing_block = result.select { |b| b.has_key?(text_block_name) }.flatten
|
308
|
+
if existing_block.empty?
|
309
|
+
result << { text_block_name => text_block_contents }
|
310
|
+
else
|
311
|
+
existing_block[text_block_name].concat(text_block_contents)
|
312
|
+
end
|
313
|
+
end
|
314
|
+
result
|
315
|
+
end
|
316
|
+
|
317
|
+
|
318
|
+
def text_block_naming_is_simple
|
319
|
+
outline_text_block_names == [default_text_block_name]
|
320
|
+
end
|
321
|
+
|
322
|
+
|
323
|
+
def text_block_naming_is_not_simple
|
324
|
+
text_block_naming_is_simple == false
|
325
|
+
end
|
326
|
+
|
327
|
+
|
328
|
+
def title
|
329
|
+
if @metadata.has_key?('title')
|
330
|
+
@metadata['title']
|
331
|
+
else
|
332
|
+
working_directory_name
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
|
337
|
+
def will_create_css_file
|
338
|
+
@options.output_formats.include?('css')
|
339
|
+
end
|
340
|
+
|
341
|
+
|
342
|
+
def will_create_html_file_only
|
343
|
+
@options.output_formats == ['html']
|
344
|
+
end
|
345
|
+
|
346
|
+
|
347
|
+
def will_create_javascript_file
|
348
|
+
if will_require_javascript_libraries
|
349
|
+
@options.output_formats.include?('js')
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
|
354
|
+
def will_require_javascript_libraries
|
355
|
+
@javascript_libraries_requested.count > 0
|
356
|
+
end
|
357
|
+
|
358
|
+
|
359
|
+
def will_embed_at_least_one_asset
|
360
|
+
will_embed_css || will_embed_js
|
361
|
+
end
|
362
|
+
|
363
|
+
|
364
|
+
def will_embed_css
|
365
|
+
will_create_css_file == false
|
366
|
+
end
|
367
|
+
|
368
|
+
|
369
|
+
def will_embed_js
|
370
|
+
will_create_javascript_file == false
|
371
|
+
end
|
372
|
+
|
373
|
+
|
374
|
+
def will_generate_navigators_automatically
|
375
|
+
(outline_has_more_than_one_document) && (@options.generate_navigators_automatically == true) && (@options.output_destination == 'file')
|
376
|
+
end
|
377
|
+
|
378
|
+
|
379
|
+
def will_generate_subcontents_automatically
|
380
|
+
(outline_has_more_than_one_document) && (@options.generate_subcontents_automatically == true)
|
381
|
+
end
|
382
|
+
|
383
|
+
|
384
|
+
def will_render_section_numbers
|
385
|
+
@options.render_section_numbers == true
|
386
|
+
end
|
387
|
+
|
388
|
+
|
389
|
+
def will_not_generate_navigators_automatically
|
390
|
+
not will_generate_navigators_automatically
|
391
|
+
end
|
392
|
+
|
393
|
+
|
394
|
+
def will_not_generate_subcontents_automatically
|
395
|
+
not will_generate_subcontents_automatically
|
396
|
+
end
|
397
|
+
|
398
|
+
|
399
|
+
def working_directory_name
|
400
|
+
@working_directory.split(File::SEPARATOR)[-1]
|
401
|
+
end
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
private
|
406
|
+
|
407
|
+
|
408
|
+
def determine_project_asset_filepath(type)
|
409
|
+
File.absolute_path(File.join(@working_directory, Default::FILEPATHS[type], Default::FILENAMES[type]))
|
410
|
+
end
|
411
|
+
|
412
|
+
|
413
|
+
def determine_text_block_contents(text_block)
|
414
|
+
text_block.flatten[1]
|
415
|
+
end
|
416
|
+
|
417
|
+
|
418
|
+
def determine_text_block_name(text_block)
|
419
|
+
directive = text_block.flatten[0]
|
420
|
+
components = directive.partition(RegexpLib.outline_text_plus_whitespace)
|
421
|
+
text_block_name = components[2].to_s.downcase.strip
|
422
|
+
if text_block_name == ''
|
423
|
+
text_block_name = default_text_block_name
|
424
|
+
end
|
425
|
+
text_block_name
|
426
|
+
end
|
427
|
+
|
428
|
+
|
429
|
+
end
|
430
|
+
end
|