Module: Muwu::Helper::HrefHelper
- Defined in:
- lib/muwu/helper/html_href_helper.rb
Class Method Summary collapse
- .hyphenate(a) ⇒ Object
- .id_contents_item(topic) ⇒ Object
- .id_subcontents_item(topic) ⇒ Object
- .id_topic_header(topic) ⇒ Object
- .link_to_contents_item(topic, from: nil) ⇒ Object
- .link_to_document_top ⇒ Object
- .link_to_project_home(project) ⇒ Object
- .link_to_subcontents_item(topic, from: nil) ⇒ Object
- .link_to_topic_header(topic, from: nil) ⇒ Object
- .target_filename_contents(topic, from: nil) ⇒ Object
- .target_filename_subcontents(topic, from: nil) ⇒ Object
- .target_filename_topic(topic, from: nil) ⇒ Object
Class Method Details
.hyphenate(a) ⇒ Object
52 53 54 |
# File 'lib/muwu/helper/html_href_helper.rb', line 52 def self.hyphenate(a) a.join('-') end |
.id_contents_item(topic) ⇒ Object
9 10 11 |
# File 'lib/muwu/helper/html_href_helper.rb', line 9 def id_contents_item(topic) hyphenate(['contents', topic.text_root_name, topic.id]) end |
.id_subcontents_item(topic) ⇒ Object
14 15 16 |
# File 'lib/muwu/helper/html_href_helper.rb', line 14 def id_subcontents_item(topic) hyphenate(['subcontents', topic.text_root_name, topic.id]) end |
.id_topic_header(topic) ⇒ Object
19 20 21 |
# File 'lib/muwu/helper/html_href_helper.rb', line 19 def id_topic_header(topic) hyphenate(['text', topic.text_root_name, topic.id]) end |
.link_to_contents_item(topic, from: nil) ⇒ Object
24 25 26 |
# File 'lib/muwu/helper/html_href_helper.rb', line 24 def link_to_contents_item(topic, from: nil) target_filename_contents(topic, from: from) + '#' + id_contents_item(topic) end |
.link_to_document_top ⇒ Object
34 35 36 |
# File 'lib/muwu/helper/html_href_helper.rb', line 34 def link_to_document_top '#top' end |
.link_to_project_home(project) ⇒ Object
29 30 31 |
# File 'lib/muwu/helper/html_href_helper.rb', line 29 def link_to_project_home(project) project.manifest.find_document_html_by_index(0).destination.output_filename end |
.link_to_subcontents_item(topic, from: nil) ⇒ Object
39 40 41 |
# File 'lib/muwu/helper/html_href_helper.rb', line 39 def link_to_subcontents_item(topic, from: nil) target_filename_subcontents(topic, from: from) + '#' + id_subcontents_item(topic) end |
.link_to_topic_header(topic, from: nil) ⇒ Object
44 45 46 |
# File 'lib/muwu/helper/html_href_helper.rb', line 44 def link_to_topic_header(topic, from: nil) target_filename_topic(topic, from: from) + '#' + id_topic_header(topic) end |
.target_filename_contents(topic, from: nil) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/muwu/helper/html_href_helper.rb', line 57 def self.target_filename_contents(topic, from: nil) contents_destination_output_filename = topic.project.manifest.contents_block_filename_for(topic.text_root_name) case from when :topic if contents_destination_output_filename == topic.destination.output_filename return '' else return contents_destination_output_filename end else return contents_destination_output_filename end end |
.target_filename_subcontents(topic, from: nil) ⇒ Object
72 73 74 75 76 77 78 79 |
# File 'lib/muwu/helper/html_href_helper.rb', line 72 def self.target_filename_subcontents(topic, from: nil) case from when :topic return '' else return topic.destination.output_filename end end |
.target_filename_topic(topic, from: nil) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/muwu/helper/html_href_helper.rb', line 82 def self.target_filename_topic(topic, from: nil) case from when :contents contents_destination_output_filename = topic.project.manifest.contents_block_filename_for(topic.text_root_name) if contents_destination_output_filename == topic.destination.output_filename return '' else return topic.destination.output_filename end when :subcontents return '' else return topic.destination.output_filename end end |