From 5eb01d279361ee7465d3a3f7d9494f1cd1018dd6 Mon Sep 17 00:00:00 2001 From: Doeme Date: Sat, 7 Jan 2017 21:00:24 +0100 Subject: Fixes for the LaTeX renderer (#182) * Don't double-output the link in latex-rendering. * Prevent ligatures in dashes sensibly when rendering latex. \- is a hyphenation, so it doesn't get displayed at all. * Redo "Don't double-output the link in latex-rendering." This reverts commit 8fb1f1c3c8799628141780ca5fd8d70883c1ec53 and adds the proper solution to the problem. With commit 8fb1f1c3c double rendering is fixed, but the url isn't escaped anymore, so I discarded the wrong copy. We now return 0 from the function in case of a single link, which stops processing the contents of the node. * Add a comment about the double-rendering issue addressed in 1c0d4749451cf85a849a3cf8e41cf137789821d4 --- src/latex.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/latex.c') diff --git a/src/latex.c b/src/latex.c index e78c7d9..9bd6444 100644 --- a/src/latex.c +++ b/src/latex.c @@ -42,7 +42,7 @@ static CMARK_INLINE void outc(cmark_renderer *renderer, cmark_escaping escape, break; case 45: // '-' if (nextc == 45) { // prevent ligature - cmark_render_ascii(renderer, "\\-"); + cmark_render_ascii(renderer, "-{}"); } else { cmark_render_ascii(renderer, "-"); } @@ -390,7 +390,8 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, case URL_AUTOLINK: LIT("\\url{"); OUT(url, false, URL); - break; + LIT("}"); + return 0; // Don't process further nodes to avoid double-rendering artefacts case EMAIL_AUTOLINK: LIT("\\href{"); OUT(url, false, URL); -- cgit v1.2.3