lib/gretel/renderer.rb
# Renders the links into breadcrumbs.
Renders the links into breadcrumbs.
Renders the links into breadcrumbs .
def render
        return "" if links.empty?
        renderer_class = options[:semantic] ? SemanticRenderer : NonSemanticRenderer
        renderer = renderer_class.new(context, options)
        fragments = links[0..-2].map.with_index do |link, index|
          renderer.render_fragment(link, index + 1)
        end
        current_link = links.last
        position = links.size
        fragments << renderer.render_current_fragment(current_link, position)
        html_fragments = [
          renderer.render_pretext,
          fragments.join(options[:separator]),
          renderer.render_posttext
        ]
        html = html_fragments.compact.join(" ").html_safe
        renderer.render_container(html)
      end
def render return "" if links . empty? renderer_class = options [ :semantic ] ? SemanticRenderer : NonSemanticRenderer renderer = renderer_class . new ( context , options ) fragments = links [ 0 .. - 2 ] . map . with_index do | link , index | renderer . render_fragment ( link , index + 1 ) end current_link = links . last position = links . size fragments << renderer . render_current_fragment ( current_link , position ) html_fragments = [ renderer . render_pretext , fragments . join ( options [ :separator ] ) , renderer . render_posttext ] html = html_fragments . compact . join ( " " ) . html_safe renderer . render_container ( html ) end
Renders the links into breadcrumbs.
Renders the links into breadcrumbs .
# Loop through all but the last (current) link and build HTML of the fragments # The current link is handled a little differently, and is only linked if specified in the options # Build the final HTML