From 1855af4be596e464cac158a4c378af350198506e Mon Sep 17 00:00:00 2001
From: fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>
Date: Thu, 15 Feb 2007 02:27:36 +0000
Subject: [PATCH] Refactored str and strong in Markdown reader, for clarity.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@539 788f1e2b-df1e-0410-8736-df70ead52e1b
---
 src/Text/Pandoc/Readers/Markdown.hs | 14 +++++++++-----
 1 file 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