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 @@
|
|
1
|
+
// add `@import [filename]` commands below to build your document stylesheet
|
@@ -0,0 +1,19 @@
|
|
1
|
+
// Muwu CSS Manifest
|
2
|
+
// Only modify this file *IF* you know how to change it back.
|
3
|
+
|
4
|
+
|
5
|
+
@import 'base/index';
|
6
|
+
|
7
|
+
|
8
|
+
// The best way to modify the color theme:
|
9
|
+
// 1. Put your files in the `colors` folder
|
10
|
+
// 2. Modify the `@import [filename]` command in `colors/index.scss`
|
11
|
+
@import 'colors/index';
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
// The best way to include your own stylesheets:
|
16
|
+
// 1. Put your stylesheets in the `extensions` folder
|
17
|
+
// 2. Add an `@import [filename]` command in `extension/index.scss`
|
18
|
+
// 3. Remove the `//` comment indicator from the next line
|
19
|
+
// @import 'extensions/index';
|
@@ -0,0 +1,27 @@
|
|
1
|
+
html {
|
2
|
+
body {
|
3
|
+
section.text[data-depth] {
|
4
|
+
>* {
|
5
|
+
border: 1px pink solid;
|
6
|
+
>* {
|
7
|
+
border: 1px blue dotted;
|
8
|
+
>* {
|
9
|
+
border: 1px green dashed;
|
10
|
+
>* {
|
11
|
+
border: 1px orange solid;
|
12
|
+
>* {
|
13
|
+
border: 1px purple dotted;
|
14
|
+
>* {
|
15
|
+
border: 1px brown solid;
|
16
|
+
* {
|
17
|
+
border: none;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,144 @@
|
|
1
|
+
module Muwu
|
2
|
+
class ProjectReader
|
3
|
+
|
4
|
+
|
5
|
+
include Muwu
|
6
|
+
include Helper
|
7
|
+
|
8
|
+
|
9
|
+
require 'yaml'
|
10
|
+
|
11
|
+
|
12
|
+
attr_accessor(
|
13
|
+
:path,
|
14
|
+
:project,
|
15
|
+
:validator
|
16
|
+
)
|
17
|
+
|
18
|
+
|
19
|
+
def self.build
|
20
|
+
builder = new
|
21
|
+
yield(builder)
|
22
|
+
builder.project
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
def initialize
|
27
|
+
@project = Muwu::Project.new
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
def load_path(path)
|
32
|
+
@path = File.absolute_path(path)
|
33
|
+
@validator = ProjectValidator.new(@project)
|
34
|
+
phase_1_set_project_working_directory
|
35
|
+
phase_2_read_metadata
|
36
|
+
phase_2_read_options
|
37
|
+
phase_2_read_outline
|
38
|
+
phase_3_set_javascript_libraries_requested
|
39
|
+
phase_3_set_metadata_instance_date
|
40
|
+
phase_4_validate
|
41
|
+
phase_5_build_manifest
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
def phase_1_set_project_working_directory
|
46
|
+
@project.working_directory = @path
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
def phase_2_read_metadata
|
51
|
+
if @validator.validate_file_metadata
|
52
|
+
@project.metadata = YAML.load_file(@project.metadata_filename)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
def phase_2_read_options
|
58
|
+
@project.options = build_options
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
def phase_2_read_outline
|
63
|
+
if @validator.validate_file_outline
|
64
|
+
@project.outline = build_outline
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
def phase_3_set_javascript_libraries_requested
|
70
|
+
@project.javascript_libraries_requested = determine_javascript_libraries
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
def phase_3_set_metadata_instance_date
|
75
|
+
@project.metadata["date of this edition"] = @project.instance_date
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
def phase_4_validate
|
80
|
+
@validator.validate_file_css
|
81
|
+
@validator.validate_output_destination_and_formats
|
82
|
+
@validator.validate_scenario_if_more_than_one_document
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
def phase_5_build_manifest
|
87
|
+
@project.manifest = build_manifest
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
private
|
93
|
+
|
94
|
+
|
95
|
+
def build_manifest
|
96
|
+
ManifestBuilder.build do |b|
|
97
|
+
b.build_from_project(@project)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
|
102
|
+
def build_options
|
103
|
+
ProjectOptionsReader.build do |b|
|
104
|
+
b.build_from_ymlfile(@project)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
def build_outline
|
110
|
+
outline = YAML.load_stream(File.read(@project.outline_filename))
|
111
|
+
outline.reject!{ |step| NilClass === step }
|
112
|
+
outline.each_with_index do |document, index|
|
113
|
+
if document_outline_does_not_begin_with_known_directive(document)
|
114
|
+
outline[index] = presume_text_block(document)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
outline
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
def determine_javascript_libraries
|
122
|
+
libraries = []
|
123
|
+
if @project.options.html_uses_javascript_navigation
|
124
|
+
libraries << :navigation
|
125
|
+
end
|
126
|
+
if libraries.count > 0
|
127
|
+
libraries.unshift(:init)
|
128
|
+
end
|
129
|
+
libraries
|
130
|
+
end
|
131
|
+
|
132
|
+
|
133
|
+
def document_outline_does_not_begin_with_known_directive(document)
|
134
|
+
OutlineHelper.type_of(document[0]) == nil
|
135
|
+
end
|
136
|
+
|
137
|
+
|
138
|
+
def presume_text_block(document)
|
139
|
+
[{'Text' => document}]
|
140
|
+
end
|
141
|
+
|
142
|
+
|
143
|
+
end
|
144
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
module Muwu
|
2
|
+
class ProjectResetCss
|
3
|
+
|
4
|
+
|
5
|
+
include Muwu
|
6
|
+
|
7
|
+
|
8
|
+
require 'fileutils'
|
9
|
+
|
10
|
+
|
11
|
+
def initialize(project)
|
12
|
+
@project = project
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
public
|
17
|
+
|
18
|
+
|
19
|
+
def reset_css
|
20
|
+
phase_1_verify_or_create_css_folder
|
21
|
+
phase_2_clear_base_folder
|
22
|
+
phase_3_copy_base_css_files
|
23
|
+
phase_4_verify_or_create_colors_folder
|
24
|
+
phase_5_copy_colors_css_files
|
25
|
+
phase_6_copy_index
|
26
|
+
phase_7_verify_or_create_extensions_folder
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
def phase_1_verify_or_create_css_folder
|
31
|
+
if Dir.exists?(@project.path_config) == false
|
32
|
+
puts "Creating folder #{@project.path_config}"
|
33
|
+
FileUtils.mkdir(@project.path_config)
|
34
|
+
end
|
35
|
+
if Dir.exists?(@project.path_css) == false
|
36
|
+
puts "Creating folder #{@project.path_css}"
|
37
|
+
FileUtils.mkdir(@project.path_css)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
def phase_2_clear_base_folder
|
43
|
+
if Dir.exists?(@project.path_css_base) == true
|
44
|
+
puts "Clearing folder #{@project.path_css_base}"
|
45
|
+
FileUtils.remove_dir(@project.path_css_base)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
def phase_3_copy_base_css_files
|
51
|
+
folder_source_gem = File.absolute_path(File.join(Muwu::GEM_HOME_LIB, 'muwu','project_builder','assets','config','css','base'))
|
52
|
+
folder_destination_project = @project.path_css_base
|
53
|
+
puts "Resetting folder #{@project.path_css_base}"
|
54
|
+
FileUtils.cp_r(folder_source_gem, folder_destination_project)
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
def phase_4_verify_or_create_colors_folder
|
59
|
+
if Dir.exists?(@project.path_css_colors) == false
|
60
|
+
puts "Creating folder #{@project.path_css_colors}"
|
61
|
+
FileUtils.mkdir(@project.path_css_colors)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
def phase_5_copy_colors_css_files
|
67
|
+
colors_source_gem = File.absolute_path(File.join(Muwu::GEM_HOME_LIB, 'muwu','project_builder','assets','config','css','colors','.'))
|
68
|
+
colors_destination_project = @project.path_css
|
69
|
+
puts "Resetting file #{File.join(@project.path_css_colors,'dark.scss')}"
|
70
|
+
puts "Resetting file #{File.join(@project.path_css_colors,'dark.scss')}"
|
71
|
+
puts "Resetting file #{File.join(@project.path_css_colors,'dark.scss')}"
|
72
|
+
FileUtils.cp_r(colors_source_gem, colors_destination_project)
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
def phase_6_copy_index
|
77
|
+
index_source_gem = File.absolute_path(File.join(Muwu::GEM_HOME_LIB, 'muwu','project_builder','assets','config','css','index.scss'))
|
78
|
+
index_destination_project = @project.path_css
|
79
|
+
puts "Resetting file #{File.join(@project.path_css, 'index.scss')}"
|
80
|
+
FileUtils.cp_r(index_source_gem, index_destination_project)
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
def phase_7_verify_or_create_extensions_folder
|
85
|
+
if Dir.exists?(@project.path_css_extensions) == false
|
86
|
+
folder_source_gem = File.absolute_path(File.join(Muwu::GEM_HOME_LIB, 'muwu','project_builder','assets','config','css','extensions'))
|
87
|
+
folder_destination_project = @project.path_css_extensions
|
88
|
+
puts "Creating folder #{@project.path_css_extensions}"
|
89
|
+
FileUtils.cp_r(folder_source_gem, folder_destination_project)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Muwu
|
2
|
+
class ProjectStarter
|
3
|
+
|
4
|
+
|
5
|
+
include Muwu
|
6
|
+
|
7
|
+
|
8
|
+
def initialize(current_working_directory, metadata)
|
9
|
+
@current_working_directory = File.absolute_path(current_working_directory)
|
10
|
+
@metadata = metadata
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
public
|
15
|
+
|
16
|
+
|
17
|
+
def new_project
|
18
|
+
project = Project.new
|
19
|
+
project.metadata = @metadata
|
20
|
+
project.options = Default::PROJECT_OPTIONS
|
21
|
+
project.working_directory = File.absolute_path(File.join(@current_working_directory, @metadata[:slug]))
|
22
|
+
project
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
module Muwu
|
2
|
+
class ProjectValidator
|
3
|
+
|
4
|
+
|
5
|
+
include Muwu
|
6
|
+
|
7
|
+
|
8
|
+
def initialize(project)
|
9
|
+
@project = project
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
public
|
15
|
+
|
16
|
+
|
17
|
+
def validate_file_css
|
18
|
+
if @project.css_manifest_file_does_exist
|
19
|
+
return true
|
20
|
+
else
|
21
|
+
@project.exceptions_add ProjectException::CssManifestFileNotFound.new(@project.css_manifest_filename)
|
22
|
+
return false
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
def validate_file_metadata
|
28
|
+
if @project.metadata_file_does_exist
|
29
|
+
return true
|
30
|
+
else
|
31
|
+
@project.exceptions_add ProjectException::MetadataFileNotFound.new(@project)
|
32
|
+
return false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
def validate_file_options
|
38
|
+
if @project.options_file_does_exist
|
39
|
+
return true
|
40
|
+
else
|
41
|
+
@project.exceptions_add ProjectException::OptionsFileNotFound.new(@project)
|
42
|
+
return false
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
def validate_file_outline
|
48
|
+
if @project.outline_file_does_exist
|
49
|
+
return true
|
50
|
+
else
|
51
|
+
@project.exceptions_add ProjectException::OutlineFileNotFound.new(@project)
|
52
|
+
return false
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
def validate_outline_step_navigator(index)
|
58
|
+
validate_outline_step_navigator_if_single_document(index)
|
59
|
+
return validate_outline_step_navigator_if_automatic(index)
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
def validate_outline_step_navigator_if_automatic(index)
|
64
|
+
if @project.will_not_generate_navigators_automatically
|
65
|
+
return true
|
66
|
+
elsif @project.will_generate_navigators_automatically
|
67
|
+
@project.exceptions_add ProjectException::NavigatorsWillBeGeneratedAutomatically.new(index)
|
68
|
+
return false
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
def validate_outline_step_navigator_if_single_document(index)
|
74
|
+
if @project.outline_has_only_one_document
|
75
|
+
@project.exceptions_add ProjectException::NavigatorNotRecommendedWithSingleDocument.new(index)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
def validate_outline_step_subcontents(index)
|
81
|
+
if @project.will_not_generate_subcontents_automatically
|
82
|
+
return true
|
83
|
+
elsif @project.will_generate_subcontents_automatically
|
84
|
+
@project.exceptions_add ProjectException::SubcontentsWillBeGeneratedAutomatically.new(@index)
|
85
|
+
return false
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
|
90
|
+
def validate_output_destination_and_formats
|
91
|
+
if @project.output_destination_requests_stdout && @project.output_formats_several
|
92
|
+
@project.exceptions_add ProjectException::MultipleFormatsRequestedWithStdout.new
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
|
97
|
+
def validate_scenario_if_more_than_one_document
|
98
|
+
if @project.outline_has_more_than_one_document && @project.output_destination_requests_stdout
|
99
|
+
@project.exceptions_add ProjectException::MultipleDocumentsOutlinedWithStdout.new
|
100
|
+
end
|
101
|
+
if @project.outline_has_more_than_one_document && @project.will_embed_at_least_one_asset
|
102
|
+
@project.exceptions_add ProjectException::DryOutputRecommendedWithMultipleDocuments.new
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
|
107
|
+
def validate_task_metadata(task)
|
108
|
+
values_missing = task.metadata.select { |k,v| v.to_s == ''}
|
109
|
+
if values_missing.empty?
|
110
|
+
return true
|
111
|
+
else
|
112
|
+
values_missing.each_pair { |k,v| @project.exceptions_add ProjectException::MetadataValueNotGiven.new(task, k) }
|
113
|
+
return false
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
def validate_task_text_item(task)
|
119
|
+
if task.is_parent_heading
|
120
|
+
return validate_task_text_item_parent_heading(task)
|
121
|
+
elsif task.is_not_parent_heading
|
122
|
+
return validate_task_text_item_child_heading(task)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
|
127
|
+
def validate_task_text_item_child_heading(task)
|
128
|
+
if task.source_file_does_exist
|
129
|
+
return true
|
130
|
+
else
|
131
|
+
@project.exceptions_add ProjectException::TextSourceFileNotFound.new(task)
|
132
|
+
return false
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
|
137
|
+
def validate_task_text_item_parent_heading(task)
|
138
|
+
if task.source_file_does_exist
|
139
|
+
return true
|
140
|
+
else
|
141
|
+
if @project.options.warning_if_parent_heading_lacks_source
|
142
|
+
@project.exceptions_add ProjectException::TextSourceFileNotFound.new(task)
|
143
|
+
return false
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
def validate_task_title(task)
|
151
|
+
return validate_task_metadata(task)
|
152
|
+
end
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
end
|
157
|
+
end
|