markdown2 :: MdHtmlBlockParser :: block=
markdown2 :: MdHtmlBlockParser :: closing_pattern
Closing tag patternmarkdown2 :: MdHtmlBlockParser :: closing_pattern=
Closing tag patternmarkdown2 :: MdHtmlBlockParser :: finished=
Is the current block finished?markdown2 $ MdHtmlBlockParser :: BLOCK
Kind of block under constructionmarkdown2 $ MdHtmlBlockParser :: SELF
Type of this instance, automatically specialized in every classmarkdown2 $ MdHtmlBlockParser :: add_line
Addline
to the current block
markdown2 $ MdHtmlBlockParser :: finalize
Finalize the currentblock
markdown2 $ MdHtmlBlockParser :: try_continue
Canself
continue from the current index
in parser
?
markdown2 :: MdHtmlBlockParser :: block=
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
markdown2 :: MdHtmlBlockParser :: closing_pattern
Closing tag patternmarkdown2 :: MdHtmlBlockParser :: closing_pattern=
Closing tag patternmarkdown2 :: MdBlockParser :: column_start=
Column startmarkdown2 :: MdBlockParser :: content_offset
Column where the content startsmarkdown2 :: MdBlockParser :: content_offset=
Column where the content startscore :: Object :: defaultinit
markdown2 :: MdHtmlBlockParser :: finished=
Is the current block finished?markdown2 :: MdBlockParser :: initialize
Initialize the currentblock
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
markdown2 :: MdBlockParser :: location=
Location at startcore :: Object :: output_class_name
Display class name on stdout (debug only).markdown2 :: MdBlockParser :: parse_inlines
Parseblock
lines
markdown2 :: MdBlockParser :: try_continue
Canself
continue from the current index
in parser
?
# 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