mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-01 15:38:09 +08:00
Rollback parameterize options on scripting engine.
Rolls back 0ab014ed1e.
We don't need this because we aren't needing to print the Lua
version in options any more; we're handling `--version` now at
the pandoc-cli level.
This commit is contained in:
@@ -62,8 +62,7 @@ main = E.handle (handleError . Left) $ do
|
||||
"server": args -> runServer args
|
||||
_ -> do
|
||||
engine <- getEngine
|
||||
let cliOpts = options engine
|
||||
opts <- parseOptionsFromArgs cliOpts defaultOpts prg rawArgs
|
||||
opts <- parseOptionsFromArgs options defaultOpts prg rawArgs
|
||||
convertWithOpts engine opts
|
||||
|
||||
copyrightMessage :: String
|
||||
|
||||
@@ -52,7 +52,6 @@ import Text.Pandoc.App.Opt (Opt (..), LineEnding (..), IpynbOutput (..),
|
||||
fullDefaultsPath)
|
||||
import Text.Pandoc.Filter (Filter (..))
|
||||
import Text.Pandoc.Highlighting (highlightingStyles, lookupHighlightingStyle)
|
||||
import Text.Pandoc.Scripting (ScriptingEngine (engineName))
|
||||
import Text.Pandoc.Shared (ordNub, elemText, safeStrRead, defaultUserDataDir)
|
||||
import Text.Printf
|
||||
import qualified Control.Exception as E
|
||||
@@ -122,8 +121,8 @@ pdfEngines = ordNub $ map snd engines
|
||||
|
||||
-- | A list of functions, each transforming the options data structure
|
||||
-- in response to a command-line option.
|
||||
options :: ScriptingEngine -> [OptDescr (Opt -> IO Opt)]
|
||||
options scriptingEngine =
|
||||
options :: [OptDescr (Opt -> IO Opt)]
|
||||
options =
|
||||
[ Option "fr" ["from","read"]
|
||||
(ReqArg
|
||||
(\arg opt -> return opt { optFrom =
|
||||
@@ -805,8 +804,7 @@ options scriptingEngine =
|
||||
let optnames (Option shorts longs _ _) =
|
||||
map (\c -> ['-',c]) shorts ++
|
||||
map ("--" ++) longs
|
||||
let allopts = unwords (concatMap optnames
|
||||
(options scriptingEngine))
|
||||
let allopts = unwords (concatMap optnames options)
|
||||
UTF8.hPutStrLn stdout $ T.pack $ printf tpl allopts
|
||||
(T.unpack $ T.unwords readersNames)
|
||||
(T.unpack $ T.unwords writersNames)
|
||||
@@ -941,8 +939,7 @@ options scriptingEngine =
|
||||
UTF8.hPutStrLn stdout
|
||||
$ T.pack
|
||||
$ prg ++ " " ++ T.unpack pandocVersionText ++
|
||||
compileInfo ++ "\nScripting engine: " ++
|
||||
T.unpack (engineName scriptingEngine) ++
|
||||
compileInfo ++
|
||||
"\nUser data directory: " ++ defaultDatadir ++
|
||||
('\n':copyrightMessage)
|
||||
exitSuccess ))
|
||||
@@ -952,8 +949,7 @@ options scriptingEngine =
|
||||
(NoArg
|
||||
(\_ -> do
|
||||
prg <- getProgName
|
||||
UTF8.hPutStr stdout (T.pack $ usageMessage prg
|
||||
(options scriptingEngine))
|
||||
UTF8.hPutStr stdout (T.pack $ usageMessage prg options)
|
||||
exitSuccess ))
|
||||
"" -- "Show help"
|
||||
]
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ main = do
|
||||
case args of
|
||||
"--emulate":args' -> -- emulate pandoc executable
|
||||
E.catch
|
||||
(parseOptionsFromArgs (options noEngine) defaultOpts "pandoc" args'
|
||||
(parseOptionsFromArgs options defaultOpts "pandoc" args'
|
||||
>>= convertWithOpts noEngine)
|
||||
(handleError . Left)
|
||||
_ -> inDirectory "test" $ do
|
||||
|
||||
Reference in New Issue
Block a user