class Gretel::Renderer::SemanticRenderer

Public Instance Methods

render_container(html) click to toggle source
# File lib/gretel/renderer.rb, line 331
def render_container(html)
  content_tag(options[:container_tag], html, id: options[:id], class: options[:class], itemscope: "", itemtype: "https://schema.org/BreadcrumbList")
end
render_fragment_tag(fragment_tag, text, url, position, options = {}) click to toggle source
# File lib/gretel/renderer.rb, line 314
def render_fragment_tag(fragment_tag, text, url, position, options = {})
  fragment_class = join_classes(options[:fragment_class], options[:class])
  fragment_tag = fragment_tag || 'span'
  text = content_tag(:span, text, itemprop: "name")

  aria_current = options[:aria_current]
  if url.present?
    text = breadcrumb_link_to(text, url, itemprop: "item", "aria-current": aria_current, class: options[:link_class], data: options[:link_data])
    aria_current = nil
  elsif options[:current_link].present?
    text = text + tag(:link, itemprop: "item", href: options[: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: options[:link_data])
end