commit 3b50061de125f328b79b632c6acdee4367a93594
parent e151e32b8228a5fb3900784eb29139f97da6e646
Author: Jay McCarthy <jay@racket-lang.org>
Date: Thu, 12 Jan 2012 15:48:23 -0700
Throw an error when required fields are missing, rather than letting scribble error
original commit: 2d0d4823a78147cc9fa4dfa85fc09a5a609ac2d1
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/collects/scriblib/bibtex.rkt b/collects/scriblib/bibtex.rkt
@@ -171,6 +171,10 @@
(define the-raw (hash-ref raw key (λ () (error 'bibtex "Unknown citation ~e" key))))
(define (raw-attr a [def #f])
(hash-ref the-raw a def))
+ (define (raw-attr* a)
+ (hash-ref the-raw a
+ (λ () (error 'bibtex "Key ~a is missing attribute ~a, has ~a"
+ key a the-raw))))
(match (raw-attr 'type)
["misc"
(make-bib #:title (raw-attr "title")
@@ -187,7 +191,7 @@
(make-bib #:title (raw-attr "title")
#:author (parse-author (raw-attr "author"))
#:date (raw-attr "year")
- #:location (journal-location (raw-attr "journal")
+ #:location (journal-location (raw-attr* "journal")
#:pages (parse-pages (raw-attr "pages"))
#:number (raw-attr "number")
#:volume (raw-attr "volume"))