core :: Text :: read_md_link
out
buffer.
# Read a markdown link address and append it to the `out` buffer.
private fun read_md_link(out: FlatBuffer, start: Int): Int do
var pos = start
var counter = 1
while pos < length do
var c = self[pos]
if c == '\\' and pos + 1 < length then
pos = escape(out, self[pos + 1], pos)
else
var end_reached = false
if c == '(' then
counter += 1
else if c == ' ' then
if counter == 1 then end_reached = true
else if c == ')' then
counter -= 1
if counter == 0 then end_reached = true
end
if end_reached then break
out.add c
end
pos += 1
end
if pos == length then return -1
return pos
end
lib/markdown/markdown.nit:2489,2--2514,4