markdown :: LineOther :: defaultinit
# A non-specific markdown construction.
# Mainly used as part of another line construct such as paragraphs or lists.
class LineOther
super Line
redef fun process(v) do
var line = v.current_line
# go to block end
var was_empty = line.as(not null).prev_empty
while line != null and not line.is_empty do
var t = v.line_kind(line)
if (v.in_list or v.ext_mode) and t isa LineList then
break
end
if v.ext_mode and (t isa LineCode or t isa LineFence) then
break
end
if t isa LineHeadline or t isa LineHeadline1 or t isa LineHeadline2 or
t isa LineHR or t isa LineBlockquote or t isa LineXML then
break
end
line = line.next
end
# build block
var current_block = v.current_block.as(not null)
if line != null and not line.is_empty then
var block = current_block.split(line.prev.as(not null))
if v.in_list and not was_empty then
block.kind = new BlockNone(block)
else
block.kind = new BlockParagraph(block)
end
current_block.remove_leading_empty_lines
else
var block: MDBlock
if line != null then
block = current_block.split(line)
else
block = current_block.split(current_block.last_line.as(not null))
end
if v.in_list and (line == null or not line.is_empty) and not was_empty then
block.kind = new BlockNone(block)
else
block.kind = new BlockParagraph(block)
end
current_block.remove_leading_empty_lines
end
v.current_line = current_block.first_line
end
end
lib/markdown/markdown.nit:1651,1--1700,3