Sha256: c231753b3178f8a147eec4e78d33a6b4cae6deaa26f4b0f6cde67c81e82be817

Contents?: true

Size: 889 Bytes

Versions: 9

Compression:

Stored size: 889 Bytes

Contents

require "hikidoc"

require "rabbit/parser/base"

module Rabbit
  module Parser
    class Wiki < Base
    end
  end
end

require "rabbit/parser/wiki/output"

module Rabbit
  module Parser
    class Wiki
      unshift_loader(self)
      class << self
        def format_name
          "Wiki"
        end

        def match?(source)
          extension = source.extension
          if extension.nil?
            head = source.read[0, 500]
            if head.respond_to?(:force_encoding)
              head.force_encoding("ASCII-8BIT")
            end
            /^!/.match(head)
          else
            /\A(?:hiki|wiki)\z/i =~ extension
          end
        end
      end

      include Element
      def parse
        parser = HikiDoc.new(RabbitOutput.new(@canvas),
                             :use_wiki_name => false)
        parser.compile(@source.read)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rabbit-3.0.3 lib/rabbit/parser/wiki.rb
rabbit-3.0.2 lib/rabbit/parser/wiki.rb
rabbit-3.0.1 lib/rabbit/parser/wiki.rb
rabbit-3.0.0 lib/rabbit/parser/wiki.rb
rabbit-2.2.1 lib/rabbit/parser/wiki.rb
rabbit-2.2.0 lib/rabbit/parser/wiki.rb
rabbit-2.1.9 lib/rabbit/parser/wiki.rb
rabbit-2.1.8 lib/rabbit/parser/wiki.rb
rabbit-2.1.7 lib/rabbit/parser/wiki.rb