commit f280030d0c6b5b091d2b86e74c9ea69da9758314
parent 875843a4e1e279cb412c781bf60f1c12d616e553
Author: James Ian Johnson <ianj@moonpatrol.ccs.neu.edu>
Date: Mon, 12 Mar 2012 15:59:58 -0400
Bibliographies had a nondeterministic render order. Fixed. Added tests for disambiguation.
original commit: 6e7fb4e7efd6efc692f4305740754a91ebf70dde
Diffstat:
5 files changed, 64 insertions(+), 2 deletions(-)
diff --git a/collects/scriblib/autobib.rkt b/collects/scriblib/autobib.rkt
@@ -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))))
diff --git a/collects/tests/scribble/docs/autobib-disambiguation-corner.scrbl b/collects/tests/scribble/docs/autobib-disambiguation-corner.scrbl
@@ -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[]
+\ No newline at end of file
diff --git a/collects/tests/scribble/docs/autobib-disambiguation-corner.txt b/collects/tests/scribble/docs/autobib-disambiguation-corner.txt
@@ -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).
diff --git a/collects/tests/scribble/docs/autobib-disambiguation.scrbl b/collects/tests/scribble/docs/autobib-disambiguation.scrbl
@@ -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[]
+\ No newline at end of file
diff --git a/collects/tests/scribble/docs/autobib-disambiguation.txt b/collects/tests/scribble/docs/autobib-disambiguation.txt
@@ -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).