Skip to content

Commit

Permalink
Implemented special flipped after-collapse-delim behavior.
Browse files Browse the repository at this point in the history
This isn't officially documented as part of the spec.
See citation-style-language/test-suite#36.
  • Loading branch information
jgm committed Oct 1, 2020
1 parent fc5351f commit d9074fb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Citeproc/Eval.hs
Original file line number Diff line number Diff line change
Expand Up @@ -690,18 +690,24 @@ groupAndCollapseCitations citeGroupDelim yearSuffixDelim afterCollapseDelim
ws = collapseYearSuffix collapseType ys'
noCollapse = ws == y:ys
noYearSuffixCollapse = ws == ys'
hasLocator u = not $ null [x | x@(Tagged TagLocator _) <- universe u]
-- https://github.com/citation-style-language/test-suite/issues/36 :
flippedAfterCollapseDelim = collapseType == CollapseYear
addCGDelim u [] = [u]
addCGDelim u us =
Formatted mempty{ formatSuffix =
if noCollapse || noYearSuffixCollapse
if noCollapse || noYearSuffixCollapse &&
not (flippedAfterCollapseDelim &&
hasLocator u)
then Just citeGroupDelim
else afterCollapseDelim <|>
formatDelimiter f } [u] : us
in Formatted mempty{ formatDelimiter = Nothing
, formatSuffix =
if null zs
then Nothing
else if noCollapse
else if noCollapse &&
not flippedAfterCollapseDelim
then formatDelimiter f
else afterCollapseDelim <|>
formatDelimiter f }
Expand Down

0 comments on commit d9074fb

Please sign in to comment.