LaTeX reader: Support obeylines environment.

Closes #604.
This commit is contained in:
John MacFarlane 2012-09-06 16:27:01 -07:00
parent e2cc9e7ca1
commit 7d0438897b
3 changed files with 9 additions and 0 deletions

View file

@ -742,6 +742,9 @@ environments = M.fromList
, ("lstlisting", codeBlock <$> (verbEnv "lstlisting")) , ("lstlisting", codeBlock <$> (verbEnv "lstlisting"))
, ("minted", liftA2 (\l c -> codeBlockWith ("",[l],[]) c) , ("minted", liftA2 (\l c -> codeBlockWith ("",[l],[]) c)
(grouped (many1 $ satisfy (/= '}'))) (verbEnv "minted")) (grouped (many1 $ satisfy (/= '}'))) (verbEnv "minted"))
, ("obeylines", parseFromString
(para . trimInlines . mconcat <$> many inline) =<<
intercalate "\\\\\n" . lines <$> verbEnv "obeylines")
, ("displaymath", mathEnv Nothing "displaymath") , ("displaymath", mathEnv Nothing "displaymath")
, ("equation", mathEnv Nothing "equation") , ("equation", mathEnv Nothing "equation")
, ("equation*", mathEnv Nothing "equation*") , ("equation*", mathEnv Nothing "equation*")

View file

@ -155,6 +155,11 @@ And:
These should not be escaped: \$ \\ \> \[ \{ These should not be escaped: \$ \\ \> \[ \{
\end{verbatim} \end{verbatim}
\begin{obeylines}
this has \emph{two
lines}
\end{obeylines}
\begin{center}\rule{3in}{0.4pt}\end{center} \begin{center}\rule{3in}{0.4pt}\end{center}
\section{Lists} \section{Lists}

View file

@ -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" ,CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab"
,Para [Str "And:"] ,Para [Str "And:"]
,CodeBlock ("",[],[]) " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{" ,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 ,HorizontalRule
,Header 1 [Str "Lists"] ,Header 1 [Str "Lists"]
,Header 2 [Str "Unordered"] ,Header 2 [Str "Unordered"]