commit dce36bfc1857c57a3a52a0ccdf92e280ca2fee1b
parent 7635f21788b978beb1614e993968278003e73afb
Author: mlemmer <cynicallycharged@gmail.com>
Date: Wed, 1 May 2019 23:36:11 -0400
Add book-chapter-location to autobib (#182)
Diffstat:
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/scribble-doc/scriblib/scribblings/autobib.scrbl b/scribble-doc/scriblib/scribblings/autobib.scrbl
@@ -236,6 +236,17 @@ Combines elements to generate an element that is suitable for
describing a dissertation.}
+@defproc[(book-chapter-location [title any/c]
+ [#:pages pages (or (list/c any/c any/c) #f) #f]
+ [#:section section any/c #f]
+ [#:volume volume any/c #f]
+ [#:publisher publisher any/c #f])
+ element?]{
+
+Combines elements to generate an element that is suitable for
+describing a paper's location within a chapter or part of a book.}
+
+
@defproc[(author-name [first any/c]
[last any/c]
[#:suffix suffix any/c #f])
diff --git a/scribble-lib/scriblib/autobib.rkt b/scribble-lib/scriblib/autobib.rkt
@@ -29,6 +29,8 @@
(-> #:institution any/c #:number any/c element?)]
[dissertation-location
(->* [#:institution any/c] [#:degree any/c] element?)])
+ [book-chapter-location
+ (->* [any/c] [#:pages (or/c (list/c any/c any/c) #f) #:section any/c #:volume any/c #:publisher any/c] element?)]
other-authors
editor
abbreviate-given-names)
@@ -563,6 +565,27 @@
#:degree [degree "PhD"])
@elem{@to-string[degree] dissertation, @to-string[org]})
+(define (book-chapter-location
+ location
+ #:pages [pages #f]
+ #:series [series #f]
+ #:volume [volume #f]
+ #:publisher [publisher #f])
+ (let* ([s @elem{In @italic{@elem{@|location|}}}]
+ [s (if series
+ @elem{@|s|, @(format "~a" series)}
+ s)]
+ [s (if volume
+ @elem{@|s| volume @(format "~a" volume)}
+ s)]
+ [s (if pages
+ @elem{@|s|, pp. @(to-string (car pages))--@(to-string (cadr pages))}
+ s)]
+ [s (if publisher
+ @elem{@|s| @(format "~a" publisher)}
+ s)])
+ s))
+
;; ----------------------------------------
(define (author-name first last #:suffix [suffix #f])