diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-02-15 02:27:36 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-02-15 02:27:36 +0000 |
commit | 1855af4be596e464cac158a4c378af350198506e (patch) | |
tree | 4c355b84fa2ffd18d1c893386581c3eaee5a03ca /src/Text/Pandoc/Readers/Markdown.hs | |
parent | 87eb8be14348354473f7a209be91189480f29d8a (diff) | |
download | pandoc-1855af4be596e464cac158a4c378af350198506e.tar.gz |
Refactored str and strong in Markdown reader, for clarity.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@539 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Readers/Markdown.hs')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 3b2cdcdf5..8fd256c4f 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -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 |