Muse reader: accept Emacs Muse definition lists
Emacs Muse does not require indentation.
This commit is contained in:
parent
f13f142945
commit
df4cb20f29
2 changed files with 14 additions and 1 deletions
|
@ -423,7 +423,8 @@ definitionListItem = try $ do
|
|||
pure $ do lineContent' <- lineContent
|
||||
pure (B.text term, [lineContent'])
|
||||
where
|
||||
termParser = many1 spaceChar >> -- Initial space as required by Amusewiki, but not Emacs Muse
|
||||
termParser = (guardEnabled Ext_emacs <|> void spaceChar) >> -- Initial space is required by Amusewiki, but not Emacs Muse
|
||||
many spaceChar >>
|
||||
many1Till anyChar (lookAhead (void (try (spaceChar >> string "::")) <|> void newline))
|
||||
endOfInput = try $ skipMany blankline >> skipSpaces >> eof
|
||||
twoBlankLines = try $ blankline >> skipMany1 blankline
|
||||
|
|
|
@ -16,6 +16,10 @@ muse = purely $ \s -> do
|
|||
setOutputFile (Just "out")
|
||||
readMuse def s
|
||||
|
||||
emacsMuse :: Text -> Pandoc
|
||||
emacsMuse = purely $ readMuse def { readerExtensions =
|
||||
enableExtension Ext_emacs pandocExtensions }
|
||||
|
||||
infix 4 =:
|
||||
(=:) :: ToString c
|
||||
=> String -> (Text, c) -> TestTree
|
||||
|
@ -622,6 +626,14 @@ tests =
|
|||
, "Foo :: bar"
|
||||
] =?>
|
||||
para "First :: second Foo :: bar"
|
||||
, test emacsMuse "Emacs Muse definition list"
|
||||
(T.unlines
|
||||
[ "First :: second"
|
||||
, "Foo :: bar"
|
||||
] =?>
|
||||
definitionList [ ("First", [ para "second" ])
|
||||
, ("Foo", [ para "bar" ])
|
||||
])
|
||||
, "Definition list" =:
|
||||
T.unlines
|
||||
[ " First :: second"
|
||||
|
|
Loading…
Add table
Reference in a new issue