commit 1a5f2a44bda548a64264a28b4160eaf0c5327814
parent d9e0462393f12db9f011949cd84c44b86b92db17
Author: Ben Greenman <benjaminlgreenman@gmail.com>
Date: Wed, 12 Sep 2018 22:03:51 -0400
add optional #:note to 'bib-entry' (#176)
Add an optional argument to bib-entry to typeset a comment directly
after a citation --- with no punctuation between the end of the citation
and start of the comment.
Example: making an annotated bibliography, with an element that appears just
below each citation
Diffstat:
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/scribble-doc/scribblings/scribble/manual.scrbl b/scribble-doc/scribblings/scribble/manual.scrbl
@@ -1909,7 +1909,8 @@ order as given.}
[#:author author (or/c #f pre-content?) #f]
[#:location location (or/c #f pre-content?) #f]
[#:date date (or/c #f pre-content?) #f]
- [#:url url (or/c #f pre-content?) #f])
+ [#:url url (or/c #f pre-content?) #f]
+ [#:note note (or/c #f pre-content?) #f])
bib-entry?]{
Creates a bibliography entry. The @racket[key] is used to refer to the
@@ -1942,7 +1943,12 @@ the entry:
bibliography using @racket[tt] and hyperlinked, or it is
omitted if given as @racket[#f].}
-]}
+ @item{@racket[note] is an optional comment about the work. It is typeset
+ in the bibliography as given, and appears directly after the date
+ (or URL, if given) with no space or punctuation in between.}
+]
+
+@history[#:changed "1.29" @elem{Added the @racket[#:note] option.}]}
@defproc[(bib-entry? [v any/c]) boolean?]{
diff --git a/scribble-lib/scribble/private/manual-bib.rkt b/scribble-lib/scribble/private/manual-bib.rkt
@@ -17,7 +17,8 @@
(#:is-book? boolean? #:author (or/c false/c pre-content?)
#:location (or/c false/c pre-content?)
#:date (or/c false/c pre-content?)
- #:url (or/c false/c pre-content?))
+ #:url (or/c false/c pre-content?)
+ #:note (or/c false/c pre-content?))
. ->* .
a-bib-entry?)]
[rename a-bib-entry? bib-entry? (any/c . -> . boolean?)]
@@ -46,7 +47,8 @@
#:author [author #f]
#:location [location #f]
#:date [date #f]
- #:url [url #f])
+ #:url [url #f]
+ #:note [note #f])
(make-a-bib-entry
key
(make-element
@@ -63,7 +65,8 @@
`(" " ,@(decode-content (list location)) ,(if date "," "."))
null)
(if date `(" " ,@(decode-content (list date)) ".") null)
- (if url `(" " ,(link url (tt url))) null)))))
+ (if url `(" " ,(link url (tt url))) null)
+ (if note (decode-content (list note)) null)))))
(define-on-demand bib-style (make-style "RBibliography" scheme-properties))