class Gmi2html::Renderer

Attributes

nodes[R]

Public Class Methods

new(nodes) click to toggle source
# File lib/gmi2html/renderer.rb, line 7
def initialize(nodes)
  @nodes = nodes
end

Public Instance Methods

to_html() click to toggle source
# File lib/gmi2html/renderer.rb, line 11
def to_html
  rendered_nodes.compact.join
end

Private Instance Methods

rendered_nodes() click to toggle source
# File lib/gmi2html/renderer.rb, line 17
def rendered_nodes
  nodes.map.with_index do |node, index|
    prev_node = index >= 0 ? nodes[index - 1] : nil
    next_node = nodes[index + 1]

    node_renderer = NodeRenderers::Base.for_gemtext(node)
    node_renderer.render(prev_node, next_node)
  end
end