aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-01-19 14:16:08 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-01-19 14:16:20 +0300
commit7680e9b9642c1bade4152e4c833003688c439ca1 (patch)
treebdf0d6663cefd83d3e5a331241b7d98b38e4ad26
parent4a5801b823e1fbd3d5b208b97acce78859c45b0d (diff)
downloadpandoc-7680e9b9642c1bade4152e4c833003688c439ca1.tar.gz
Muse reader: require only one space for nested definition list indentation
-rw-r--r--src/Text/Pandoc/Readers/Muse.hs3
-rw-r--r--test/Tests/Readers/Muse.hs3
2 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs
index a23ac239c..8bef5b539 100644
--- a/src/Text/Pandoc/Readers/Muse.hs
+++ b/src/Text/Pandoc/Readers/Muse.hs
@@ -469,8 +469,9 @@ orderedList = try $ do
definitionListItem :: PandocMonad m => MuseParser m (F (Inlines, [Blocks]))
definitionListItem = try $ do
- guardDisabled Ext_amuse <|> void spaceChar -- Initial space is required by Amusewiki, but not Emacs Muse
many spaceChar
+ startPos <- getPosition
+ (guardDisabled Ext_amuse) <|> (guard (sourceColumn startPos /= 1)) -- Initial space is required by Amusewiki, but not Emacs Muse
pos <- getPosition
term <- trimInlinesF . mconcat <$> manyTill (choice inlineList) (string "::")
void spaceChar <|> lookAhead eol
diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs
index 198b95fc5..6cadd45bc 100644
--- a/test/Tests/Readers/Muse.hs
+++ b/test/Tests/Readers/Muse.hs
@@ -960,6 +960,9 @@ tests =
definitionList [ ("Term1", [ para "This is a first definition\nAnd it has two lines;\nno, make that three."])
, ("Term2", [ para "This is a second definition"])
])
+ , "Nested definition list" =:
+ " Foo :: bar :: baz" =?>
+ definitionList [ ("Foo", [ definitionList [ ("bar", [ para "baz" ])]])]
, "Two blank lines separate definition lists" =:
T.unlines
[ " First :: list"