@@ -82,16 +82,37 @@ main = do
82 rawArgs <- map UTF8.decodeArg <$> getArgs
82 rawArgs <- map UTF8.decodeArg <$> getArgs
83 prg <- getProgName
83 prg <- getProgName
85+ let (actions, args, unrecognizedOpts, errors) =
85− let (actions, args, errors) = getOpt Permute options rawArgs
86+ getOpt' Permute options rawArgs
88+ let unknownOptionErrors = foldr addDeprecationNote [] unrecognizedOpts
87− unless (null errors) $
90+ unless (null errors && null unknownOptionErrors) $
88− err 2 $ concat $ errors ++
91+ err 2 $ concat errors ++ unlines unknownOptionErrors ++
89− ["Try " ++ prg ++ " --help for more information."]
92+ ("Try " ++ prg ++ " --help for more information.")
91 -- thread option data structure through all supplied option actions
94 -- thread option data structure through all supplied option actions
92 opts <- foldl (>>=) (return defaultOpts) actions
95 opts <- foldl (>>=) (return defaultOpts) actions
93 convertWithOpts opts args
96 convertWithOpts opts args
98+addDeprecationNote :: String -> [String] -> [String]
99+addDeprecationNote "--smart" =
100+ (("--smart has been removed. Use +smart or -smart extension instead.\n" ++
101+ "For example: pandoc -f markdown+smart -t markdown-smart.") :)
102+addDeprecationNote "-S" = addDeprecationNote "--smart"
103+addDeprecationNote "--old-dashes" =
104+ ("--old-dashes has been removed." :)
105+addDeprecationNote "--no-wrap" =
106+ ("--no-wrap has been removed. Use --wrap=none instead." :)
107+addDeprecationNote "--chapters" =
108+ ("--chapters has been removed. Use --top-level-division=chapter instead." :)
109+addDeprecationNote "--reference-docx" =
110+ ("--reference-docx has been removed. Use --reference-doc instead." :)
111+addDeprecationNote "--reference-odt" =
112+ ("--reference-odt has been removed. Use --reference-doc instead." :)
113+addDeprecationNote x =
114+ (("Unknown option " ++ x ++ ".") :)
95convertWithOpts :: Opt -> [FilePath] -> IO ()
116convertWithOpts :: Opt -> [FilePath] -> IO ()
96convertWithOpts opts args = do
117convertWithOpts opts args = do
97 let Opt { optTabStop = tabStop
118 let Opt { optTabStop = tabStop
@@ -1283,11 +1304,6 @@ options =
1286−-- TODO: possibly add code to give a more informative message
1287−-- if people try to use options that have been removed in 2.0,
1288−-- e.g. --smart/-S, --old-dashes, --no-wrap, --chapters,
1289−-- --reference-docx, --reference-odt
1291addMetadata :: String -> MetaValue -> M.Map String MetaValue
1307addMetadata :: String -> MetaValue -> M.Map String MetaValue
1292 -> M.Map String MetaValue
1308 -> M.Map String MetaValue
1293addMetadata k v m = case M.lookup k m of
1309addMetadata k v m = case M.lookup k m of