commit ca96ca2c2ea3328a3c35a381684ccced14176206
parent d8f2cc1bd9c289fe07c0acde0926bffd1689fca5
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Tue, 21 May 2013 13:43:31 -0600
scriblib/autbib: add `#:note' support
original commit: 7645bacec1e9c9455a1c08f17b251cabdf1a3ebc
Diffstat:
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/collects/scriblib/autobib.rkt b/collects/scriblib/autobib.rkt
@@ -39,7 +39,7 @@
(define colbibnumber-style (make-style "Autocolbibnumber" autobib-style-extras))
(define colbibentry-style (make-style "Autocolbibentry" autobib-style-extras))
-(define-struct auto-bib (author date title location url is-book? key specific))
+(define-struct auto-bib (author date title location url note is-book? key specific))
(define-struct bib-group (ht))
(define-struct (author-element element) (names cite))
@@ -324,12 +324,13 @@
null))
(define (bib->entry bib style disambiguation render-date-bib i)
- (define-values (author date title location url is-book?)
+ (define-values (author date title location url note is-book?)
(values (auto-bib-author bib)
(auto-bib-date bib)
(auto-bib-title bib)
(auto-bib-location bib)
(auto-bib-url bib)
+ (auto-bib-note bib)
(auto-bib-is-book? bib)))
(make-element (send style entry-style)
(append
@@ -356,7 +357,8 @@
(decode-content (list (render-date-bib date))))
".")
null)
- (if url `(" " ,(link url (make-element 'url (list url)))) null))))
+ (if url `(" " ,(link url (make-element 'url (list url)))) null)
+ (if note `(" " ,note) null))))
(define-syntax (define-cite stx)
(syntax-parse stx
@@ -404,13 +406,14 @@
#:is-book? [is-book? #f]
#:location [location #f]
#:date [date #f]
- #:url [url #f])
+ #:url [url #f]
+ #:note [note #f])
(define author*
(cond [(not author) #f]
[(author-element? author) author]
[else (parse-author author)]))
(define parsed-date (understand-date date))
- (make-auto-bib author* parsed-date title location url is-book?
+ (make-auto-bib author* parsed-date title location url note is-book?
(content->string
(make-element #f
(append
@@ -418,7 +421,8 @@
(list title)
(if location (decode-content (list location)) null)
(if date (decode-content (list (default-render-date-bib parsed-date))) null)
- (if url (list (link url (make-element 'url (list url)))) null))))
+ (if url (list (link url (make-element 'url (list url)))) null)
+ (if note (list note) null))))
""))
(define (in-bib bib where)
@@ -428,6 +432,7 @@
(auto-bib-title bib)
(auto-bib-location bib)
(auto-bib-url bib)
+ (auto-bib-note bib)
(auto-bib-is-book? bib)
(auto-bib-key bib)
;; "where" is the only specific part of auto-bib elements currently.
diff --git a/collects/scriblib/scribblings/autobib.scrbl b/collects/scriblib/scribblings/autobib.scrbl
@@ -121,12 +121,13 @@ Returns @racket[#t] if @racket[v] is a value produced by
[#:is-book? is-book? any/c #f]
[#:location location any/c #f]
[#:date date (or/c #f date? exact-nonnegative-integer? string?) #f]
- [#:url url string? #f])
+ [#:url url string? #f]
+ [#:note note any/c #f])
bib?]{
Produces a value that represents a document to cite. Except for
@racket[is-book?] and @racket[url], the arguments are used as
-elements, except that @racket[#f] means that the information is not
+content, except that @racket[#f] means that the information is not
supplied. Functions like @racket[proceedings-location],
@racket[author-name], and @racket[authors] help produce elements in a
standard format.