aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2011-01-24 09:05:51 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2011-01-26 17:23:56 -0800
commiteb26fa6f540fa9c44135a73f2104fbd0d32d78c1 (patch)
treef679f4438b1ec7ce2e73756b1ca4fd446d0e179f
parentbd43c0f4c940b755e2d68c7146c7f5201fb181d9 (diff)
downloadpandoc-eb26fa6f540fa9c44135a73f2104fbd0d32d78c1.tar.gz
Distinguish latex & context environments; blank line after in writers.
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs7
-rw-r--r--src/Text/Pandoc/Writers/ConTeXt.hs4
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs2
-rw-r--r--tests/markdown-reader-more.native4
-rw-r--r--tests/writer.context5
-rw-r--r--tests/writer.latex1
6 files changed, 9 insertions, 14 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index e7abbc695..63e3262e7 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -711,9 +711,10 @@ rawVerbatimBlock = try $ do
rawTeXBlock :: GenParser Char ParserState Block
rawTeXBlock = do
failIfStrict
- result <- rawLaTeXEnvironment' <|> rawConTeXtEnvironment'
+ result <- liftM (RawBlock "latex") rawLaTeXEnvironment'
+ <|> liftM (RawBlock "context") rawConTeXtEnvironment'
spaces
- return $ RawBlock "latex" result
+ return result
rawHtmlBlocks :: GenParser Char ParserState Block
rawHtmlBlocks = do
@@ -1186,7 +1187,7 @@ inlineNote = try $ do
rawLaTeXInline' :: GenParser Char ParserState Inline
rawLaTeXInline' = do
failIfStrict
- (rawConTeXtEnvironment' >>= return . RawInline "latex")
+ (rawConTeXtEnvironment' >>= return . RawInline "context")
<|> (rawLaTeXEnvironment' >>= return . RawInline "latex")
<|> rawLaTeXInline
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs
index ea8a60771..2951486ce 100644
--- a/src/Text/Pandoc/Writers/ConTeXt.hs
+++ b/src/Text/Pandoc/Writers/ConTeXt.hs
@@ -124,9 +124,7 @@ blockToConTeXt (BlockQuote lst) = do
blockToConTeXt (CodeBlock _ str) =
return $ "\\starttyping" <> cr <> flush (text str) <> cr <> "\\stoptyping" $$ blankline
-- blankline because \stoptyping can't have anything after it, inc. '}'
-blockToConTeXt (RawBlock "context" str) = return $ text str
--- for backwards compatibility, allow latex too:
-blockToConTeXt (RawBlock "latex" str) = return $ text str
+blockToConTeXt (RawBlock "context" str) = return $ text str <> blankline
blockToConTeXt (RawBlock _ _ ) = return empty
blockToConTeXt (BulletList lst) = do
contents <- mapM listItemToConTeXt lst
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index e6687ff08..131aaddfc 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -184,7 +184,7 @@ blockToLaTeX (CodeBlock (_,classes,_) str) = do
else return "verbatim"
return $ "\\begin{" <> text env <> "}" $$ flush (text str) $$
"\\end{" <> text env <> "}" $$ cr -- final cr needed because of footnotes
-blockToLaTeX (RawBlock "latex" x) = return $ text x
+blockToLaTeX (RawBlock "latex" x) = return $ text x <> blankline
blockToLaTeX (RawBlock _ _) = return empty
blockToLaTeX (BulletList lst) = do
items <- mapM listItemToLaTeX lst
diff --git a/tests/markdown-reader-more.native b/tests/markdown-reader-more.native
index 003eceb70..efcd63450 100644
--- a/tests/markdown-reader-more.native
+++ b/tests/markdown-reader-more.native
@@ -2,8 +2,8 @@
,Header 2 [Str "Blank",Space,Str "line",Space,Str "before",Space,Str "URL",Space,Str "in",Space,Str "link",Space,Str "reference"]
,Para [Link [Str "foo"] ("/url",""),Space,Str "and",Space,Link [Str "bar"] ("/url","title")]
,Header 2 [Str "Raw",Space,Str "ConTeXt",Space,Str "environments"]
-,Para [RawInline "latex" "\\placeformula",Space,RawInline "latex" "\\startformula\n L_{1} = L_{2}\n \\stopformula"]
-,RawBlock "latex" "\\start[a2]\n\\start[a2]\n\\stop[a2]\n\\stop[a2]"
+,Para [RawInline "latex" "\\placeformula",Space,RawInline "context" "\\startformula\n L_{1} = L_{2}\n \\stopformula"]
+,RawBlock "context" "\\start[a2]\n\\start[a2]\n\\stop[a2]\n\\stop[a2]"
,Header 2 [Str "URLs",Space,Str "with",Space,Str "spaces"]
,Para [Link [Str "foo"] ("/bar%20and%20baz",""),Space,Link [Str "foo"] ("/bar%20and%20baz",""),Space,Link [Str "foo"] ("/bar%20and%20baz",""),Space,Link [Str "foo"] ("bar%20baz","title")]
,Para [Link [Str "baz"] ("/foo%20foo",""),Space,Link [Str "bam"] ("/foo%20fee",""),Space,Link [Str "bork"] ("/foo/zee%20zob","title")]
diff --git a/tests/writer.context b/tests/writer.context
index f47249c5a..f9fb03cef 100644
--- a/tests/writer.context
+++ b/tests/writer.context
@@ -691,11 +691,6 @@ These shouldn't be math:
Here's a LaTeX table:
-\begin{tabular}{|l|l|}\hline
-Animal & Number \\ \hline
-Dog & 2 \\
-Cat & 1 \\ \hline
-\end{tabular}
\thinrule
\subject{Special Characters}
diff --git a/tests/writer.latex b/tests/writer.latex
index 44e11c874..e6adff585 100644
--- a/tests/writer.latex
+++ b/tests/writer.latex
@@ -634,6 +634,7 @@ Animal & Number \\ \hline
Dog & 2 \\
Cat & 1 \\ \hline
\end{tabular}
+
\begin{center}\rule{3in}{0.4pt}\end{center}
\section{Special Characters}