Property definitions

markdown2 $ MdHtmlBlockParser :: defaultinit
# Html blocks parser
class MdHtmlBlockParser
	super MdBlockParser

	redef type BLOCK: MdHtmlBlock
	redef var block = new MdHtmlBlock(location) is lazy

	# Closing tag pattern
	#
	# Or null if the block is not closed
	var closing_pattern: nullable Pattern

	# Is the current block finished?
	var finished = false

	# Block content
	var content = new Buffer

	redef fun try_continue(state) do
		if finished then return null

		# blank lin ends type 6 and 7 blocks
		if state.is_blank and closing_pattern == null then return null

		return new MdBlockContinue.at_index(state.index)
	end

	redef fun add_line(line) do
		if not content.is_empty then
			content.add('\n')
		end
		content.append(line)
		var closing_pattern = self.closing_pattern
		if closing_pattern != null and line.has(closing_pattern) then
			finished = true
		end
	end

	redef fun finalize(parser) do
		super

		var content = self.content.to_s
		block.literal = content

		var lines = content.split("\n")
		location.line_end = location.line_start + lines.length - 1
		location.column_end = lines.last.length
	end
end
lib/markdown2/markdown_block_parsing.nit:1284,1--1332,3