From 31c030e3a55c3bc9d4a606e9658dd30a9aa1c938 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sat, 3 Mar 2007 18:19:31 +0000 Subject: Added --inline-links option to force links in HTML to be parsed as inline links, rather than reference links. (Addresses Issue #4.) git-svn-id: https://pandoc.googlecode.com/svn/trunk@554 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Main.hs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index 275a89f0d..0bb246fa5 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -118,6 +118,7 @@ data Opt = Opt , optDumpArgs :: Bool -- ^ Output command-line arguments , optIgnoreArgs :: Bool -- ^ Ignore command-line arguments , optStrict :: Bool -- ^ Use strict markdown syntax + , optInlineLinks :: Bool -- ^ Use inline links in parsing HTML } -- | Defaults for command-line options. @@ -143,6 +144,7 @@ defaultOpts = Opt , optDumpArgs = False , optIgnoreArgs = False , optStrict = False + , optInlineLinks = False } -- | A list of functions, each transforming the options data structure @@ -188,6 +190,11 @@ options = (\opt -> return opt { optStrict = True } )) "" -- "Use strict markdown syntax with no extensions" + , Option "" ["inline-links"] + (NoArg + (\opt -> return opt { optInlineLinks = True } )) + "" -- "Use inline links in parsing HTML" + , Option "R" ["parse-raw"] (NoArg (\opt -> return opt { optParseRaw = True })) @@ -398,6 +405,7 @@ main = do , optDumpArgs = dumpArgs , optIgnoreArgs = ignoreArgs , optStrict = strict + , optInlineLinks = inlineLinks } = opts if dumpArgs @@ -440,12 +448,13 @@ main = do 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), - stateSmart = smart || writerName' == "latex", - stateColumns = columns, - stateStrict = strict } + defaultParserState { stateParseRaw = parseRaw, + stateTabStop = tabStop, + stateStandalone = standalone && (not strict), + stateSmart = smart || writerName' == "latex", + stateColumns = columns, + stateStrict = strict, + stateInlineLinks = inlineLinks } let csslink = if (css == "") then "" else "