git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: trim whitespace before parsing grid table cells
commit367e8cac18924f8cd9898f84f25c56bd2ae3b744 authorAlexander Krotov <ilabdsf@gmail.com> dateWed 14 Nov 2018, 19:17 (8 years ago) parentc61b674
2 files changed+13−2
src/Text/Pandoc/Readers/Muse.hs+2−2 test/Tests/Readers/Muse.hs+11
src/Text/Pandoc/Readers/Muse.hs+2−2
@@ -56,7 +56,7 @@ import Text.Pandoc.Error (PandocError (PandocParsecError))
5656import Text.Pandoc.Logging
5757import Text.Pandoc.Options
5858import Text.Pandoc.Parsing hiding (F)
59−import Text.Pandoc.Shared (crFilter, underlineSpan)
59+import Text.Pandoc.Shared (crFilter, trimr, underlineSpan)
6060
6161-- | Read Muse from an input string and return a Pandoc document.
6262readMuse :: PandocMonad m
@@ -692,7 +692,7 @@ museGridTableRow :: PandocMonad m
692692 -> MuseParser m (F [Blocks])
693693museGridTableRow indent indices = try $ do
694694 lns <- many1 $ try (indentWith indent *> museGridTableRawLine indices)
695− let cols = map unlines $ transpose lns
695+ let cols = map (unlines . map trimr) $ transpose lns
696696 indentWith indent *> museGridTableHeader
697697 sequence <$> mapM (parseFromString parseBlocks) cols
698698
test/Tests/Readers/Muse.hs+11
@@ -1019,6 +1019,17 @@ tests =
10191019 [[table mempty [(AlignDefault, 0.0)]
10201020 []
10211021 [[para "foo"]]]]
1022+ , "Grid table with example" =:
1023+ T.unlines
1024+ [ "+------------+"
1025+ , "| <example> |"
1026+ , "| foo |"
1027+ , "| </example> |"
1028+ , "+------------+"
1029+ ] =?>
1030+ table mempty [(AlignDefault, 0.0)]
1031+ []
1032+ [[codeBlock "foo"]]
10221033 ]
10231034 , testGroup "Lists"
10241035 [ "Bullet list" =: