RST writer: Use .. code:: language for code blocks with language.

Closes #721.
Also fixed whitespace in lhs tests.
This commit is contained in:
John MacFarlane 2013-01-26 16:09:41 -08:00
parent 2f50406c7f
commit 9d549ab683
11 changed files with 25 additions and 20 deletions

View file

@ -177,7 +177,12 @@ blockToRST (CodeBlock (_,classes,_) str) = do
if "haskell" `elem` classes && "literate" `elem` classes &&
isEnabled Ext_literate_haskell opts
then return $ prefixed "> " (text str) $$ blankline
else return $ "::" $+$ nest tabstop (text str) $$ blankline
else return $
(case [c | c <- classes,
c `notElem` ["sourceCode","literate","numberLines"]] of
[] -> "::"
(lang:_) -> ".. code:: " <> text lang)
$+$ nest tabstop (text str) $$ blankline
blockToRST (BlockQuote blocks) = do
tabstop <- get >>= (return . writerTabStop . stOptions)
contents <- blockListToRST blocks

View file

@ -4,7 +4,7 @@ lhs test
``unsplit`` is an arrow that takes a pair of values and combines them to
return a single value:
::
.. code:: haskell
unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
unsplit = arr . uncurry