Sha256: 3a9c6a47d571ba6cae2e21c83ff15be5459387e74204e98315db74324fb30a5a

Contents?: true

Size: 1.91 KB

Versions: 75

Compression:

Stored size: 1.91 KB

Contents

# -*- coding: utf-8 -*-
#
#--
# Copyright (C) 2009-2016 Thomas Leitner <t_leitner@gmx.at>
#
# This file is part of kramdown which is licensed under the MIT.
#++
#

require 'kramdown/parser'

module Kramdown

  module Parser

    # Used for parsing a document in Markdown format.
    #
    # This parser is based on the kramdown parser and removes the parser methods for the additional
    # non-Markdown features. However, since some things are handled differently by the kramdown
    # parser methods (like deciding when a list item contains just text), this parser differs from
    # real Markdown parsers in some respects.
    #
    # Note, though, that the parser basically fails just one of the Markdown test cases (some others
    # also fail but those failures are negligible).
    class Markdown < Kramdown

      # Array with all the parsing methods that should be removed from the standard kramdown parser.
      EXTENDED = [:codeblock_fenced, :table, :definition_list, :footnote_definition, :abbrev_definition, :block_math,
                  :block_extensions,
                  :footnote_marker, :smart_quotes, :inline_math, :span_extensions, :typographic_syms]

      def initialize(source, options) # :nodoc:
        super
        @block_parsers.delete_if {|i| EXTENDED.include?(i)}
        @span_parsers.delete_if {|i| EXTENDED.include?(i)}
      end

      # :stopdoc:

      BLOCK_BOUNDARY = /#{BLANK_LINE}|#{EOB_MARKER}|\Z/
      LAZY_END = /#{BLANK_LINE}|#{EOB_MARKER}|^#{OPT_SPACE}#{LAZY_END_HTML_STOP}|^#{OPT_SPACE}#{LAZY_END_HTML_START}|\Z/
      CODEBLOCK_MATCH = /(?:#{BLANK_LINE}?(?:#{INDENT}[ \t]*\S.*\n)+)*/
      PARAGRAPH_END = LAZY_END

      IAL_RAND_CHARS = (('a'..'z').to_a + ('0'..'9').to_a)
      IAL_RAND_STRING = (1..20).collect {|a| IAL_RAND_CHARS[rand(IAL_RAND_CHARS.size)]}.join
      LIST_ITEM_IAL = /^\s*(#{IAL_RAND_STRING})?\s*\n/
      IAL_SPAN_START = LIST_ITEM_IAL

      # :startdoc:

    end

  end

end

Version data entries

75 entries across 72 versions & 18 rubygems

Version Path
logstash-output-scalyr-0.1.9 vendor/bundle/jruby/2.5.0/gems/kramdown-1.14.0/lib/kramdown/parser/markdown.rb
logstash-output-scalyr-0.1.8 vendor/bundle/jruby/2.5.0/gems/kramdown-1.14.0/lib/kramdown/parser/markdown.rb
logstash-output-scalyr-0.1.7 vendor/bundle/jruby/2.5.0/gems/kramdown-1.14.0/lib/kramdown/parser/markdown.rb
logstash-output-scalyr-0.1.6 vendor/bundle/jruby/2.5.0/gems/kramdown-1.14.0/lib/kramdown/parser/markdown.rb
logstash-output-newrelic-1.2.0 vendor/bundle/jruby/2.5.0/gems/kramdown-1.14.0/lib/kramdown/parser/markdown.rb
logstash-filter-csharp-0.2.1 vendor/bundle/jruby/2.3.0/gems/kramdown-1.13.2/lib/kramdown/parser/markdown.rb
logstash-filter-csharp-0.2.1 vendor/bundle/jruby/2.5.0/gems/kramdown-1.14.0/lib/kramdown/parser/markdown.rb
logstash-filter-csharp-0.2.0 vendor/bundle/jruby/2.5.0/gems/kramdown-1.14.0/lib/kramdown/parser/markdown.rb
logstash-filter-csharp-0.2.0 vendor/bundle/jruby/2.3.0/gems/kramdown-1.13.2/lib/kramdown/parser/markdown.rb
motion-kramdown-1.16.2 lib/kramdown/parser/markdown.rb
logstash-output-scalyr-0.1.5 vendor/bundle/jruby/2.5.0/gems/kramdown-1.14.0/lib/kramdown/parser/markdown.rb
logstash-output-scalyr-0.1.4 vendor/bundle/jruby/2.5.0/gems/kramdown-1.14.0/lib/kramdown/parser/markdown.rb
logstash-output-scalyr-0.1.3 vendor/bundle/jruby/2.5.0/gems/kramdown-1.14.0/lib/kramdown/parser/markdown.rb
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/kramdown-1.17.0/lib/kramdown/parser/markdown.rb
logstash-output-scalyr-0.1.2 vendor/bundle/jruby/2.5.0/gems/kramdown-1.14.0/lib/kramdown/parser/markdown.rb
logstash-filter-device_detection-1.0.7-java vendor/bundle/jruby/1.9/gems/kramdown-1.14.0/lib/kramdown/parser/markdown.rb
mrcooper-logstash-output-azuresearch-0.2.2 vendor/jruby/2.5.0/gems/kramdown-1.14.0/lib/kramdown/parser/markdown.rb
kramdown-1.17.0 lib/kramdown/parser/markdown.rb
kramdown-1.16.2 lib/kramdown/parser/markdown.rb
kramdown-1.16.1 lib/kramdown/parser/markdown.rb