Muse reader: trim whitespace before parsing grid table cells
This commit is contained in:
parent
c61b67410a
commit
367e8cac18
2 changed files with 13 additions and 2 deletions
|
@ -56,7 +56,7 @@ import Text.Pandoc.Error (PandocError (PandocParsecError))
|
||||||
import Text.Pandoc.Logging
|
import Text.Pandoc.Logging
|
||||||
import Text.Pandoc.Options
|
import Text.Pandoc.Options
|
||||||
import Text.Pandoc.Parsing hiding (F)
|
import Text.Pandoc.Parsing hiding (F)
|
||||||
import Text.Pandoc.Shared (crFilter, underlineSpan)
|
import Text.Pandoc.Shared (crFilter, trimr, underlineSpan)
|
||||||
|
|
||||||
-- | Read Muse from an input string and return a Pandoc document.
|
-- | Read Muse from an input string and return a Pandoc document.
|
||||||
readMuse :: PandocMonad m
|
readMuse :: PandocMonad m
|
||||||
|
@ -692,7 +692,7 @@ museGridTableRow :: PandocMonad m
|
||||||
-> MuseParser m (F [Blocks])
|
-> MuseParser m (F [Blocks])
|
||||||
museGridTableRow indent indices = try $ do
|
museGridTableRow indent indices = try $ do
|
||||||
lns <- many1 $ try (indentWith indent *> museGridTableRawLine indices)
|
lns <- many1 $ try (indentWith indent *> museGridTableRawLine indices)
|
||||||
let cols = map unlines $ transpose lns
|
let cols = map (unlines . map trimr) $ transpose lns
|
||||||
indentWith indent *> museGridTableHeader
|
indentWith indent *> museGridTableHeader
|
||||||
sequence <$> mapM (parseFromString parseBlocks) cols
|
sequence <$> mapM (parseFromString parseBlocks) cols
|
||||||
|
|
||||||
|
|
|
@ -1019,6 +1019,17 @@ tests =
|
||||||
[[table mempty [(AlignDefault, 0.0)]
|
[[table mempty [(AlignDefault, 0.0)]
|
||||||
[]
|
[]
|
||||||
[[para "foo"]]]]
|
[[para "foo"]]]]
|
||||||
|
, "Grid table with example" =:
|
||||||
|
T.unlines
|
||||||
|
[ "+------------+"
|
||||||
|
, "| <example> |"
|
||||||
|
, "| foo |"
|
||||||
|
, "| </example> |"
|
||||||
|
, "+------------+"
|
||||||
|
] =?>
|
||||||
|
table mempty [(AlignDefault, 0.0)]
|
||||||
|
[]
|
||||||
|
[[codeBlock "foo"]]
|
||||||
]
|
]
|
||||||
, testGroup "Lists"
|
, testGroup "Lists"
|
||||||
[ "Bullet list" =:
|
[ "Bullet list" =:
|
||||||
|
|
Loading…
Add table
Reference in a new issue