Class: Gretel::Renderer::SemanticRenderer
- Defined in:
- lib/gretel/renderer.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #render_container(html) ⇒ Object
- #render_fragment_tag(fragment_tag, text, url, position, options = {}) ⇒ Object
Methods inherited from Base
#initialize, #render_current_fragment, #render_fragment, #render_posttext, #render_pretext
Constructor Details
This class inherits a constructor from Gretel::Renderer::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Gretel::Renderer::Base
Instance Method Details
#render_container(html) ⇒ Object
331 332 333 |
# File 'lib/gretel/renderer.rb', line 331 def render_container(html) content_tag([:container_tag], html, id: [:id], class: [:class], itemscope: "", itemtype: "https://schema.org/BreadcrumbList") end |
#render_fragment_tag(fragment_tag, text, url, position, options = {}) ⇒ Object
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'lib/gretel/renderer.rb', line 314 def render_fragment_tag(fragment_tag, text, url, position, = {}) fragment_class = join_classes([:fragment_class], [:class]) fragment_tag = fragment_tag || 'span' text = content_tag(:span, text, itemprop: "name") aria_current = [:aria_current] if url.present? text = (text, url, itemprop: "item", "aria-current": aria_current, class: [:link_class], data: [:link_data]) aria_current = nil elsif [:current_link].present? text = text + tag(:link, itemprop: "item", href: [:current_link]) end text = text + tag(:meta, itemprop: "position", content: "#{position}") content_tag(fragment_tag.to_sym, text, class: fragment_class, itemprop: "itemListElement", itemscope: "", itemtype: "https://schema.org/ListItem", "aria-current": aria_current, data: [:link_data]) end |