Export: fix LaTeX export for more than 2 consecutive '-', '<' or '>'

Fix escaping of '-', '<' and '>' characters to properly handle inputs
with more than 2 consecutive identical characters of this set.
This commit is contained in:
Colomban Wendling 2014-04-09 15:05:44 +02:00
parent 874c822328
commit 527dee7203

View File

@ -492,40 +492,14 @@ static void write_latex_file(GeanyDocument *doc, const gchar *filename,
g_string_append(body, "\\symbol{94}"); g_string_append(body, "\\symbol{94}");
break; break;
} }
/** TODO still don't work for "---" or "----" */ /* mask "--", "<<" and ">>" */
case '-': /* mask "--" */ case '-':
case '<':
case '>':
{ {
if (c_next == '-') g_string_append_c(body, c);
{ if (c_next == c)
g_string_append(body, "-\\/-"); g_string_append(body, "\\/");
i++; /* skip the next character */
}
else
g_string_append_c(body, '-');
break;
}
case '<': /* mask "<<" */
{
if (c_next == '<')
{
g_string_append(body, "<\\/<");
i++; /* skip the next character */
}
else
g_string_append_c(body, '<');
break;
}
case '>': /* mask ">>" */
{
if (c_next == '>')
{
g_string_append(body, ">\\/>");
i++; /* skip the next character */
}
else
g_string_append_c(body, '>');
break; break;
} }