git.iko.soy/typeable/pandoc
on master help sign in
Refactored str and strong in Markdown reader, for clarity.
1855af4fiddlosopher
src/Text/Pandoc/Readers/Markdown.hs+9−5
@@ -726,11 +726,13 @@ emph = do
726 return (Emph (normalizeSpaces result))
726 return (Emph (normalizeSpaces result))
727
727
728strong = do
728strong = do
729− result <- choice [ (enclosed (try (count 2 (char emphStart)))
729+ result <- (enclosed strongStart strongEnd inline) <|>
730− (try (count 2 (char emphEnd))) inline),
730+ (enclosed strongStartAlt strongEndAlt inline)
731− (enclosed (try (count 2 (char emphStartAlt)))
732− (try (count 2 (char emphEndAlt))) inline) ]
733 return (Strong (normalizeSpaces result))
731 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
734
736
735smartPunctuation = do
737smartPunctuation = do
736 failUnlessSmart
738 failUnlessSmart
@@ -829,8 +831,10 @@ entity = do
829 ent <- characterEntity
831 ent <- characterEntity
830 return $ Str [ent]
832 return $ Str [ent]
831
833
834+strChar = noneOf (specialChars ++ spaceChars ++ endLineChars)
835+
832str = do
836str = do
833− result <- many1 ((noneOf (specialChars ++ spaceChars ++ endLineChars)))
837+ result <- many1 strChar
834 return (Str result)
838 return (Str result)
835
839
836-- an endline character that can be treated as a space, not a structural break
840-- an endline character that can be treated as a space, not a structural break