From 77af25b4c3297cdd011a4c3c2755ffcac9807b7d Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Fri, 24 Nov 2017 14:02:43 +0300 Subject: Muse reader: parse markup in definition list terms --- src/Text/Pandoc/Readers/Muse.hs | 6 ++++-- test/Tests/Readers/Muse.hs | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs index 6599ba059..c6a66a1ed 100644 --- a/src/Text/Pandoc/Readers/Muse.hs +++ b/src/Text/Pandoc/Readers/Muse.hs @@ -442,7 +442,8 @@ orderedList = try $ do definitionListItem :: PandocMonad m => MuseParser m (F (Inlines, [Blocks])) definitionListItem = try $ do - term <- termParser + rawTerm <- termParser + term <- parseFromString (trimInlinesF . mconcat <$> many inline) rawTerm many1 spaceChar string "::" firstLine <- many $ noneOf "\n" @@ -450,7 +451,8 @@ definitionListItem = try $ do let lns = firstLine : restLines lineContent <- parseFromString (withListContext parseBlocks) $ concat lns ++ "\n" pure $ do lineContent' <- lineContent - pure (B.text term, [lineContent']) + term' <- term + pure (term', [lineContent']) where termParser = (guardDisabled Ext_amuse <|> void spaceChar) >> -- Initial space is required by Amusewiki, but not Emacs Muse many spaceChar >> diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs index 3d5ad1fb9..aa35e6063 100644 --- a/test/Tests/Readers/Muse.hs +++ b/test/Tests/Readers/Muse.hs @@ -756,6 +756,8 @@ tests = definitionList [ ("Bar", [ para "baz" ]) ] , "One-line definition list" =: " foo :: bar" =?> definitionList [ ("foo", [ para "bar" ]) ] + , "Definition list term with emphasis" =: " *Foo* :: bar\n" =?> + definitionList [ (emph "Foo", [ para "bar" ]) ] , "Multi-line definition lists" =: T.unlines [ " First term :: Definition of first term" -- cgit v1.2.3