Html blocks parser

Introduced properties

protected fun block=(block: BLOCK)

markdown2 :: MdHtmlBlockParser :: block=

fun closing_pattern: nullable Pattern

markdown2 :: MdHtmlBlockParser :: closing_pattern

Closing tag pattern
protected fun closing_pattern=(closing_pattern: nullable Pattern)

markdown2 :: MdHtmlBlockParser :: closing_pattern=

Closing tag pattern
fun content: Buffer

markdown2 :: MdHtmlBlockParser :: content

Block content
protected fun content=(content: Buffer)

markdown2 :: MdHtmlBlockParser :: content=

Block content
init defaultinit(line_start: Int, column_start: Int, content_offset: Int, closing_pattern: nullable Pattern)

markdown2 :: MdHtmlBlockParser :: defaultinit

fun finished: Bool

markdown2 :: MdHtmlBlockParser :: finished

Is the current block finished?
protected fun finished=(finished: Bool)

markdown2 :: MdHtmlBlockParser :: finished=

Is the current block finished?

Redefined properties

redef type BLOCK: MdHtmlBlock

markdown2 $ MdHtmlBlockParser :: BLOCK

Kind of block under construction
redef type SELF: MdHtmlBlockParser

markdown2 $ MdHtmlBlockParser :: SELF

Type of this instance, automatically specialized in every class
redef fun add_line(line: String)

markdown2 $ MdHtmlBlockParser :: add_line

Add line to the current block
redef fun block: BLOCK

markdown2 $ MdHtmlBlockParser :: block

MdBlock under construction
redef fun finalize(parser: MdParser)

markdown2 $ MdHtmlBlockParser :: finalize

Finalize the current block
redef fun try_continue(state: MdParser): nullable MdBlockContinue

markdown2 $ MdHtmlBlockParser :: try_continue

Can self continue from the current index in parser?

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type BLOCK: MdBlock

markdown2 :: MdBlockParser :: BLOCK

Kind of block under construction
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
fun add_line(line: String)

markdown2 :: MdBlockParser :: add_line

Add line to the current block
abstract fun block: BLOCK

markdown2 :: MdBlockParser :: block

MdBlock under construction
protected fun block=(block: BLOCK)

markdown2 :: MdHtmlBlockParser :: block=

protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
fun closing_pattern: nullable Pattern

markdown2 :: MdHtmlBlockParser :: closing_pattern

Closing tag pattern
protected fun closing_pattern=(closing_pattern: nullable Pattern)

markdown2 :: MdHtmlBlockParser :: closing_pattern=

Closing tag pattern
protected fun column_start=(column_start: Int)

markdown2 :: MdBlockParser :: column_start=

Column start
fun content: Buffer

markdown2 :: MdHtmlBlockParser :: content

Block content
protected fun content=(content: Buffer)

markdown2 :: MdHtmlBlockParser :: content=

Block content
fun content_offset: Int

markdown2 :: MdBlockParser :: content_offset

Column where the content starts
protected fun content_offset=(content_offset: Int)

markdown2 :: MdBlockParser :: content_offset=

Column where the content starts
init defaultinit(line_start: Int, column_start: Int, content_offset: Int, closing_pattern: nullable Pattern)

markdown2 :: MdHtmlBlockParser :: defaultinit

init defaultinit(line_start: Int, column_start: Int, content_offset: Int)

markdown2 :: MdBlockParser :: defaultinit

fun finalize(parser: MdParser)

markdown2 :: MdBlockParser :: finalize

Finalize the current block
fun finished: Bool

markdown2 :: MdHtmlBlockParser :: finished

Is the current block finished?
protected fun finished=(finished: Bool)

markdown2 :: MdHtmlBlockParser :: finished=

Is the current block finished?
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun initialize(parser: MdParser)

markdown2 :: MdBlockParser :: initialize

Initialize the current block
fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
protected fun line_start=(line_start: Int)

markdown2 :: MdBlockParser :: line_start=

Line Start
fun location: MdLocation

markdown2 :: MdBlockParser :: location

Location at start
protected fun location=(location: MdLocation)

markdown2 :: MdBlockParser :: location=

Location at start
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun parse_inlines(inline_parser: MdInlineParser)

markdown2 :: MdBlockParser :: parse_inlines

Parse block lines
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
abstract fun try_continue(state: MdParser): nullable MdBlockContinue

markdown2 :: MdBlockParser :: try_continue

Can self continue from the current index in parser?
package_diagram markdown2::MdHtmlBlockParser MdHtmlBlockParser markdown2::MdBlockParser MdBlockParser markdown2::MdHtmlBlockParser->markdown2::MdBlockParser core::Object Object markdown2::MdBlockParser->core::Object ...core::Object ... ...core::Object->core::Object

Ancestors

interface Object

core :: Object

The root of the class hierarchy.

Parents

abstract class MdBlockParser

markdown2 :: MdBlockParser

Parser for a specific block node

Class definitions

markdown2 $ MdHtmlBlockParser
# 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