From 5f9f458df394686405b525757d1b5ef3b4cbad17 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 31 Oct 2017 11:30:56 -0700 Subject: LaTeX reader: handle `%` comment right after command. For example \emph% {hi} --- src/Text/Pandoc/Readers/LaTeX.hs | 2 +- test/command/4016.md | 47 +++++++++++++++++++++++++++++++++++ test/command/latex-command-comment.md | 7 ++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 test/command/4016.md create mode 100644 test/command/latex-command-comment.md diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index a982029af..9bac3d3a7 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -1132,7 +1132,7 @@ inlineCommand' = try $ do lookupListDefault raw names inlineCommands tok :: PandocMonad m => LP m Inlines -tok = grouped inline <|> inlineCommand' <|> singleChar' +tok = try $ spaces >> grouped inline <|> inlineCommand' <|> singleChar' where singleChar' = do Tok _ _ t <- singleChar return (str (T.unpack t)) diff --git a/test/command/4016.md b/test/command/4016.md new file mode 100644 index 000000000..69ad1c911 --- /dev/null +++ b/test/command/4016.md @@ -0,0 +1,47 @@ +``` +pandoc -t beamer +# Level 2 blocks + +
+
+## Block one +- Item +
+
+## Block two +- Item +
+
+^D +\begin{frame}{% +\protect\hypertarget{level-2-blocks}{% +Level 2 blocks}} + +\begin{columns}[T] +\begin{column}{0.40\textwidth} +\begin{block}{Block one} + +\begin{itemize} +\tightlist +\item + Item +\end{itemize} + +\end{block} +\end{column} + +\begin{column}{0.60\textwidth} +\begin{block}{Block two} + +\begin{itemize} +\tightlist +\item + Item +\end{itemize} + +\end{block} +\end{column} +\end{columns} + +\end{frame} +``` diff --git a/test/command/latex-command-comment.md b/test/command/latex-command-comment.md new file mode 100644 index 000000000..640277f15 --- /dev/null +++ b/test/command/latex-command-comment.md @@ -0,0 +1,7 @@ +``` +pandoc -f latex -t native +\emph% +{hi} +^D +[Para [Emph [Str "hi"]]] +``` -- cgit v1.2.3