Modified main 'pandoc' program so that if it is called with program

name = 'hsmarkdown' (e.g. through a symlink, on a system with real
symbolic links), it will translate markdown to HTML in strict mode
and interpret all command-line options as arguments, like Markdown.pl.


git-svn-id: https://pandoc.googlecode.com/svn/trunk@405 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
fiddlosopher 2007-01-02 07:37:42 +00:00
parent 17be8bc257
commit b9eeba9aa2

View file

@ -342,7 +342,12 @@ defaultWriterName x =
main = do
args <- getArgs
let (actions, sources, errors) = getOpt Permute options args
prg <- getProgName
let compatMode = (prg == "hsmarkdown")
let (actions, sources, errors) = if compatMode
then ([], args, [])
else getOpt Permute options args
if (not (null errors))
then do
@ -353,8 +358,14 @@ main = do
else
return ()
let defaultOpts' = if compatMode
then defaultOpts { optReader = "markdown"
, optWriter = "html"
, optStrict = True }
else defaultOpts
-- thread option data structure through all supplied option actions
opts <- foldl (>>=) (return defaultOpts) actions
opts <- foldl (>>=) (return defaultOpts') actions
let Opt { optPreserveTabs = preserveTabs
, optTabStop = tabStop
@ -408,11 +419,11 @@ main = do
let addBlank str = str ++ "\n\n"
let removeCRs str = filter (/= '\r') str -- remove DOS-style line endings
let filter = tabFilter . addBlank . removeCRs
let startParserState = defaultParserState { stateParseRaw = parseRaw,
stateTabStop = tabStop,
stateStandalone = standalone &&
(not strict),
stateStrict = strict }
let startParserState =
defaultParserState { stateParseRaw = parseRaw,
stateTabStop = tabStop,
stateStandalone = standalone && (not strict),
stateStrict = strict }
let csslink = if (css == "")
then ""
else "<link rel=\"stylesheet\" href=\"" ++ css ++