git.iko.soy/typeable/pandoc
on master help sign in
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

commitb9eeba9aa2c8bc5c24f9c1fa5d05ba29e358276b authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateTue 2 Jan 2007, 07:37 (20 years ago) parent17be8bc
1 file changed+18−7
src/Main.hs+18−7
src/Main.hs+18−7
@@ -342,7 +342,12 @@ defaultWriterName x =
342342main = do
343343
344344 args <- getArgs
345− let (actions, sources, errors) = getOpt Permute options args
345+ prg <- getProgName
346+ let compatMode = (prg == "hsmarkdown")
347+
348+ let (actions, sources, errors) = if compatMode
349+ then ([], args, [])
350+ else getOpt Permute options args
346351
347352 if (not (null errors))
348353 then do
@@ -353,8 +358,14 @@ main = do
353358 else
354359 return ()
355360
361+ let defaultOpts' = if compatMode
362+ then defaultOpts { optReader = "markdown"
363+ , optWriter = "html"
364+ , optStrict = True }
365+ else defaultOpts
366+
356367 -- thread option data structure through all supplied option actions
357− opts <- foldl (>>=) (return defaultOpts) actions
368+ opts <- foldl (>>=) (return defaultOpts') actions
358369
359370 let Opt { optPreserveTabs = preserveTabs
360371 , optTabStop = tabStop
@@ -408,11 +419,11 @@ main = do
408419 let addBlank str = str ++ "\n\n"
409420 let removeCRs str = filter (/= '\r') str -- remove DOS-style line endings
410421 let filter = tabFilter . addBlank . removeCRs
411− let startParserState = defaultParserState { stateParseRaw = parseRaw,
412− stateTabStop = tabStop,
413− stateStandalone = standalone &&
414− (not strict),
415− stateStrict = strict }
422+ let startParserState =
423+ defaultParserState { stateParseRaw = parseRaw,
424+ stateTabStop = tabStop,
425+ stateStandalone = standalone && (not strict),
426+ stateStrict = strict }
416427 let csslink = if (css == "")
417428 then ""
418429 else "<link rel=\"stylesheet\" href=\"" ++ css ++