aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-02-15 02:27:36 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-02-15 02:27:36 +0000
commit1855af4be596e464cac158a4c378af350198506e (patch)
tree4c355b84fa2ffd18d1c893386581c3eaee5a03ca /src
parent87eb8be14348354473f7a209be91189480f29d8a (diff)
downloadpandoc-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')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs14
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