Skip to content

Commit 1154e8b

Browse files
authored
autobib: allow bibliography without title
1 parent 8247c00 commit 1154e8b

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

scribble-doc/scriblib/scribblings/autobib.scrbl

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
This library provides support for bibliography management in a Scribble
1313
document. The @racket[define-cite] form is used to bind procedures
14-
that create in-line citations and generate the bibilography in the
14+
that create in-line citations and generate the bibliography in the
1515
document.
1616

1717
Individual bibliography entries are created with the @racket[make-bib]
@@ -91,10 +91,16 @@ or more bibliography entries which have the same authors. It has the contract
9191
]
9292

9393
The function bound to @racket[generate-bibliography-id] generates the
94-
section for the bibliography. It has the contract
94+
section for the bibliography, with a title as per the @racket[#:sec-title] argument
95+
(defaults to @racket["Bibliography"]) and a tag as per the @racket[#:tag] argument
96+
(defaults to @racket["doc-bibliography"]).
97+
If the @racket[#:sec-title] argument is @racket[#f] instead a string,
98+
only the content of the bibliography is created, as a table,
99+
and not the enclosing section as a part.
95100

96101
@racketblock[
97-
(->* () (#:tag string? #:sec-title string?) part?)
102+
(->* () (#:tag string? #:sec-title (or/c #f string?))
103+
(or/c part? block?))
98104
]
99105

100106
If provided, the function bound to @racket[cite-author-id]
@@ -122,15 +128,12 @@ The functions bound to @racket[cite-author-id] and
122128
library is pretty nifty.
123129
}|
124130

125-
The default value for the @racket[#:tag] argument is @racket["doc-bibliography"]
126-
and for @racket[#:sec-title] is @racket["Bibliography"].
127-
128131
The optional @racket[spaces-expr] determines the number of blank lines that appear
129132
between citations. The default number of lines is 1.
130133

131134
The optional @racket[style-expr] determines the way that citations and
132135
the bibliography are rendered.@margin-note*{Programmer-defined styles
133-
may be supported in the future.} Currently, two built-in style are
136+
may be supported in the future.} Currently, two built-in styles are
134137
provided, and @racket[author+date-style] is the default.
135138

136139
For @racket[author+date-style],

scribble-lib/scriblib/autobib.rkt

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -366,17 +366,22 @@
366366
(make-paragraph (make-style #f '()) '(""))
367367
(make-paragraph (make-style #f '()) '(""))))
368368

369-
(make-part #f
370-
`((part ,tag))
371-
(list sec-title)
372-
(make-style #f '(unnumbered))
373-
null
374-
(list (make-table (send style bibliography-table-style)
369+
(define table
370+
(make-table (send style bibliography-table-style)
375371
(add-between #:splice? #t
376372
disambiguated
377373
(for/list ([i (in-range 1 spaces)])
378374
(make-space)))))
379-
null))
375+
376+
(if sec-title
377+
(make-part #f
378+
`((part ,tag))
379+
(list sec-title)
380+
(make-style #f '(unnumbered))
381+
null
382+
(list table)
383+
null)
384+
table))
380385

381386
(define (bib->entry bib style disambiguation render-date-bib i)
382387
(define-values (author date title location url note is-book? doi)

0 commit comments

Comments
 (0)