git.iko.soy/typeable/pandoc
on master help sign in
Make `east_asian_line_breaks` affect all readers/writers.

Closes #3703.

commit69b2cb38a867cd8b761e4c6ec65020bedbafcda1 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 30 Jun 2017, 22:23 (9 years ago) parentfa43c0f
2 files changed+14−6
src/Text/Pandoc/App.hs+13−4 src/Text/Pandoc/Readers/Markdown.hs+1−2
src/Text/Pandoc/App.hs+13−4
@@ -84,7 +84,8 @@ import Text.Pandoc.PDF (makePDF)
8484import Text.Pandoc.Process (pipeProcess)
8585import Text.Pandoc.SelfContained (makeDataURI, makeSelfContained)
8686import Text.Pandoc.Shared (headerShift, isURI, openURL, readDataFile,
87− readDataFileUTF8, safeRead, tabFilter)
87+ readDataFileUTF8, safeRead, tabFilter,
88+ eastAsianLineBreakFilter)
8889import qualified Text.Pandoc.UTF8 as UTF8
8990import Text.Pandoc.XML (toEntities)
9091import Text.Printf
@@ -381,9 +382,17 @@ convertWithOpts opts = do
381382 "Specify an output file using the -o option."
382383
383384
384− let transforms = case optBaseHeaderLevel opts of
385− x | x > 1 -> [headerShift (x - 1)]
386− | otherwise -> []
385+ let transforms = (case optBaseHeaderLevel opts of
386+ x | x > 1 -> (headerShift (x - 1) :)
387+ | otherwise -> id) $
388+ (if extensionEnabled Ext_east_asian_line_breaks
389+ readerExts &&
390+ not (extensionEnabled Ext_east_asian_line_breaks
391+ writerExts &&
392+ writerWrapText writerOptions == WrapPreserve)
393+ then (eastAsianLineBreakFilter :)
394+ else id)
395+ []
387396
388397 let convertTabs = tabFilter (if optPreserveTabs opts || readerName == "t2t"
389398 then 0
src/Text/Pandoc/Readers/Markdown.hs+1−2
@@ -380,8 +380,7 @@ parseMarkdown = do
380380 meta <- stateMeta' st
381381 return $ Pandoc meta bs) st
382382 reportLogMessages
383− (do guardEnabled Ext_east_asian_line_breaks
384− return $ eastAsianLineBreakFilter doc) <|> return doc
383+ return doc
385384
386385referenceKey :: PandocMonad m => MarkdownParser m (F Blocks)
387386referenceKey = try $ do