Class: Muwu::RenderHtmlPartialBuilder::TextItemBuilder
- Inherits:
-
Object
- Object
- Muwu::RenderHtmlPartialBuilder::TextItemBuilder
show all
- Includes:
- Muwu
- Defined in:
- lib/muwu/render_html_partial_builder/render_text_item_builder.rb
Constant Summary
Constants included
from Muwu
GEM_HOME_LIB, GEM_HOME_LIB_MUWU, VERSION
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Muwu
debug, read
Constructor Details
Returns a new instance of TextItemBuilder.
21
22
23
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 21
def initialize
@renderer = RenderHtmlPartial::TextItem.new
end
|
Instance Attribute Details
#renderer ⇒ Object
Returns the value of attribute renderer.
9
10
11
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 9
def renderer
@renderer
end
|
Class Method Details
.build {|builder| ... } ⇒ Object
14
15
16
17
18
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 14
def self.build
builder = new
yield(builder)
builder.renderer
end
|
Instance Method Details
#build_from_manifest_text_item(manifest_text_item) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 26
def build_from_manifest_text_item(manifest_text_item)
@manifest_text_item = manifest_text_item
@project = manifest_text_item.project
@href_helper = Helper::HtmlHrefHelper.new(manifest_text_item)
phase_1_set_destination
phase_1_set_heading
phase_1_set_heading_origin
phase_1_set_numbering
phase_1_set_section_depth
phase_1_set_section_number_as_attr
phase_1_set_section_number_as_text
phase_1_set_does_have_source_text
phase_1_set_is_parent_heading
phase_1_set_text_root_name
phase_1_set_markdown_renderer
phase_2_set_source_filename_absolute
phase_2_set_source_filename_relative
phase_3_set_sections
phase_4_set_end_links
phase_4_set_html_attr_id
phase_4_set_will_render_section_number
phase_4_set_subsections_are_distinct
end
|
#phase_1_set_destination ⇒ Object
52
53
54
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 52
def phase_1_set_destination
@renderer.destination = @manifest_text_item.destination
end
|
#phase_1_set_does_have_source_text ⇒ Object
57
58
59
60
61
62
63
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 57
def phase_1_set_does_have_source_text
if @manifest_text_item.source_file_does_exist
@renderer.does_have_source_text = true
elsif @manifest_text_item.source_file_does_not_exist
@renderer.does_have_source_text = false
end
end
|
#phase_1_set_heading ⇒ Object
66
67
68
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 66
def phase_1_set_heading
@renderer.heading = @manifest_text_item.heading
end
|
#phase_1_set_heading_origin ⇒ Object
71
72
73
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 71
def phase_1_set_heading_origin
@renderer.heading_origin = @manifest_text_item.heading_origin
end
|
#phase_1_set_is_parent_heading ⇒ Object
76
77
78
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 76
def phase_1_set_is_parent_heading
@renderer.is_parent_heading = @manifest_text_item.is_parent_heading
end
|
#phase_1_set_markdown_renderer ⇒ Object
81
82
83
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 81
def phase_1_set_markdown_renderer
@renderer.markup_renderer = Muwu::RenderMarkupToHtml.new(@project)
end
|
#phase_1_set_numbering ⇒ Object
86
87
88
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 86
def phase_1_set_numbering
@renderer.numbering = @manifest_text_item.numbering
end
|
#phase_1_set_options_commonmarker ⇒ Object
91
92
93
94
95
96
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 91
def phase_1_set_options_commonmarker
@renderer.options_commonmarker = []
if @project.options.render_punctuation_smart
@renderer.options_commonmarker.append(:SMART)
end
end
|
#phase_1_set_section_depth ⇒ Object
99
100
101
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 99
def phase_1_set_section_depth
@renderer.section_depth = @manifest_text_item.section_depth
end
|
#phase_1_set_section_number_as_attr ⇒ Object
104
105
106
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 104
def phase_1_set_section_number_as_attr
@renderer.section_number_as_attr = @manifest_text_item.numbering.join('_')
end
|
#phase_1_set_section_number_as_text ⇒ Object
109
110
111
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 109
def phase_1_set_section_number_as_text
@renderer.section_number_as_text = @manifest_text_item.numbering.join('.')
end
|
#phase_1_set_text_root_name ⇒ Object
114
115
116
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 114
def phase_1_set_text_root_name
@renderer.text_root_name = @manifest_text_item.text_root_name
end
|
#phase_2_set_source_filename_absolute ⇒ Object
119
120
121
122
123
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 119
def phase_2_set_source_filename_absolute
if @manifest_text_item.source_file_does_exist
@renderer.source_filename_absolute = @manifest_text_item.source_filename_absolute
end
end
|
#phase_2_set_source_filename_relative ⇒ Object
126
127
128
129
130
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 126
def phase_2_set_source_filename_relative
if @manifest_text_item.source_file_does_exist
@renderer.source_filename_relative = @manifest_text_item.source_filename_relative
end
end
|
#phase_3_set_sections ⇒ Object
133
134
135
136
137
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 133
def phase_3_set_sections
if @manifest_text_item.does_have_child_sections
@renderer.sections = determine_sections
end
end
|
#phase_4_set_end_links ⇒ Object
140
141
142
143
144
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 140
def phase_4_set_end_links
if text_item_should_have_end_links
@renderer.end_links = determine_end_links
end
end
|
#phase_4_set_html_attr_id ⇒ Object
147
148
149
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 147
def phase_4_set_html_attr_id
@renderer.html_attr_id = ['text', @renderer.text_root_name, @renderer.section_number_as_attr].join('_')
end
|
#phase_4_set_subsections_are_distinct ⇒ Object
157
158
159
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 157
def phase_4_set_subsections_are_distinct
@renderer.subsections_are_distinct = determine_whether_subsections_are_distinct
end
|
#phase_4_set_will_render_section_number ⇒ Object
152
153
154
|
# File 'lib/muwu/render_html_partial_builder/render_text_item_builder.rb', line 152
def phase_4_set_will_render_section_number
@renderer.will_render_section_number = determine_whether_text_item_will_render_section_number
end
|