module Muwu::Helper
Public Instance Methods
to_contents_heading(text_object)
click to toggle source
# File lib/muwu/helper/html_href_helper.rb, line 36 def to_contents_heading(text_object) result = '' case @origin_task when ManifestTask::TextItem filename = target_contents_filename(text_object) anchor_id = attr_id(:contents, text_object) result = filename + anchor_id end result end
to_document_top()
click to toggle source
# File lib/muwu/helper/html_href_helper.rb, line 48 def to_document_top '#top' end
to_project_home()
click to toggle source
# File lib/muwu/helper/html_href_helper.rb, line 53 def to_project_home @project.manifest.find_document_html_by_index(0).destination.output_filename end
to_text_item(text_object)
click to toggle source
# File lib/muwu/helper/html_href_helper.rb, line 24 def to_text_item(text_object) result = '' case @origin_task when ManifestTask::Contents result = target_text_filename(text_object) + attr_id(:text, text_object) when ManifestTask::Subcontents result = attr_id(:text, text_object) end result end
Private Instance Methods
attr_id(target, text_object)
click to toggle source
# File lib/muwu/helper/html_href_helper.rb, line 62 def attr_id(target, text_object) prefix = '#' block_type = target.to_s root_name = target_text_root_name(text_object) section_number = target_section_number_as_attr(text_object) prefix + ([block_type, root_name, section_number].compact.join('_')) end
target_contents_filename(text_object)
click to toggle source
# File lib/muwu/helper/html_href_helper.rb, line 71 def target_contents_filename(text_object) result = '' if @project.has_multiple_html_documents result = File.basename(@project.manifest.contents_block_by_name(text_object.text_root_name).destination.output_filename) end result end
target_section_number_as_attr(text_object)
click to toggle source
# File lib/muwu/helper/html_href_helper.rb, line 94 def target_section_number_as_attr(text_object) text_object.numbering_to_depth_max.join('_') end
target_text_filename(text_object)
click to toggle source
# File lib/muwu/helper/html_href_helper.rb, line 80 def target_text_filename(text_object) result = '' if @project.has_multiple_html_documents result = File.basename(text_object.destination.output_filename) end result end
target_text_root_name(text_object)
click to toggle source
# File lib/muwu/helper/html_href_helper.rb, line 89 def target_text_root_name(text_object) text_object.text_root_name end