module ArticleJSON::Export::Common::HTML::Elements::List

Public Instance Methods

export() click to toggle source

Generate the list node with its elements @return [Nokogiri::XML::NodeSet]

# File lib/article_json/export/common/html/elements/list.rb, line 9
def export
  create_element(tag_name) do |list|
    @element.content.each do |child_element|
      list_item_wrapper = create_element(:li) do |item|
        item.add_child(paragraph_exporter.new(child_element).export)
      end
      list.add_child(list_item_wrapper)
    end
  end
end

Private Instance Methods

paragraph_exporter() click to toggle source

Get the exporter class for paragraph elements @return [ArticleJSON::Export::Common::HTML::Elements::Base]

# File lib/article_json/export/common/html/elements/list.rb, line 28
def paragraph_exporter
  self.class.exporter_by_type(:paragraph)
end
tag_name() click to toggle source
# File lib/article_json/export/common/html/elements/list.rb, line 22
def tag_name
  @element.list_type == :ordered ? :ol : :ul
end