git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: allow footnotes to start with empty line

A space character was required after footnote marker, now newline is allowed.

commit875e33ecf698396418d722d77f74cf07835058d2 authorAlexander Krotov <ilabdsf@gmail.com> dateMon 22 Oct 2018, 03:03 (8 years ago) parent95b9d94
2 files changed+20−2
src/Text/Pandoc/Readers/Muse.hs+3−2 test/Tests/Readers/Muse.hs+17
src/Text/Pandoc/Readers/Muse.hs+3−2
@@ -492,9 +492,10 @@ amuseNoteBlockUntil :: PandocMonad m
492492 -> MuseParser m (F Blocks, a)
493493amuseNoteBlockUntil end = try $ do
494494 guardEnabled Ext_amuse
495− ref <- noteMarker <* spaceChar
495+ ref <- noteMarker
496496 pos <- getPosition
497− (content, e) <- allowPara $ listItemContentsUntil (sourceColumn pos - 1) (fail "x") end
497+ void spaceChar <|> lookAhead eol
498+ (content, e) <- allowPara $ listItemContentsUntil (sourceColumn pos) (fail "x") end
498499 addNote ref pos content
499500 return (mempty, e)
500501
test/Tests/Readers/Muse.hs+17
@@ -797,6 +797,23 @@ tests =
797797 , "baz"
798798 ] =?>
799799 para (str "Foo" <> note (lineBlock ["bar"])) <> para (str "baz")
800+
801+ , "Footnote starting with empty line" =:
802+ T.unlines [ "Foo[1]"
803+ , ""
804+ , "[1]" -- No space character after note marker
805+ , ""
806+ , " Bar"
807+ ] =?>
808+ para (str "Foo" <> note (para $ text "Bar"))
809+ , "Indentation in footnote starting with empty line" =:
810+ T.unlines [ "Foo[1]"
811+ , ""
812+ , "[1]" -- No space character after note marker
813+ , ""
814+ , " Bar"
815+ ] =?>
816+ para (str "Foo" <> note mempty) <> blockQuote (para $ text "Bar")
800817 , test emacsMuse "Emacs multiparagraph footnotes"
801818 (T.unlines
802819 [ "First footnote reference[1] and second footnote reference[2]."