Sha256: f74c9ca9d70a477061b6b4bb4ef2e7efeae6a9781585a7231a865f6c55d0ca89

Contents?: true

Size: 703 Bytes

Versions: 40

Compression:

Stored size: 703 Bytes

Contents

require 'rabbit/element/container-element'
require 'rabbit/element/block-element'

module Rabbit
  module Element
    class ItemList
      include ContainerElement
      include BlockElement

      def to_html(generator)
        "<ul>\n#{super}\n</ul>"
      end
    end

    class ItemListItem
      include ContainerElement
      include BlockElement

      def to_rd
        prefix = "* "
        indent = " " * prefix.length
        first, *rest = text.split(/\n/)
        rest = rest.collect do |line|
          "#{indent}#{line}"
        end.join("\n")
        "#{prefix}#{first}\n#{rest}".rstrip
      end

      def to_html(generator)
        "<li>\n#{super}\n</li>"
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
rabbit-3.0.3 lib/rabbit/element/item-list.rb
rabbit-3.0.2 lib/rabbit/element/item-list.rb
rabbit-3.0.1 lib/rabbit/element/item-list.rb
rabbit-3.0.0 lib/rabbit/element/item-list.rb
rabbit-2.2.1 lib/rabbit/element/item-list.rb
rabbit-2.2.0 lib/rabbit/element/item-list.rb
rabbit-2.1.9 lib/rabbit/element/item-list.rb
rabbit-2.1.8 lib/rabbit/element/item-list.rb
rabbit-2.1.7 lib/rabbit/element/item-list.rb
rabbit-2.1.6 lib/rabbit/element/item-list.rb
rabbit-2.1.5 lib/rabbit/element/item-list.rb
rabbit-2.1.4 lib/rabbit/element/item-list.rb
rabbit-2.1.3 lib/rabbit/element/item-list.rb
rabbit-2.1.2 lib/rabbit/element/item-list.rb
rabbit-2.1.1 lib/rabbit/element/item-list.rb
rabbit-2.1.0 lib/rabbit/element/item-list.rb
rabbit-2.0.9 lib/rabbit/element/item-list.rb
rabbit-2.0.8 lib/rabbit/element/item-list.rb
rabbit-2.0.7 lib/rabbit/element/item-list.rb
rabbit-2.0.6 lib/rabbit/element/item-list.rb