git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: Support obeylines environment.

Closes #604.

commit7d0438897b0df6cc861c9fc679ceeb976cb24c1a authorJohn MacFarlane <jgm@berkeley.edu> dateThu 6 Sep 2012, 16:27 (14 years ago) parente2cc9e7
3 files changed+9
src/Text/Pandoc/Readers/LaTeX.hs+3 tests/latex-reader.latex+5 tests/latex-reader.native+1
src/Text/Pandoc/Readers/LaTeX.hs+3
@@ -742,6 +742,9 @@ environments = M.fromList
742742 , ("lstlisting", codeBlock <$> (verbEnv "lstlisting"))
743743 , ("minted", liftA2 (\l c -> codeBlockWith ("",[l],[]) c)
744744 (grouped (many1 $ satisfy (/= '}'))) (verbEnv "minted"))
745+ , ("obeylines", parseFromString
746+ (para . trimInlines . mconcat <$> many inline) =<<
747+ intercalate "\\\\\n" . lines <$> verbEnv "obeylines")
745748 , ("displaymath", mathEnv Nothing "displaymath")
746749 , ("equation", mathEnv Nothing "equation")
747750 , ("equation*", mathEnv Nothing "equation*")
tests/latex-reader.latex+5
@@ -155,6 +155,11 @@ And:
155155
156156These should not be escaped: \$ \\ \> \[ \{
157157\end{verbatim}
158+
159+\begin{obeylines}
160+this has \emph{two
161+lines}
162+\end{obeylines}
158163\begin{center}\rule{3in}{0.4pt}\end{center}
159164
160165\section{Lists}
tests/latex-reader.native+1
@@ -57,6 +57,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
5757,CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab"
5858,Para [Str "And:"]
5959,CodeBlock ("",[],[]) " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{"
60+,Para [Str "this",Space,Str "has",Space,Emph [Str "two",LineBreak,Str "lines"]]
6061,HorizontalRule
6162,Header 1 [Str "Lists"]
6263,Header 2 [Str "Unordered"]