Bibliographies had a nondeterministic render order. Fixed. Added tests for disambiguation.

original commit: 6e7fb4e7efd6efc692f4305740754a91ebf70dde
This commit is contained in:
James Ian Johnson 2012-03-12 15:59:58 -04:00 committed by Sam Tobin-Hochstadt
parent 875843a4e1
commit f280030d0c
5 changed files with 62 additions and 2 deletions

View File

@ -156,8 +156,9 @@
(define render-date-bib (or maybe-render-date-bib default-render-date-bib))
(define render-date-cite (or maybe-render-date-cite default-render-date-cite))
(define (author/date<? a b)
(or (string-ci<? (extract-bib-key a) (extract-bib-key b))
(and (string-ci=? (extract-bib-key a) (extract-bib-key b))
;; comparing just the authors causes non-deterministic render order. Use entire key.
(or (string-ci<? (auto-bib-key a) (auto-bib-key b))
(and (string-ci=? (auto-bib-key a) (auto-bib-key b))
(auto-bib-date a)
(auto-bib-date b)
(date<? a b))))

View File

@ -0,0 +1,19 @@
#lang scribble/base
@(require scriblib/autobib)
@(define-cite cite citet gen-bib)
@(define a (make-bib #:title "Diss A"
#:is-book? #t
#:location (dissertation-location #:institution "NEU")
#:author (authors "Little" "Bo" "Peep")
#:date "2012"))
@(define b (make-bib #:title "Diss B"
#:is-book? #t
#:location (dissertation-location #:institution "NEU")
#:author (authors "Little" "Bo" "Peep")
#:date "2012"))
@;{Citing ambiguous entries without other single citations}
@;{should not cause a warning}
@cite[a b]
@gen-bib[]

View File

@ -0,0 +1,6 @@
 (Little et al. 2012a,b)
Bibliography
Little, Bo, and Peep. Diss A. PhD dissertation, NEU, (2012a).
Little, Bo, and Peep. Diss B. PhD dissertation, NEU, (2012b).

View File

@ -0,0 +1,25 @@
#lang scribble/base
@(require scriblib/autobib)
@(define-cite cite citet gen-bib)
@(define a (make-bib #:title "Diss 1"
#:is-book? #t
#:location (dissertation-location #:institution "NEU")
#:author (authors "Little" "Bo" "Peep")
#:date "2012"))
@(define b (make-bib #:title "Diss 2"
#:is-book? #t
#:location (dissertation-location #:institution "NEU")
#:author (authors "Little" "Bo" "Peep")
#:date "2012"))
According to the following morons,
@cite[a]
@cite[b]
@citet[a]
@citet[b]
@cite[a b]
@cite[b a]
@citet[a b]
@citet[b a]
@gen-bib[]

View File

@ -0,0 +1,9 @@
According to the following morons,  (Little et al. 2012a)  (Little et
al. 2012b) Little et al. (2012a) Little et al. (2012b)  (Little et al.
2012a,b)  (Little et al. 2012b,a) Little et al. (2012a,b) Little et
al. (2012b,a)
Bibliography
Little, Bo, and Peep. Diss 1. PhD dissertation, NEU, (2012a).
Little, Bo, and Peep. Diss 2. PhD dissertation, NEU, (2012b).