git.iko.soy/typeable/pandoc
on master help sign in
Rewrote link parsers for greater efficiency.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@945 788f1e2b-df1e-0410-8736-df70ead52e1b

commitfcb91e8e51808450c1bc5e8c1a72a0f7782c6270 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateTue 28 Aug 2007, 22:41 (19 years ago) parente407279
1 file changed+4−7
src/Text/Pandoc/Readers/Markdown.hs+4−7
src/Text/Pandoc/Readers/Markdown.hs+4−7
@@ -818,23 +818,20 @@ title = choice [ titleWith '(' ')',
818818 titleWith '"' '"',
819819 titleWith '\'' '\''] <?> "title"
820820
821−link = choice [explicitLink, referenceLink] <?> "link"
822−
823−explicitLink = try $ do
821+link = try $ do
824822 label <- reference
825− src <- source
823+ src <- source <|> referenceLink label
826824 return $ Link label src
827825
828826-- a link like [this][ref] or [this][] or [this]
829−referenceLink = try $ do
830− label <- reference
827+referenceLink label = do
831828 ref <- option [] (try (skipSpaces >> optional newline >>
832829 skipSpaces >> reference))
833830 let ref' = if null ref then label else ref
834831 state <- getState
835832 case lookupKeySrc (stateKeys state) ref' of
836833 Nothing -> fail "no corresponding key"
837− Just target -> return (Link label target)
834+ Just target -> return target
838835
839836autoLink = autoLinkEmail <|> autoLinkRegular
840837