string
to LaTeX
# Escape `string` to LaTeX
fun latex_escape(string: String): String do
var buffer = new Buffer
for i in [0 .. string.length[ do
var c = string.chars[i]
if c == '>' then
buffer.append "\\textgreater"
continue
else if c == '<' then
buffer.append "\\textless"
continue
else if c == '\\' then
buffer.append "\\textbackslash"
continue
else if escaped_chars.has(c) then
buffer.add '\\'
end
buffer.add c
end
return buffer.to_s
end
lib/markdown2/markdown_latex_rendering.nit:87,2--107,4