Sha256: 68e611a19fcc596c27ee5cf8a3ffa7619a7700503be8d9c50b3dd30824a8507c

Contents?: true

Size: 881 Bytes

Versions: 3

Compression:

Stored size: 881 Bytes

Contents

# -*- coding: utf-8; frozen_string_literal: true -*-
#
#--
# Copyright (C) 2009-2019 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

3 entries across 3 versions & 1 rubygems

Version Path
kramdown-2.0.0 lib/kramdown/parser/kramdown/block_boundary.rb
kramdown-2.0.0.beta2 lib/kramdown/parser/kramdown/block_boundary.rb
kramdown-2.0.0.beta1 lib/kramdown/parser/kramdown/block_boundary.rb