git.iko.soy/typeable/pandoc
on master help sign in
Refactored str and strong in Markdown reader, for clarity.

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

commit1855af4be596e464cac158a4c378af350198506e authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateThu 15 Feb 2007, 02:27 (20 years ago) parent87eb8be
1 file changed+9−5
src/Text/Pandoc/Readers/Markdown.hs+9−5
src/Text/Pandoc/Readers/Markdown.hs+9−5
@@ -726,11 +726,13 @@ emph = do
726726 return (Emph (normalizeSpaces result))
727727
728728strong = do
729− result <- choice [ (enclosed (try (count 2 (char emphStart)))
730− (try (count 2 (char emphEnd))) inline),
731− (enclosed (try (count 2 (char emphStartAlt)))
732− (try (count 2 (char emphEndAlt))) inline) ]
729+ result <- (enclosed strongStart strongEnd inline) <|>
730+ (enclosed strongStartAlt strongEndAlt inline)
733731 return (Strong (normalizeSpaces result))
732+ where strongStart = count 2 (char emphStart)
733+ strongEnd = try strongStart
734+ strongStartAlt = count 2 (char emphStartAlt)
735+ strongEndAlt = try strongStartAlt
734736
735737smartPunctuation = do
736738 failUnlessSmart
@@ -829,8 +831,10 @@ entity = do
829831 ent <- characterEntity
830832 return $ Str [ent]
831833
834+strChar = noneOf (specialChars ++ spaceChars ++ endLineChars)
835+
832836str = do
833− result <- many1 ((noneOf (specialChars ++ spaceChars ++ endLineChars)))
837+ result <- many1 strChar
834838 return (Str result)
835839
836840-- an endline character that can be treated as a space, not a structural break