aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2017-11-19 04:26:45 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2017-11-19 04:40:00 +0300
commit82bcda80c6e8b9e6e4e6c707569df4f9022b042f (patch)
tree3866404706c67c9e09129541eb963646e3ce293e
parent163af3fdee3c09234436ea7aab84a8b29ec1cece (diff)
downloadpandoc-82bcda80c6e8b9e6e4e6c707569df4f9022b042f.tar.gz
Muse reader: count only one space as part of list item marker
-rw-r--r--src/Text/Pandoc/Readers/Muse.hs4
-rw-r--r--test/Tests/Readers/Muse.hs58
2 files changed, 38 insertions, 24 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs
index 4510e08ce..d54019777 100644
--- a/src/Text/Pandoc/Readers/Muse.hs
+++ b/src/Text/Pandoc/Readers/Muse.hs
@@ -392,8 +392,8 @@ listStart marker = try $ do
st <- stateParserContext <$> getState
getPosition >>= \pos -> guard (st == ListItemState || sourceColumn pos /= 1)
markerLength <- marker
- postWhitespace <- length <$> many1 spaceChar
- return $ preWhitespace + markerLength + postWhitespace
+ many1 spaceChar
+ return $ preWhitespace + markerLength + 1
listItemContents :: PandocMonad m => Int -> MuseParser m (F Blocks)
listItemContents markerLength = do
diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs
index 3011df648..c76013b90 100644
--- a/test/Tests/Readers/Muse.hs
+++ b/test/Tests/Readers/Muse.hs
@@ -527,28 +527,42 @@ tests =
orderedListWith (1, Decimal, Period) [ para "Item1"
, para "Item2"
]
- , "Nested list" =:
- T.unlines
- [ " - Item1"
- , " - Item2"
- , " - Item3"
- , " - Item4"
- , " 1. Nested"
- , " 2. Ordered"
- , " 3. List"
- ] =?>
- bulletList [ mconcat [ para "Item1"
- , bulletList [ para "Item2"
- , para "Item3"
- ]
- ]
- , mconcat [ para "Item4"
- , orderedListWith (1, Decimal, Period) [ para "Nested"
- , para "Ordered"
- , para "List"
- ]
- ]
- ]
+ , testGroup "Nested lists"
+ [ "Nested list" =:
+ T.unlines
+ [ " - Item1"
+ , " - Item2"
+ , " - Item3"
+ , " - Item4"
+ , " 1. Nested"
+ , " 2. Ordered"
+ , " 3. List"
+ ] =?>
+ bulletList [ mconcat [ para "Item1"
+ , bulletList [ para "Item2"
+ , para "Item3"
+ ]
+ ]
+ , mconcat [ para "Item4"
+ , orderedListWith (1, Decimal, Period) [ para "Nested"
+ , para "Ordered"
+ , para "List"
+ ]
+ ]
+ ]
+ , "Incorrectly indented Text::Amuse nested list" =:
+ T.unlines
+ [ " - First item"
+ , " - Not nested item"
+ ] =?>
+ bulletList [ para "First item", para "Not nested item"]
+ , "Text::Amuse includes only one space in list marker" =:
+ T.unlines
+ [ " - First item"
+ , " - Nested item"
+ ] =?>
+ bulletList [ para "First item" <> bulletList [ para "Nested item"]]
+ ]
, "List continuation" =:
T.unlines
[ " - a"