Skip to content
This repository has been archived by the owner on Apr 30, 2021. It is now read-only.

Commit

Permalink
Improved cross-reference resolution.
Browse files Browse the repository at this point in the history
Use foldr instead of foldl.

This avoids the hang that occured with circular cross-references
(closes #190).
  • Loading branch information
jgm committed Nov 11, 2015
1 parent 7d0a286 commit 6aca99f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Text/CSL/Input/Bibtex.hs
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ getXrefFields isBibtex baseEntry entries keys = do
return (k',v)

resolveCrossRef :: Bool -> [Item] -> Item -> Item
resolveCrossRef isBibtex entries entry = foldl go entry (fields entry)
where go entry' (key, val) =
resolveCrossRef isBibtex entries entry = foldr go entry (fields entry)
where go (key, val) entry' =
if key == "crossref" || key == "xdata"
then entry'{ fields = fields entry' ++
getXrefFields isBibtex entry entries val }
Expand Down

0 comments on commit 6aca99f

Please sign in to comment.