summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-06-30 22:23:15 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-06-30 22:23:15 +0200
commit69b2cb38a867cd8b761e4c6ec65020bedbafcda1 (patch)
treea50eebc46703821d06aa2f29bab13c3578e7a7ec
parentfa43c0feaa7c01e718626e7121f9366d09cab589 (diff)
Make `east_asian_line_breaks` affect all readers/writers.
Closes #3703.
-rw-r--r--src/Text/Pandoc/App.hs17
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs3
2 files changed, 14 insertions, 6 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs
index c119fa255..6fdd2a44c 100644
--- a/src/Text/Pandoc/App.hs
+++ b/src/Text/Pandoc/App.hs
@@ -84,7 +84,8 @@ import Text.Pandoc.PDF (makePDF)
import Text.Pandoc.Process (pipeProcess)
import Text.Pandoc.SelfContained (makeDataURI, makeSelfContained)
import Text.Pandoc.Shared (headerShift, isURI, openURL, readDataFile,
- readDataFileUTF8, safeRead, tabFilter)
+ readDataFileUTF8, safeRead, tabFilter,
+ eastAsianLineBreakFilter)
import qualified Text.Pandoc.UTF8 as UTF8
import Text.Pandoc.XML (toEntities)
import Text.Printf
@@ -381,9 +382,17 @@ convertWithOpts opts = do
"Specify an output file using the -o option."
- let transforms = case optBaseHeaderLevel opts of
- x | x > 1 -> [headerShift (x - 1)]
- | otherwise -> []
+ let transforms = (case optBaseHeaderLevel opts of
+ x | x > 1 -> (headerShift (x - 1) :)
+ | otherwise -> id) $
+ (if extensionEnabled Ext_east_asian_line_breaks
+ readerExts &&
+ not (extensionEnabled Ext_east_asian_line_breaks
+ writerExts &&
+ writerWrapText writerOptions == WrapPreserve)
+ then (eastAsianLineBreakFilter :)
+ else id)
+ []
let convertTabs = tabFilter (if optPreserveTabs opts || readerName == "t2t"
then 0
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 49007ad35..c2342b9f3 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -380,8 +380,7 @@ parseMarkdown = do
meta <- stateMeta' st
return $ Pandoc meta bs) st
reportLogMessages
- (do guardEnabled Ext_east_asian_line_breaks
- return $ eastAsianLineBreakFilter doc) <|> return doc
+ return doc
referenceKey :: PandocMonad m => MarkdownParser m (F Blocks)
referenceKey = try $ do