@@ -382,12 +382,12 @@ getBibliographyFormat fp mbmime = do
382382 _ -> Nothing
383383
384384isNote :: Inline -> Bool
385- isNote (Cite _ [ Note _] ) = True
386- -- the following allows citation styles that are "in-text" but use superscript
387- -- references to be treated as if they are "notes" for the purposes of moving
388- -- the citations after trailing punctuation (see <https://github.com/jgm/pandoc-citeproc/issues/382>):
389- isNote (Cite _ [ Superscript _] ) = True
390- isNote _ = False
385+ isNote (Note _) = True
386+ -- the following allows citation styles that are "in-text" but use superscript
387+ -- references to be treated as if they are "notes" for the purposes of moving
388+ -- the citations after trailing punctuation (see <https://github.com/jgm/pandoc-citeproc/issues/382>):
389+ isNote (Superscript _) = True
390+ isNote _ = False
391391
392392isSpacy :: Inline -> Bool
393393isSpacy Space = True
@@ -405,9 +405,9 @@ mvPunct :: Bool -> Locale -> [Inline] -> [Inline]
405405mvPunct moveNotes locale (x : xs)
406406 | isSpacy x = x : mvPunct moveNotes locale xs
407407-- 'x [^1],' -> 'x,[^1]'
408- mvPunct moveNotes locale (q : s : x : ys)
408+ mvPunct moveNotes locale (q : s : x@ ( Cite _ [il]) : ys)
409409 | isSpacy s
410- , isNote x
410+ , isNote il
411411 = let spunct = T. takeWhile isPunctuation $ stringify ys
412412 in if moveNotes
413413 then if T. null spunct
@@ -418,9 +418,8 @@ mvPunct moveNotes locale (q : s : x : ys)
418418 (dropTextWhile isPunctuation (B. fromList ys)))
419419 else q : x : mvPunct moveNotes locale ys
420420-- 'x[^1],' -> 'x,[^1]'
421- mvPunct moveNotes locale (Cite cs ils : ys)
422- | not (null ils)
423- , isNote (last ils)
421+ mvPunct moveNotes locale (Cite cs ils@ (_: _) : ys)
422+ | isNote (last ils)
424423 , startWithPunct ys
425424 , moveNotes
426425 = let s = stringify ys
@@ -431,8 +430,10 @@ mvPunct moveNotes locale (Cite cs ils : ys)
431430 ++ [last ils]) :
432431 mvPunct moveNotes locale
433432 (B. toList (dropTextWhile isPunctuation (B. fromList ys)))
434- mvPunct moveNotes locale (s : x : ys) | isSpacy s, isNote x =
435- x : mvPunct moveNotes locale ys
433+ mvPunct moveNotes locale (s : x@ (Cite _ [il]) : ys)
434+ | isSpacy s
435+ , isNote il
436+ = x : mvPunct moveNotes locale ys
436437mvPunct moveNotes locale (s : x@ (Cite _ (Superscript _ : _)) : ys)
437438 | isSpacy s = x : mvPunct moveNotes locale ys
438439mvPunct moveNotes locale (Cite cs ils : Str " ." : ys)
0 commit comments