From c93ecfc3c5d7c9ed0b4b7bdab943a0fedd185601 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 5 Feb 2017 22:22:42 +0100 Subject: Handle language in inline code with --listings. Closes #3422. --- test/command/3422.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test/command/3422.md (limited to 'test/command/3422.md') diff --git a/test/command/3422.md b/test/command/3422.md new file mode 100644 index 000000000..a010320e9 --- /dev/null +++ b/test/command/3422.md @@ -0,0 +1,9 @@ +See #3422 + +``` +% pandoc -t latex --listings +`int main(int argc, const char *argv[]);`{.c} +^D +\lstinline[language=C]!int main(int argc, const char *argv[]);! +``` + -- cgit v1.2.3 From 730796ee314d42477fab216621b8e44539c94656 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 29 Apr 2017 11:05:44 +0200 Subject: LaTeX writer: Fix problem with escaping in lstinline. Previously the LaTeX writer created invalid LaTeX when `--listings` was specified and a code span occured inside emphasis or another construction. This is because the characters `%{}\` must be escaped in lstinline when the listinline occurs in another command, otherwise they must not be escaped. To deal with this, adoping Michael Kofler's suggestion, we always wrap lstinline in a dummy command `\passthrough`, now defined in the default template if `--listings` is specified. This way we can consistently escape the special characters. Closes #1629. --- test/command/3422.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/command/3422.md') diff --git a/test/command/3422.md b/test/command/3422.md index a010320e9..19f1f4462 100644 --- a/test/command/3422.md +++ b/test/command/3422.md @@ -4,6 +4,6 @@ See #3422 % pandoc -t latex --listings `int main(int argc, const char *argv[]);`{.c} ^D -\lstinline[language=C]!int main(int argc, const char *argv[]);! +\passthrough{\lstinline[language=C]!int main(int argc, const char *argv[]);!} ``` -- cgit v1.2.3