Org reader: end footnotes after two blank lines
Footnotes can not only be terminated by the start of a new footnote or a header, but also by two consecutive blank lines.
This commit is contained in:
parent
89f1362660
commit
f176ad6f21
2 changed files with 80 additions and 64 deletions
|
@ -724,13 +724,14 @@ latexEnd envName = try $
|
|||
noteBlock :: PandocMonad m => OrgParser m (F Blocks)
|
||||
noteBlock = try $ do
|
||||
ref <- noteMarker <* skipSpaces <* updateLastPreCharPos
|
||||
content <- mconcat <$> blocksTillHeaderOrNote
|
||||
content <- mconcat <$> many1Till block endOfFootnote
|
||||
addToNotesTable (ref, content)
|
||||
return mempty
|
||||
where
|
||||
blocksTillHeaderOrNote =
|
||||
many1Till block (eof <|> () <$ lookAhead noteMarker
|
||||
<|> () <$ lookAhead headerStart)
|
||||
endOfFootnote = eof
|
||||
<|> () <$ lookAhead noteMarker
|
||||
<|> () <$ lookAhead headerStart
|
||||
<|> () <$ lookAhead (try $ blankline *> blankline)
|
||||
|
||||
-- Paragraphs or Plain text
|
||||
paraOrPlain :: PandocMonad m => OrgParser m (F Blocks)
|
||||
|
|
|
@ -1086,7 +1086,8 @@ tests =
|
|||
para (image "guess.jpg" "fig:" "")
|
||||
]
|
||||
|
||||
, "Footnote" =:
|
||||
, testGroup "Footnotes"
|
||||
[ "Footnote" =:
|
||||
T.unlines [ "A footnote[1]"
|
||||
, ""
|
||||
, "[1] First paragraph"
|
||||
|
@ -1147,6 +1148,20 @@ tests =
|
|||
])
|
||||
, headerWith ("headline", [], []) 2 "Headline"
|
||||
]
|
||||
|
||||
, "Footnote followed by two blank lines" =:
|
||||
T.unlines [ "footnote[fn:blanklines]"
|
||||
, ""
|
||||
, "[fn:blanklines] followed by blank lines"
|
||||
, ""
|
||||
, ""
|
||||
, "next"
|
||||
] =?>
|
||||
mconcat
|
||||
[ para ("footnote" <> note (para "followed by blank lines"))
|
||||
, para "next"
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
, testGroup "Lists" $
|
||||
|
|
Loading…
Add table
Reference in a new issue