add optional #:note to 'bib-entry' ()

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
This commit is contained in:
Ben Greenman 2018-09-12 22:03:51 -04:00 committed by GitHub
parent d9e0462393
commit 1a5f2a44bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions
scribble-doc/scribblings/scribble
scribble-lib/scribble/private

View File

@ -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?]{

View File

@ -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))