Markdown reader: allow URLs containing spaces.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1475 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
parent
1aeef232c8
commit
ddf2dc6896
1 changed files with 11 additions and 6 deletions
|
@ -32,6 +32,7 @@ module Text.Pandoc.Readers.Markdown (
|
|||
readMarkdown
|
||||
) where
|
||||
|
||||
import Control.Applicative ( (<$>) )
|
||||
import Data.List ( transpose, isPrefixOf, isSuffixOf, lookup, sortBy, findIndex, intercalate )
|
||||
import Data.Ord ( comparing )
|
||||
import Data.Char ( isAlphaNum, isAlpha, isLower, isDigit, isUpper )
|
||||
|
@ -188,8 +189,11 @@ referenceKey = try $ do
|
|||
lab <- reference
|
||||
char ':'
|
||||
skipSpaces >> optional newline >> skipSpaces >> notFollowedBy (char '[')
|
||||
src <- (char '<' >> many (noneOf "> \n\t") >>~ char '>')
|
||||
<|> many (noneOf " \n\t")
|
||||
let sourceURL excludes = concat <$>
|
||||
(many $ do optional (char '\\')
|
||||
count 1 (noneOf $ ' ':excludes)
|
||||
<|> (notFollowedBy' referenceTitle >> char ' ' >> return "%20"))
|
||||
src <- try (char '<' >> sourceURL ">\t\n" >>~ char '>') <|> sourceURL "\t\n"
|
||||
tit <- option "" referenceTitle
|
||||
blanklines
|
||||
endPos <- getPosition
|
||||
|
@ -1062,10 +1066,11 @@ source =
|
|||
source' :: GenParser Char st (String, [Char])
|
||||
source' = do
|
||||
skipSpaces
|
||||
src <- try (char '<' >>
|
||||
many (optional (char '\\') >> noneOf "> \t\n") >>~
|
||||
char '>')
|
||||
<|> many (optional (char '\\') >> noneOf " \t\n")
|
||||
let sourceURL excludes = concat <$>
|
||||
(many $ do optional (char '\\')
|
||||
count 1 (noneOf $ ' ':excludes)
|
||||
<|> (notFollowedBy' linkTitle >> char ' ' >> return "%20"))
|
||||
src <- try (char '<' >> sourceURL ">\t\n" >>~ char '>') <|> sourceURL "\t\n"
|
||||
tit <- option "" linkTitle
|
||||
skipSpaces
|
||||
eof
|
||||
|
|
Loading…
Add table
Reference in a new issue