Sha256: 7b447474264565796b7d0761334fd23b6638d5cf8f646742da8193738a31dc4d

Contents?: true

Size: 1.09 KB

Versions: 23

Compression:

Stored size: 1.09 KB

Contents

require 'rabbit/parser/rd'

module Rabbit
  class ThemeBrowser
    module Ext
      class BlockVerbatim < Parser::RD::Ext::Base
        include Parser::RD::Ext::Image

        def default_ext_block_verbatim(label, source, content, visitor)
          Proc.new do
            visitor.tag("verbatim-block") do
              visitor.insert(content)
            end
          end
        end

        def ext_block_verb_img(label, source, content, visitor)
          return nil unless /^(?:image|img)$/i =~ label
          src, prop = parse_source(source)
          return nil if prop['src'].nil?
          image = make_image(visitor, prop['src'], prop)
          return nil if image.nil?
          Proc.new do
            visitor.tag("image-description") do
              w = image.original_width
              h = image.original_height
              visitor.insert("(#{w}x#{h})")
              visitor.insert("\n")
            end
            visitor.tag("image") do
              visitor.insert(image.pixbuf)
              visitor.insert("\n")
            end
          end
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
rabbit-0.6.4 lib/rabbit/theme-browser/ext/block-verbatim.rb
rabbit-0.6.3 lib/rabbit/theme-browser/ext/block-verbatim.rb
rabbit-0.6.2 lib/rabbit/theme-browser/ext/block-verbatim.rb