Refactored str and strong in Markdown reader, for clarity.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@539 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
fiddlosopher 2007-02-15 02:27:36 +00:00
parent 87eb8be143
commit 1855af4be5

View file

@ -726,11 +726,13 @@ emph = do
return (Emph (normalizeSpaces result))
strong = do
result <- choice [ (enclosed (try (count 2 (char emphStart)))
(try (count 2 (char emphEnd))) inline),
(enclosed (try (count 2 (char emphStartAlt)))
(try (count 2 (char emphEndAlt))) inline) ]
result <- (enclosed strongStart strongEnd inline) <|>
(enclosed strongStartAlt strongEndAlt inline)
return (Strong (normalizeSpaces result))
where strongStart = count 2 (char emphStart)
strongEnd = try strongStart
strongStartAlt = count 2 (char emphStartAlt)
strongEndAlt = try strongStartAlt
smartPunctuation = do
failUnlessSmart
@ -829,8 +831,10 @@ entity = do
ent <- characterEntity
return $ Str [ent]
strChar = noneOf (specialChars ++ spaceChars ++ endLineChars)
str = do
result <- many1 ((noneOf (specialChars ++ spaceChars ++ endLineChars)))
result <- many1 strChar
return (Str result)
-- an endline character that can be treated as a space, not a structural break