diff options
author | Doeme <das1993@hotmail.com> | 2017-01-07 21:00:24 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-01-07 21:00:24 +0100 |
commit | 5eb01d279361ee7465d3a3f7d9494f1cd1018dd6 (patch) | |
tree | 177da85029145cf22d481a405d3181fec0f5afb5 | |
parent | 3894dbddbf4142748bc0dd72c5460b860dd8b5ef (diff) |
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
-rw-r--r-- | src/latex.c | 5 |
1 files changed, 3 insertions, 2 deletions
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); |