Sort bibliographies by authors' last names.
(Tweaked by Vincent.) original commit: 3caf0aca23a293271dd7245f42b28dccaab535f6
This commit is contained in:
parent
d327ca1190
commit
743e0afbfb
|
@ -161,12 +161,16 @@
|
||||||
(define render-date-bib (or maybe-render-date-bib default-render-date-bib))
|
(define render-date-bib (or maybe-render-date-bib default-render-date-bib))
|
||||||
(define render-date-cite (or maybe-render-date-cite default-render-date-cite))
|
(define render-date-cite (or maybe-render-date-cite default-render-date-cite))
|
||||||
(define (author/date<? a b)
|
(define (author/date<? a b)
|
||||||
;; comparing just the authors causes non-deterministic render order. Use entire key.
|
;; comparing just the authors causes non-deterministic render order.
|
||||||
|
;; We still have to use the authors first in order for last name order.
|
||||||
|
;; If there is a collision for names, then disambiguate with the keys and then the date.
|
||||||
|
(or (string-ci<? (extract-bib-key a) (extract-bib-key b))
|
||||||
|
(and (string-ci=? (extract-bib-key a) (extract-bib-key b))
|
||||||
(or (string-ci<? (auto-bib-key a) (auto-bib-key b))
|
(or (string-ci<? (auto-bib-key a) (auto-bib-key b))
|
||||||
(and (string-ci=? (auto-bib-key a) (auto-bib-key b))
|
(and (string-ci=? (auto-bib-key a) (auto-bib-key b))
|
||||||
(auto-bib-date a)
|
(auto-bib-date a)
|
||||||
(auto-bib-date b)
|
(auto-bib-date b)
|
||||||
(date<? a b))))
|
(date<? a b))))))
|
||||||
(define (ambiguous? a b)
|
(define (ambiguous? a b)
|
||||||
(and (string-ci=? (extract-bib-key a) (extract-bib-key b))
|
(and (string-ci=? (extract-bib-key a) (extract-bib-key b))
|
||||||
(auto-bib-date a)
|
(auto-bib-date a)
|
||||||
|
|
19
collects/tests/scribble/docs/autobib-order.scrbl
Normal file
19
collects/tests/scribble/docs/autobib-order.scrbl
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#lang scribble/base
|
||||||
|
@(require scriblib/autobib)
|
||||||
|
@(define-cite cite citet gen)
|
||||||
|
|
||||||
|
@(define a (make-bib #:title "Diss 1"
|
||||||
|
#:is-book? #t
|
||||||
|
#:location (dissertation-location #:institution "NEU")
|
||||||
|
#:author (authors (author-name "Little Bo" "Peep") (author-name "Samwise" "Gamgee"))
|
||||||
|
#:date "2012"))
|
||||||
|
@(define b (make-bib #:title "Diss 2"
|
||||||
|
#:is-book? #t
|
||||||
|
#:location (dissertation-location #:institution "NEU")
|
||||||
|
#:author (authors (author-name "Ayo" "Shucks"))
|
||||||
|
#:date "2012"))
|
||||||
|
Order matters. Must sort by last names.
|
||||||
|
@cite[b]
|
||||||
|
@cite[a]
|
||||||
|
|
||||||
|
@(gen)
|
7
collects/tests/scribble/docs/autobib-order.txt
Normal file
7
collects/tests/scribble/docs/autobib-order.txt
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
Order matters. Must sort by last names. (Shucks 2012) (Peep and Gamgee
|
||||||
|
2012)
|
||||||
|
|
||||||
|
Bibliography
|
||||||
|
|
||||||
|
Little Bo Peep and Samwise Gamgee. Diss 1. PhD dissertation, NEU, 2012.
|
||||||
|
Ayo Shucks. Diss 2. PhD dissertation, NEU, 2012.
|
|
@ -10,8 +10,8 @@ al. 2010, part II) (Felleisen et al. 2010)
|
||||||
Bibliography
|
Bibliography
|
||||||
|
|
||||||
And no date. Look ma, no authors.
|
And no date. Look ma, no authors.
|
||||||
Dorai Sitaram. Programming in Schelog. 1993.
|
|
||||||
http://www.ccs.neu.edu/~dorai/schelog/schelog.html
|
|
||||||
Look ma, no authors.
|
|
||||||
Matthias Felleisen, Robert Bruce Findler, and Matthew Flatt. Semantics
|
Matthias Felleisen, Robert Bruce Findler, and Matthew Flatt. Semantics
|
||||||
Engineering with PLT Redex. MIT Press, 2010.
|
Engineering with PLT Redex. MIT Press, 2010.
|
||||||
|
Look ma, no authors.
|
||||||
|
Dorai Sitaram. Programming in Schelog. 1993.
|
||||||
|
http://www.ccs.neu.edu/~dorai/schelog/schelog.html
|
||||||
|
|
Loading…
Reference in New Issue
Block a user