@@ -44,6 +44,7 @@ module Text.Pandoc.Shared (
4444 camelCaseToHyphenated,
4545 toRomanNumeral,
4646 wrapped,
47+ wrapIfNeeded,
4748 -- * Parsing
4849 (>>~),
4950 anyLine,
@@ -210,6 +211,12 @@ wrapped :: Monad m => ([Inline] -> m Doc) -> [Inline] -> m Doc
210211wrapped listWriter sect = (mapM listWriter $ splitBy Space sect) >>=
211212 return . fsep
212213
214+wrapIfNeeded :: Monad m => WriterOptions -> ([Inline] -> m Doc) ->
215+ [Inline] -> m Doc
216+wrapIfNeeded opts = if writerWrapText opts
217+ then wrapped
218+ else ($)
219+
213220--
214221-- Parsing
215222--
@@ -760,23 +767,26 @@ data WriterOptions = WriterOptions
760767 , writerIncludeAfter :: String -- ^ String to include after the body
761768 , writerStrictMarkdown :: Bool -- ^ Use strict markdown syntax
762769 , writerReferenceLinks :: Bool -- ^ Use reference links in writing markdown, rst
770+ , writerWrapText :: Bool -- ^ Wrap text to line length
763771 } deriving Show
764772
765773-- | Default writer options.
766774defaultWriterOptions :: WriterOptions
767775defaultWriterOptions =
768− WriterOptions { writerStandalone = False,
769− writerHeader = "",
770− writerTitlePrefix = "",
771− writerTabStop = 4,
772− writerTableOfContents = False,
773− writerS5 = False,
774− writerUseASCIIMathML = False,
775− writerASCIIMathMLURL = Nothing,
776− writerIgnoreNotes = False,
777− writerIncremental = False,
778− writerNumberSections = False,
779− writerIncludeBefore = "",
780− writerIncludeAfter = "",
781− writerStrictMarkdown = False,
782− writerReferenceLinks = False }
776+ WriterOptions { writerStandalone = False
777+ , writerHeader = ""
778+ , writerTitlePrefix = ""
779+ , writerTabStop = 4
780+ , writerTableOfContents = False
781+ , writerS5 = False
782+ , writerUseASCIIMathML = False
783+ , writerASCIIMathMLURL = Nothing
784+ , writerIgnoreNotes = False
785+ , writerIncremental = False
786+ , writerNumberSections = False
787+ , writerIncludeBefore = ""
788+ , writerIncludeAfter = ""
789+ , writerStrictMarkdown = False
790+ , writerReferenceLinks = False
791+ , writerWrapText = True
792+ }