commit ca961ce44b5295cdede4d5db663a973f767c8877
parent ce2dc58b4ceef3df2c18ffcf65b9755bf5507fda
Author: James Ian Johnson <ianj@moonpatrol.ccs.neu.edu>
Date: Wed, 7 Mar 2012 12:31:55 -0500
Added the ability to disambiguate between citations using autobib.
original commit: 2c63ce2286da4113baa9c32d5d75bf8189bcbb35
Diffstat:
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/collects/scriblib/autobib.rkt b/collects/scriblib/autobib.rkt
@@ -37,6 +37,9 @@
;; render the use of a citation.
(define (add-cite group bib-entry which with-specific? disambiguation)
(let ([key (auto-bib-key bib-entry)])
+ (when disambiguation
+ (for ([bib disambiguation])
+ (hash-set! (bib-group-ht group) (auto-bib-key bib) bib)))
(hash-set! (bib-group-ht group) key bib-entry)
(make-delayed-element
(lambda (renderer part ri)
@@ -54,15 +57,15 @@
))) ;; should be a list of bib-entries with same author/date
(define disambiguation*
(add-between (for/list ([bib (in-list disambiguation)])
+ (define key (auto-bib-key bib))
(define maybe-disambiguation
- (resolve-get part ri `(autobib-disambiguation ,(auto-bib-key bib))))
+ (resolve-get part ri `(autobib-disambiguation key)))
(case maybe-disambiguation
[(unambiguous) #f]
- [else maybe-disambiguation]))
+ [else (make-link-element #f (list maybe-disambiguation) `(autobib ,key))]))
","))
(cond [(not (car disambiguation*)) '()] ;; the bib was unambiguous
- [else
- (list (make-link-element #f (list disambiguation*) `(autobib ,(auto-bib-key bib-entry))))])]
+ [else disambiguation*])]
[else '()])))
(lambda () "(???)")
(lambda () "(???)"))))