Skip to content

Commit 9400f75

Browse files
committed
JATS writer: handle case where there is material after refs div.
Previously in such cases the references were not being moved to back matter. Closes #9166.
1 parent bb36f12 commit 9400f75

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Text/Pandoc/Writers/JATS.hs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,13 @@ docToJATS opts (Pandoc meta blocks') = do
113113
$ ensureReferenceHeader blocks'
114114
let splitBackBlocks b@(Div ("refs",_,_) _) (fs, bs) = (fs, b:bs)
115115
splitBackBlocks (Div (ident,("section":_),_)
116-
[ Header lev (_,hcls,hkvs) hils
117-
, (Div rattrs@("refs",_,_) rs)
118-
]) (fs, bs)
119-
= (fs, Div rattrs
120-
(Header lev (ident,hcls,hkvs) hils : rs) : bs)
116+
( Header lev (_,hcls,hkvs) hils
117+
: (Div rattrs@("refs",_,_) rs)
118+
: rest
119+
)) (fs, bs)
120+
= (fs ++ rest,
121+
Div rattrs
122+
(Header lev (ident,hcls,hkvs) hils : rs) : bs)
121123
splitBackBlocks b (fs, bs) = (b:fs, bs)
122124
let (bodyblocks, backblocks) = foldr splitBackBlocks ([],[]) blocks
123125
let colwidth = if writerWrapText opts == WrapAuto

0 commit comments

Comments
 (0)