@@ -90,11 +90,11 @@ import System.Posix.IO (stdOutput)
9090import System.Posix.Terminal (queryTerminal)
9191#endif
9292
93−data Newline = LF | CRLF deriving (Show, Generic)
93+data LineEnding = LF | CRLF | Native deriving (Show, Generic)
9494
95−instance ToJSON Newline where
95+instance ToJSON LineEnding where
9696 toEncoding = genericToEncoding defaultOptions
97−instance FromJSON Newline
97+instance FromJSON LineEnding
9898
9999parseOptions :: [OptDescr (Opt -> IO Opt)] -> Opt -> IO Opt
100100parseOptions options' defaults = do
@@ -422,9 +422,9 @@ convertWithOpts opts = do
422422 else return $ optMetadata opts
423423
424424 let eol = case optEol opts of
425− Just CRLF -> IO.CRLF
426− Just LF -> IO.LF
427− Nothing -> nativeNewline
425+ CRLF -> IO.CRLF
426+ LF -> IO.LF
427+ Native -> nativeNewline
428428
429429 runIO' $ do
430430 setResourcePath (optResourcePath opts)
@@ -584,7 +584,7 @@ data Opt = Opt
584584 , optIncludeAfterBody :: [FilePath] -- ^ Files to include after body
585585 , optIncludeInHeader :: [FilePath] -- ^ Files to include in header
586586 , optResourcePath :: [FilePath] -- ^ Path to search for images etc
587− , optEol :: Maybe Newline -- ^ Enforce line-endings
587+ , optEol :: LineEnding -- ^ Style of line-endings to use
588588 } deriving (Generic, Show)
589589
590590instance ToJSON Opt where
@@ -658,7 +658,7 @@ defaultOpts = Opt
658658 , optIncludeAfterBody = []
659659 , optIncludeInHeader = []
660660 , optResourcePath = ["."]
661− , optEol = Nothing
661+ , optEol = Native
662662 }
663663
664664addMetadata :: (String, String) -> Pandoc -> Pandoc
@@ -986,12 +986,13 @@ options =
986986 (ReqArg
987987 (\arg opt ->
988988 case toLower <$> arg of
989− "crlf" -> return opt { optEol = Just CRLF }
990− "lf" -> return opt { optEol = Just LF }
989+ "crlf" -> return opt { optEol = CRLF }
990+ "lf" -> return opt { optEol = LF }
991+ "native" -> return opt { optEol = Native }
991992 -- mac-syntax (cr) is not supported in ghc-base.
992993 _ -> E.throwIO $ PandocOptionError
993− "--eol must be one of crlf (Windows), lf (Unix)")
994− "crlf|lf")
994+ "--eol must be crlf, lf, or native")
995+ "crlf|lf|native")
995996 "" -- "EOL (default OS-dependent)"
996997
997998 , Option "" ["wrap"]