markdown :: LineFence :: defaultinit
# A markdown fence code line.
class LineFence
super Line
redef fun process(v) do
# go to fence end
var line = v.current_line.as(not null).next
var current_block = v.current_block.as(not null)
while line != null do
if v.line_kind(line) isa LineFence then break
line = line.next
end
if line != null then
line = line.next
end
# build fence block
var block: MDBlock
if line != null then
block = current_block.split(line.prev.as(not null))
else
block = current_block.split(current_block.last_line.as(not null))
end
block.remove_surrounding_empty_lines
var meta = block.first_line.as(not null).value.meta_from_fence
block.kind = new BlockFence(block, meta)
block.first_line.as(not null).clear
var last = block.last_line
if last != null and v.line_kind(last) isa LineFence then
block.last_line.as(not null).clear
end
block.remove_surrounding_empty_lines
v.current_line = line
end
end
lib/markdown/markdown.nit:1790,1--1823,3