commit 6248efa610e6cde737634ddaaedb65509c436f4e
parent 7ebc1ae0e41f8c4263042379853eddc8651c58f4
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Sun, 20 Mar 2011 15:35:02 -0600
scriblib/autobib: fix `in-bib' to not generate a new bib entry
original commit: 50ca70703f1ea1944bce30ba4600ab13696b1cb0
Diffstat:
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/collects/scriblib/autobib.rkt b/collects/scriblib/autobib.rkt
@@ -32,21 +32,23 @@
(define-struct (other-author-element author-element) ())
(define (add-cite group bib-entry which with-specific?)
- (hash-set! (bib-group-ht group) bib-entry #t)
- (make-delayed-element
- (lambda (renderer part ri)
- (let ([s (resolve-get part ri `(,which ,(auto-bib-key bib-entry)))])
- (list (make-link-element #f
- (list (or s "???")
- (if with-specific?
- (auto-bib-specific bib-entry)
- ""))
- `(autobib ,(auto-bib-key bib-entry))))))
- (lambda () "(???)")
- (lambda () "(???)")))
+ (let ([key (auto-bib-key bib-entry)])
+ (hash-set! (bib-group-ht group) key bib-entry)
+ (make-delayed-element
+ (lambda (renderer part ri)
+ (let ([s (resolve-get part ri `(,which ,key))])
+ (list (make-link-element #f
+ (list (or s "???")
+ (if with-specific?
+ (auto-bib-specific bib-entry)
+ ""))
+ `(autobib ,(auto-bib-key bib-entry))))))
+ (lambda () "(???)")
+ (lambda () "(???)"))))
(define (add-inline-cite group bib-entries)
- (for ([i bib-entries]) (hash-set! (bib-group-ht group) i #t))
+ (for ([i bib-entries])
+ (hash-set! (bib-group-ht group) (auto-bib-key i) i))
(when (and (pair? (cdr bib-entries))
(not (apply equal? (map (compose author-element-names auto-bib-author) bib-entries))))
(error 'citet "citet must be used with identical authors, given ~a"
@@ -103,7 +105,7 @@
(extract-bib-year a) (extract-bib-year b)
(< (extract-bib-year a) (extract-bib-year b)))))]
[bibs (sort (hash-map (bib-group-ht group)
- (lambda (k v) k))
+ (lambda (k v) v))
author/date<?)])
(make-part
#f