Skip to content

Commit

Permalink
JATS writer: handle case where there is material after refs div.
Browse files Browse the repository at this point in the history
Previously in such cases the references were not being moved to
back matter. Closes #9166.
  • Loading branch information
jgm committed Nov 4, 2023
1 parent bb36f12 commit 9400f75
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Text/Pandoc/Writers/JATS.hs
Expand Up @@ -113,11 +113,13 @@ docToJATS opts (Pandoc meta blocks') = do
$ ensureReferenceHeader blocks'
let splitBackBlocks b@(Div ("refs",_,_) _) (fs, bs) = (fs, b:bs)
splitBackBlocks (Div (ident,("section":_),_)
[ Header lev (_,hcls,hkvs) hils
, (Div rattrs@("refs",_,_) rs)
]) (fs, bs)
= (fs, Div rattrs
(Header lev (ident,hcls,hkvs) hils : rs) : bs)
( Header lev (_,hcls,hkvs) hils
: (Div rattrs@("refs",_,_) rs)
: rest
)) (fs, bs)
= (fs ++ rest,
Div rattrs
(Header lev (ident,hcls,hkvs) hils : rs) : bs)
splitBackBlocks b (fs, bs) = (b:fs, bs)
let (bodyblocks, backblocks) = foldr splitBackBlocks ([],[]) blocks
let colwidth = if writerWrapText opts == WrapAuto
Expand Down

0 comments on commit 9400f75

Please sign in to comment.