diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-09-27 01:23:44 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-09-27 01:23:44 +0000 |
commit | 5b888e8b3be01aebb8ecf7ba4ebee61d2a3d3f31 (patch) | |
tree | 6e6d4dce4443d0bc0e8e6bf8ebeb10b28ea3cb81 /src/Text/Pandoc/Shared.hs | |
parent | fa45b970c9b9e748728b58e9471e52139b770570 (diff) | |
download | pandoc-5b888e8b3be01aebb8ecf7ba4ebee61d2a3d3f31.tar.gz |
Added a writer option for wrapped text and a command-line option
'--no-wrap', which disables text wrapping. (Resolves Issue #26.)
+ Added support for '--no-wrap' to Main.hs.
+ Added wrapIfNeeded function to Text.Pandoc.Shared.
+ Use wrapIfNeeded instead of wrapped in the RST, Man, Docbook, and
Markdown writers.
+ Note: Not yet implemented in HTML, LaTeX, or ConTeXt writers.
No documentation yet.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1034 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Shared.hs')
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 397e681ea..553a93f28 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -44,6 +44,7 @@ module Text.Pandoc.Shared ( camelCaseToHyphenated, toRomanNumeral, wrapped, + wrapIfNeeded, -- * Parsing (>>~), anyLine, @@ -210,6 +211,12 @@ wrapped :: Monad m => ([Inline] -> m Doc) -> [Inline] -> m Doc wrapped listWriter sect = (mapM listWriter $ splitBy Space sect) >>= return . fsep +wrapIfNeeded :: Monad m => WriterOptions -> ([Inline] -> m Doc) -> + [Inline] -> m Doc +wrapIfNeeded opts = if writerWrapText opts + then wrapped + else ($) + -- -- Parsing -- @@ -760,23 +767,26 @@ data WriterOptions = WriterOptions , writerIncludeAfter :: String -- ^ String to include after the body , writerStrictMarkdown :: Bool -- ^ Use strict markdown syntax , writerReferenceLinks :: Bool -- ^ Use reference links in writing markdown, rst + , writerWrapText :: Bool -- ^ Wrap text to line length } deriving Show -- | Default writer options. defaultWriterOptions :: WriterOptions defaultWriterOptions = - WriterOptions { writerStandalone = False, - writerHeader = "", - writerTitlePrefix = "", - writerTabStop = 4, - writerTableOfContents = False, - writerS5 = False, - writerUseASCIIMathML = False, - writerASCIIMathMLURL = Nothing, - writerIgnoreNotes = False, - writerIncremental = False, - writerNumberSections = False, - writerIncludeBefore = "", - writerIncludeAfter = "", - writerStrictMarkdown = False, - writerReferenceLinks = False } + WriterOptions { writerStandalone = False + , writerHeader = "" + , writerTitlePrefix = "" + , writerTabStop = 4 + , writerTableOfContents = False + , writerS5 = False + , writerUseASCIIMathML = False + , writerASCIIMathMLURL = Nothing + , writerIgnoreNotes = False + , writerIncremental = False + , writerNumberSections = False + , writerIncludeBefore = "" + , writerIncludeAfter = "" + , writerStrictMarkdown = False + , writerReferenceLinks = False + , writerWrapText = True + } |