Sha256: 71a213a0093d88e9a6b3bb3b269fbc2ef108ccfe52905ac159b9aeaeef848828

Contents?: true

Size: 1.03 KB

Versions: 40

Compression:

Stored size: 1.03 KB

Contents

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

module Rabbit
  module Element
    class DescriptionList
      include ContainerElement
      include BlockElement

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

    class DescriptionListItem
      include ContainerElement
      include BlockElement

      attr_reader :term, :content

      def initialize(term, content)
        super()
        @term = term
        @content = content
        add_element(@term)
        add_element(@content)
      end
    end

    class DescriptionTerm
      include TextBlockElement

      def to_rd
        ": #{text}"
      end

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

    class DescriptionContent
      include ContainerElement
      include BlockElement

      def text
        super.gsub(/^/, "  ")
      end

      def to_rd
        text.gsub(/^/, " ")
      end

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

Version data entries

40 entries across 40 versions & 1 rubygems

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