git.iko.soy/typeable/pandoc
on master help sign in
Muse writer: join strings during inline normalization
9dbd59aAlexander Krotov
src/Text/Pandoc/Writers/Muse.hs+2
@@ -294,6 +294,8 @@ conditionalEscapeString s =
294normalizeInlineList :: [Inline] -> [Inline]
294normalizeInlineList :: [Inline] -> [Inline]
295normalizeInlineList (x : Str "" : xs)
295normalizeInlineList (x : Str "" : xs)
296 = normalizeInlineList (x:xs)
296 = normalizeInlineList (x:xs)
297+normalizeInlineList (Str x1 : Str x2 : xs)
298+ = normalizeInlineList $ Str (x1 ++ x2) : xs
297normalizeInlineList (Emph x1 : Emph x2 : ils)
299normalizeInlineList (Emph x1 : Emph x2 : ils)
298 = normalizeInlineList $ Emph (x1 ++ x2) : ils
300 = normalizeInlineList $ Emph (x1 ++ x2) : ils
299normalizeInlineList (Strong x1 : Strong x2 : ils)
301normalizeInlineList (Strong x1 : Strong x2 : ils)
test/Tests/Writers/Muse.hs+1
@@ -297,6 +297,7 @@ tests = [ testGroup "block elements"
297 , "escape hash to avoid accidental anchors" =: text "#foo bar"
297 , "escape hash to avoid accidental anchors" =: text "#foo bar"
298 =?> "<verbatim>#foo</verbatim> bar"
298 =?> "<verbatim>#foo</verbatim> bar"
299 , "escape definition list markers" =: str "::" =?> "<verbatim>::</verbatim>"
299 , "escape definition list markers" =: str "::" =?> "<verbatim>::</verbatim>"
300+ , "normalize strings before escaping" =: fromList [Str ":", Str ":"] =?> "<verbatim>::</verbatim>"
300 -- We don't want colons to be escaped if they can't be confused
301 -- We don't want colons to be escaped if they can't be confused
301 -- with definition list item markers.
302 -- with definition list item markers.
302 , "do not escape colon" =: str ":" =?> ":"
303 , "do not escape colon" =: str ":" =?> ":"