diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index b9b4e86fc..4a9ac8a41 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -742,6 +742,9 @@ environments = M.fromList , ("lstlisting", codeBlock <$> (verbEnv "lstlisting")) , ("minted", liftA2 (\l c -> codeBlockWith ("",[l],[]) c) (grouped (many1 $ satisfy (/= '}'))) (verbEnv "minted")) + , ("obeylines", parseFromString + (para . trimInlines . mconcat <$> many inline) =<< + intercalate "\\\\\n" . lines <$> verbEnv "obeylines") , ("displaymath", mathEnv Nothing "displaymath") , ("equation", mathEnv Nothing "equation") , ("equation*", mathEnv Nothing "equation*") diff --git a/tests/latex-reader.latex b/tests/latex-reader.latex index cd424baec..dd7854eb1 100644 --- a/tests/latex-reader.latex +++ b/tests/latex-reader.latex @@ -155,6 +155,11 @@ And: These should not be escaped: \$ \\ \> \[ \{ \end{verbatim} + +\begin{obeylines} +this has \emph{two +lines} +\end{obeylines} \begin{center}\rule{3in}{0.4pt}\end{center} \section{Lists} diff --git a/tests/latex-reader.native b/tests/latex-reader.native index 2ba7a78f2..b7cf39bc3 100644 --- a/tests/latex-reader.native +++ b/tests/latex-reader.native @@ -57,6 +57,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA ,CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab" ,Para [Str "And:"] ,CodeBlock ("",[],[]) " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{" +,Para [Str "this",Space,Str "has",Space,Emph [Str "two",LineBreak,Str "lines"]] ,HorizontalRule ,Header 1 [Str "Lists"] ,Header 2 [Str "Unordered"]