git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: accept Emacs Muse definition lists

Emacs Muse does not require indentation.

commitdf4cb20f297b4a33e0520e62ce3d5ac08bf2a8ee authorAlexander Krotov <ilabdsf@gmail.com> dateSun 12 Nov 2017, 18:08 (9 years ago) parentf13f142
2 files changed+14−1
src/Text/Pandoc/Readers/Muse.hs+2−1 test/Tests/Readers/Muse.hs+12
src/Text/Pandoc/Readers/Muse.hs+2−1
@@ -423,7 +423,8 @@ definitionListItem = try $ do
423423 pure $ do lineContent' <- lineContent
424424 pure (B.text term, [lineContent'])
425425 where
426− termParser = many1 spaceChar >> -- Initial space as required by Amusewiki, but not Emacs Muse
426+ termParser = (guardEnabled Ext_emacs <|> void spaceChar) >> -- Initial space is required by Amusewiki, but not Emacs Muse
427+ many spaceChar >>
427428 many1Till anyChar (lookAhead (void (try (spaceChar >> string "::")) <|> void newline))
428429 endOfInput = try $ skipMany blankline >> skipSpaces >> eof
429430 twoBlankLines = try $ blankline >> skipMany1 blankline
test/Tests/Readers/Muse.hs+12
@@ -16,6 +16,10 @@ muse = purely $ \s -> do
1616 setOutputFile (Just "out")
1717 readMuse def s
1818
19+emacsMuse :: Text -> Pandoc
20+emacsMuse = purely $ readMuse def { readerExtensions =
21+ enableExtension Ext_emacs pandocExtensions }
22+
1923infix 4 =:
2024(=:) :: ToString c
2125 => String -> (Text, c) -> TestTree
@@ -622,6 +626,14 @@ tests =
622626 , "Foo :: bar"
623627 ] =?>
624628 para "First :: second Foo :: bar"
629+ , test emacsMuse "Emacs Muse definition list"
630+ (T.unlines
631+ [ "First :: second"
632+ , "Foo :: bar"
633+ ] =?>
634+ definitionList [ ("First", [ para "second" ])
635+ , ("Foo", [ para "bar" ])
636+ ])
625637 , "Definition list" =:
626638 T.unlines
627639 [ " First :: second"