aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Haddock/Parse.y13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/Haddock/Parse.y b/src/Text/Pandoc/Readers/Haddock/Parse.y
index 065b9997f..26d7c287d 100644
--- a/src/Text/Pandoc/Readers/Haddock/Parse.y
+++ b/src/Text/Pandoc/Readers/Haddock/Parse.y
@@ -18,6 +18,7 @@ import Data.Char (isSpace)
import Data.Maybe (fromMaybe)
import Data.List (stripPrefix)
import Data.Monoid (mempty)
+import Data.Sequence (viewr, ViewR(..))
}
%expect 0
@@ -74,7 +75,7 @@ defpara :: { (Inlines, [Blocks]) }
: '[' seq ']' seq { ($2, [plain $4]) }
para :: { Blocks }
- : seq { para $1 }
+ : seq { para' $1 }
| codepara { codeBlock $1 }
| property { $1 }
| examples { $1 }
@@ -112,7 +113,7 @@ seq1 :: { Inlines }
| elem1 { $1 }
elem1 :: { Inlines }
- : STRING { str $1 }
+ : STRING { text $1 }
| '/../' { emph (str $1) }
| URL { makeHyperlink $1 }
| PIC { image $1 $1 mempty }
@@ -128,7 +129,13 @@ strings :: { String }
happyError :: [LToken] -> Maybe a
happyError toks = Nothing
-monospace :: Inlines -> Inlines
+para' :: Inlines -> Blocks
+para' (Many ils) =
+ case viewr ils of
+ ils' :> Space -> para $ Many ils'
+ _ -> para $ Many ils
+
+monospace :: Inlines -> Inlines
monospace = everywhere (mkT go)
where
go (Str s) = Code nullAttr s