summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Writers/RST.hs7
-rw-r--r--tests/lhs-test-markdown.native2
-rw-r--r--tests/lhs-test.html4
-rw-r--r--tests/lhs-test.html+lhs4
-rw-r--r--tests/lhs-test.latex4
-rw-r--r--tests/lhs-test.latex+lhs4
-rw-r--r--tests/lhs-test.markdown4
-rw-r--r--tests/lhs-test.markdown+lhs4
-rw-r--r--tests/lhs-test.native2
-rw-r--r--tests/lhs-test.rst6
-rw-r--r--tests/lhs-test.rst+lhs4
11 files changed, 25 insertions, 20 deletions
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
index 89acd2ef5..78b8fcd73 100644
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -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
diff --git a/tests/lhs-test-markdown.native b/tests/lhs-test-markdown.native
index 28275f3eb..63037d9e3 100644
--- a/tests/lhs-test-markdown.native
+++ b/tests/lhs-test-markdown.native
@@ -1,6 +1,6 @@
[Header 1 ("lhs-test",[],[]) [Str "lhs",Space,Str "test"]
,Para [Code ("",[],[]) "unsplit",Space,Str "is",Space,Str "an",Space,Str "arrow",Space,Str "that",Space,Str "takes",Space,Str "a",Space,Str "pair",Space,Str "of",Space,Str "values",Space,Str "and",Space,Str "combines",Space,Str "them",Space,Str "to",Space,Str "return",Space,Str "a",Space,Str "single",Space,Str "value:"]
-,CodeBlock ("",["sourceCode","literate","haskell"],[]) "unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d\nunsplit = arr . uncurry \n -- arr (\\op (x,y) -> x `op` y) "
+,CodeBlock ("",["sourceCode","literate","haskell"],[]) "unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d\nunsplit = arr . uncurry\n -- arr (\\op (x,y) -> x `op` y)"
,Para [Code ("",[],[]) "(***)",Space,Str "combines",Space,Str "two",Space,Str "arrows",Space,Str "into",Space,Str "a",Space,Str "new",Space,Str "arrow",Space,Str "by",Space,Str "running",Space,Str "the",Space,Str "two",Space,Str "arrows",Space,Str "on",Space,Str "a",Space,Str "pair",Space,Str "of",Space,Str "values",Space,Str "(one",Space,Str "arrow",Space,Str "on",Space,Str "the",Space,Str "first",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair",Space,Str "and",Space,Str "one",Space,Str "arrow",Space,Str "on",Space,Str "the",Space,Str "second",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair)."]
,CodeBlock ("",[],[]) "f *** g = first f >>> second g"
,Para [Str "Block",Space,Str "quote:"]
diff --git a/tests/lhs-test.html b/tests/lhs-test.html
index a0d05055e..9cea03a9f 100644
--- a/tests/lhs-test.html
+++ b/tests/lhs-test.html
@@ -30,8 +30,8 @@ code > span.er { color: #ff0000; font-weight: bold; }
<h1>lhs test</h1>
<p><code>unsplit</code> is an arrow that takes a pair of values and combines them to return a single value:</p>
<pre class="sourceCode literate haskell"><code class="sourceCode haskell"><span class="ot">unsplit ::</span> (<span class="dt">Arrow</span> a) <span class="ot">=&gt;</span> (b <span class="ot">-&gt;</span> c <span class="ot">-&gt;</span> d) <span class="ot">-&gt;</span> a (b, c) d
-unsplit <span class="fu">=</span> arr <span class="fu">.</span> <span class="fu">uncurry</span>
- <span class="co">-- arr (\op (x,y) -&gt; x `op` y) </span></code></pre>
+unsplit <span class="fu">=</span> arr <span class="fu">.</span> <span class="fu">uncurry</span>
+ <span class="co">-- arr (\op (x,y) -&gt; x `op` y)</span></code></pre>
<p><code>(***)</code> combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).</p>
<pre><code>f *** g = first f &gt;&gt;&gt; second g</code></pre>
<p>Block quote:</p>
diff --git a/tests/lhs-test.html+lhs b/tests/lhs-test.html+lhs
index 347009c5a..9be283671 100644
--- a/tests/lhs-test.html+lhs
+++ b/tests/lhs-test.html+lhs
@@ -30,8 +30,8 @@ code > span.er { color: #ff0000; font-weight: bold; }
<h1>lhs test</h1>
<p><code>unsplit</code> is an arrow that takes a pair of values and combines them to return a single value:</p>
<pre class="sourceCode literate haskell"><code class="sourceCode haskell"><span class="fu">&gt;</span><span class="ot"> unsplit ::</span> (<span class="dt">Arrow</span> a) <span class="ot">=&gt;</span> (b <span class="ot">-&gt;</span> c <span class="ot">-&gt;</span> d) <span class="ot">-&gt;</span> a (b, c) d
-<span class="fu">&gt;</span> unsplit <span class="fu">=</span> arr <span class="fu">.</span> <span class="fu">uncurry</span>
-<span class="fu">&gt;</span> <span class="co">-- arr (\op (x,y) -&gt; x `op` y) </span></code></pre>
+<span class="fu">&gt;</span> unsplit <span class="fu">=</span> arr <span class="fu">.</span> <span class="fu">uncurry</span>
+<span class="fu">&gt;</span> <span class="co">-- arr (\op (x,y) -&gt; x `op` y)</span></code></pre>
<p><code>(***)</code> combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).</p>
<pre><code>f *** g = first f &gt;&gt;&gt; second g</code></pre>
<p>Block quote:</p>
diff --git a/tests/lhs-test.latex b/tests/lhs-test.latex
index 4a37a2a67..db81e18c7 100644
--- a/tests/lhs-test.latex
+++ b/tests/lhs-test.latex
@@ -72,8 +72,8 @@ return a single value:
\begin{Shaded}
\begin{Highlighting}[]
\OtherTok{unsplit ::} \NormalTok{(}\DataTypeTok{Arrow} \NormalTok{a) }\OtherTok{=>} \NormalTok{(b }\OtherTok{->} \NormalTok{c }\OtherTok{->} \NormalTok{d) }\OtherTok{->} \NormalTok{a (b, c) d}
-\NormalTok{unsplit }\FunctionTok{=} \NormalTok{arr }\FunctionTok{.} \FunctionTok{uncurry}
- \CommentTok{-- arr (\textbackslash{}op (x,y) -> x `op` y) }
+\NormalTok{unsplit }\FunctionTok{=} \NormalTok{arr }\FunctionTok{.} \FunctionTok{uncurry}
+ \CommentTok{-- arr (\textbackslash{}op (x,y) -> x `op` y)}
\end{Highlighting}
\end{Shaded}
diff --git a/tests/lhs-test.latex+lhs b/tests/lhs-test.latex+lhs
index df1801bf3..80c1eb16b 100644
--- a/tests/lhs-test.latex+lhs
+++ b/tests/lhs-test.latex+lhs
@@ -53,8 +53,8 @@ return a single value:
\begin{code}
unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
-unsplit = arr . uncurry
- -- arr (\op (x,y) -> x `op` y)
+unsplit = arr . uncurry
+ -- arr (\op (x,y) -> x `op` y)
\end{code}
\texttt{(***)} combines two arrows into a new arrow by running the two arrows
diff --git a/tests/lhs-test.markdown b/tests/lhs-test.markdown
index 261021bb7..47ec920d3 100644
--- a/tests/lhs-test.markdown
+++ b/tests/lhs-test.markdown
@@ -6,8 +6,8 @@ a single value:
~~~~ {.sourceCode .literate .haskell}
unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
-unsplit = arr . uncurry
- -- arr (\op (x,y) -> x `op` y)
+unsplit = arr . uncurry
+ -- arr (\op (x,y) -> x `op` y)
~~~~
`(***)` combines two arrows into a new arrow by running the two arrows on a
diff --git a/tests/lhs-test.markdown+lhs b/tests/lhs-test.markdown+lhs
index e6f0088c5..41dfba912 100644
--- a/tests/lhs-test.markdown+lhs
+++ b/tests/lhs-test.markdown+lhs
@@ -5,8 +5,8 @@ lhs test
a single value:
> unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
-> unsplit = arr . uncurry
-> -- arr (\op (x,y) -> x `op` y)
+> unsplit = arr . uncurry
+> -- arr (\op (x,y) -> x `op` y)
`(***)` combines two arrows into a new arrow by running the two arrows on a
pair of values (one arrow on the first item of the pair and one arrow on the
diff --git a/tests/lhs-test.native b/tests/lhs-test.native
index dc6c0588e..3a22d1f8a 100644
--- a/tests/lhs-test.native
+++ b/tests/lhs-test.native
@@ -1,6 +1,6 @@
[Header 1 ("",[],[]) [Str "lhs",Space,Str "test"]
,Para [Code ("",[],[]) "unsplit",Space,Str "is",Space,Str "an",Space,Str "arrow",Space,Str "that",Space,Str "takes",Space,Str "a",Space,Str "pair",Space,Str "of",Space,Str "values",Space,Str "and",Space,Str "combines",Space,Str "them",Space,Str "to",Space,Str "return",Space,Str "a",Space,Str "single",Space,Str "value:"]
-,CodeBlock ("",["sourceCode","literate","haskell"],[]) "unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d\nunsplit = arr . uncurry \n -- arr (\\op (x,y) -> x `op` y) "
+,CodeBlock ("",["sourceCode","literate","haskell"],[]) "unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d\nunsplit = arr . uncurry\n -- arr (\\op (x,y) -> x `op` y)"
,Para [Code ("",[],[]) "(***)",Space,Str "combines",Space,Str "two",Space,Str "arrows",Space,Str "into",Space,Str "a",Space,Str "new",Space,Str "arrow",Space,Str "by",Space,Str "running",Space,Str "the",Space,Str "two",Space,Str "arrows",Space,Str "on",Space,Str "a",Space,Str "pair",Space,Str "of",Space,Str "values",Space,Str "(one",Space,Str "arrow",Space,Str "on",Space,Str "the",Space,Str "first",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair",Space,Str "and",Space,Str "one",Space,Str "arrow",Space,Str "on",Space,Str "the",Space,Str "second",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair)."]
,CodeBlock ("",[],[]) "f *** g = first f >>> second g"
,Para [Str "Block",Space,Str "quote:"]
diff --git a/tests/lhs-test.rst b/tests/lhs-test.rst
index 37ad099af..3de2d9ff6 100644
--- a/tests/lhs-test.rst
+++ b/tests/lhs-test.rst
@@ -4,11 +4,11 @@ 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
- -- arr (\op (x,y) -> x `op` y)
+ unsplit = arr . uncurry
+ -- arr (\op (x,y) -> x `op` y)
``(***)`` combines two arrows into a new arrow by running the two arrows on a
pair of values (one arrow on the first item of the pair and one arrow on the
diff --git a/tests/lhs-test.rst+lhs b/tests/lhs-test.rst+lhs
index 6b6ffb860..eec79c546 100644
--- a/tests/lhs-test.rst+lhs
+++ b/tests/lhs-test.rst+lhs
@@ -5,8 +5,8 @@ lhs test
return a single value:
> unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
-> unsplit = arr . uncurry
-> -- arr (\op (x,y) -> x `op` y)
+> unsplit = arr . uncurry
+> -- arr (\op (x,y) -> x `op` y)
``(***)`` combines two arrows into a new arrow by running the two arrows on a
pair of values (one arrow on the first item of the pair and one arrow on the