@@ -43,6 +43,7 @@ module Text.Pandoc.Shared (
43 stripFirstAndLast,
43 stripFirstAndLast,
44 camelCaseToHyphenated,
44 camelCaseToHyphenated,
45 toRomanNumeral,
45 toRomanNumeral,
46 -- * Parsing
47 -- * Parsing
@@ -98,6 +99,7 @@ module Text.Pandoc.Shared (
99import Text.Pandoc.Definition
100import Text.Pandoc.Definition
100import Text.ParserCombinators.Parsec
101import Text.ParserCombinators.Parsec
102+import Text.PrettyPrint.HughesPJ ( Doc (..), fsep )
101import Text.Pandoc.CharacterReferences ( characterReference )
103import Text.Pandoc.CharacterReferences ( characterReference )
102import Data.Char ( toLower, toUpper, ord, chr, isLower, isUpper )
104import Data.Char ( toLower, toUpper, ord, chr, isLower, isUpper )
103import Data.List ( find, groupBy, isPrefixOf, isSuffixOf )
105import Data.List ( find, groupBy, isPrefixOf, isSuffixOf )
@@ -207,6 +209,11 @@ toRomanNumeral x =
207 x | x >= 1 -> "I" ++ toRomanNumeral (x - 1)
209 x | x >= 1 -> "I" ++ toRomanNumeral (x - 1)
212+-- | Wrap inlines to line length.
213+wrapped :: Monad m => ([Inline] -> m Doc) -> [Inline] -> m Doc
214+wrapped listWriter sect = (mapM listWriter $ splitBy Space sect) >>=
211-- Parsing
218-- Parsing