aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/Muse.hs10
-rw-r--r--test/Tests/Readers/Muse.hs8
2 files changed, 17 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs
index 818f66e20..29a6882dd 100644
--- a/src/Text/Pandoc/Readers/Muse.hs
+++ b/src/Text/Pandoc/Readers/Muse.hs
@@ -32,7 +32,6 @@ Conversion of Muse text to 'Pandoc' document.
-}
{-
TODO:
-- Page breaks (five "*")
- Org tables
- table.el tables
- <cite> tag
@@ -312,6 +311,7 @@ blockElements :: PandocMonad m => MuseParser m (F Blocks)
blockElements = (mempty <$ blankline)
<|> comment
<|> separator
+ <|> pagebreak
<|> example
<|> exampleTag
<|> literalTag
@@ -342,6 +342,14 @@ separator = try $ pure B.horizontalRule
<* many spaceChar
<* eol
+-- | Parse a page break
+pagebreak :: PandocMonad m => MuseParser m (F Blocks)
+pagebreak = try $ pure (B.divWith ("", [], [("style", "page-break-before: always;")]) mempty)
+ <$ count 6 spaceChar
+ <* many spaceChar
+ <* string "* * * * *"
+ <* manyTill spaceChar eol
+
headingStart :: PandocMonad m => MuseParser m (String, Int)
headingStart = try $ (,)
<$> option "" (try (parseAnchor <* manyTill spaceChar eol))
diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs
index 36724b33c..492b5baaa 100644
--- a/test/Tests/Readers/Muse.hs
+++ b/test/Tests/Readers/Muse.hs
@@ -279,6 +279,14 @@ tests =
, "5 dashes is a horizontal rule" =: "-----" =?> horizontalRule
, "4 dashes with spaces is a horizontal rule" =: "---- " =?> horizontalRule
]
+ , testGroup "Page breaks"
+ [ "Page break" =:
+ " * * * * *" =?>
+ divWith ("", [], [("style", "page-break-before: always;")]) mempty
+ , "Page break with trailing space" =:
+ " * * * * * " =?>
+ divWith ("", [], [("style", "page-break-before: always;")]) mempty
+ ]
, testGroup "Paragraphs"
[ "Simple paragraph" =:
T.unlines [ "First line"