Supress duplicate author lists.

original commit: 01c8c281f3894f8d559541442cf5e66654f4338e
This commit is contained in:
Sam Tobin-Hochstadt 2010-11-16 12:35:37 -05:00
parent 98426520a8
commit 2af3c0c8b7

View File

@ -1,5 +1,6 @@
#lang at-exp racket/base
(require scribble/manual
racket/list
scribble/core
scribble/decode
scribble/html-properties
@ -64,24 +65,25 @@
")")))
(define (add-cites group bib-entries)
(define groups (for/fold ([h (hash)]) ([b (reverse bib-entries)])
(hash-update h (author-element-names (auto-bib-author b))
(lambda (cur) (cons b cur)) null)))
(make-element
#f
(list 'nbsp
"("
(let loop ([keys bib-entries])
(if (null? (cdr keys))
(make-element
#f
(list
(add-cite group (car keys) 'autobib-author #f)
" "
(add-cite group (car keys) 'autobib-date #t)))
(make-element
#f
(list (loop (list (car keys)))
"; "
(loop (cdr keys))))))
")")))
(append
(list 'nbsp "(")
(add-between
(for/list ([(k v) groups])
(make-element
#f
(list*
(add-cite group (car v) 'autobib-author #f)
" "
(add-between
(for/list ([b v]) (add-cite group b 'autobib-date #t))
", "))))
"; ")
(list ")"))))
(define (extract-bib-key b)
(author-element-names (auto-bib-author b)))