Sha256: 3fc8ba88c2d8b279a811807ba6398f5356ba110d0569bc7fe6e08e3d5ad93038

Contents?: true

Size: 852 Bytes

Versions: 7

Compression:

Stored size: 852 Bytes

Contents

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

require 'kramdown/parser/kramdown/extensions'
require 'kramdown/parser/kramdown/blank_line'
require 'kramdown/parser/kramdown/eob'

module Kramdown
  module Parser
    class Kramdown

      BLOCK_BOUNDARY = /#{BLANK_LINE}|#{EOB_MARKER}|#{IAL_BLOCK_START}|\Z/

      # Return +true+ if we are after a block boundary.
      def after_block_boundary?
        !@tree.children.last || @tree.children.last.type == :blank ||
          (@tree.children.last.type == :eob && @tree.children.last.value.nil?) || @block_ial
      end

      # Return +true+ if we are before a block boundary.
      def before_block_boundary?
        @src.check(self.class::BLOCK_BOUNDARY)
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
kramdown-1.3.1 lib/kramdown/parser/kramdown/block_boundary.rb
kramdown-1.3.0 lib/kramdown/parser/kramdown/block_boundary.rb
kramdown-1.2.0 lib/kramdown/parser/kramdown/block_boundary.rb
kramdown-1.1.0 lib/kramdown/parser/kramdown/block_boundary.rb
kramdown-1.0.2 lib/kramdown/parser/kramdown/block_boundary.rb
kramdown-1.0.1 lib/kramdown/parser/kramdown/block_boundary.rb
kramdown-1.0.0 lib/kramdown/parser/kramdown/block_boundary.rb