markdown :: MDLine :: read_xml_comment
Used by check_html
.
# Read a XML comment.
# Used by `check_html`.
private fun read_xml_comment(first_line: MDLine, start: Int): Int do
var line: nullable MDLine = first_line
if start + 3 < line.as(not null).value.length then
if line.as(not null).value[2] == '-' and line.as(not null).value[3] == '-' then
var pos = start + 4
while line != null do
while pos < line.value.length and line.value[pos] != '-' do
pos += 1
end
if pos == line.value.length then
line = line.next
pos = 0
else
if pos + 2 < line.value.length then
if line.value[pos + 1] == '-' and line.value[pos + 2] == '>' then
first_line.xml_end_line = line
return pos + 3
end
end
pos += 1
end
end
end
end
return -1
end
lib/markdown/markdown.nit:1601,2--1628,4