aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-09-11 03:50:59 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-09-11 04:15:32 +0300
commitc899b4e89dcd61f91f7383e2a81a13ef0da080b8 (patch)
treefefc02dd7bfacefb89be6479354c7acd4a13c4e4
parentce6042fb20fb032da8adf0779e240590f304e243 (diff)
downloadpandoc-c899b4e89dcd61f91f7383e2a81a13ef0da080b8.tar.gz
Muse writer: escape list markers in the beginning of notes
-rw-r--r--src/Text/Pandoc/Writers/Muse.hs5
-rw-r--r--test/Tests/Writers/Muse.hs6
2 files changed, 10 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs
index 7dbe3a53f..413b71659 100644
--- a/src/Text/Pandoc/Writers/Muse.hs
+++ b/src/Text/Pandoc/Writers/Muse.hs
@@ -292,7 +292,10 @@ noteToMuse :: PandocMonad m
-> [Block]
-> Muse m Doc
noteToMuse num note =
- hang (length marker) (text marker) <$> blockListToMuse note
+ hang (length marker) (text marker) <$>
+ (local (\env -> env { envInlineStart = True
+ , envAfterSpace = True
+ }) $ blockListToMuse note)
where
marker = "[" ++ show num ++ "] "
diff --git a/test/Tests/Writers/Muse.hs b/test/Tests/Writers/Muse.hs
index 776884760..7821f4e96 100644
--- a/test/Tests/Writers/Muse.hs
+++ b/test/Tests/Writers/Muse.hs
@@ -348,6 +348,12 @@ tests = [ testGroup "block elements"
, ""
, " <verbatim></verbatim>- bar"
]
+ , "escape - inside a note" =:
+ note (para (text "- foo")) =?>
+ unlines [ "[1]"
+ , ""
+ , "[1] <verbatim></verbatim>- foo"
+ ]
, "escape ; to avoid accidental comments" =: text "; foo" =?> "<verbatim></verbatim>; foo"
, "escape ; after softbreak" =: text "foo" <> softbreak <> text "; bar" =?> "foo\n<verbatim></verbatim>; bar"
, "escape ; after linebreak" =: text "foo" <> linebreak <> text "; bar" =?> "foo<br>\n<verbatim></verbatim>; bar"