bkyk8rc3zvpnsf5inmcqq4n3k98cv6hj-my-site-hyper-literate-git.test.suzanne.soy-0.0.1

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 743e0afbfb6ec623161eb28ff44afcb2f94c2a0e
parent d327ca11903562cf32fad0eb495019dfb23980d8
Author: J. Ian Johnson <ianj@ccs.neu.edu>
Date:   Tue,  3 Apr 2012 17:56:15 -0400

Sort bibliographies by authors' last names.

(Tweaked by Vincent.)

original commit: 3caf0aca23a293271dd7245f42b28dccaab535f6

Diffstat:
Mcollects/scriblib/autobib.rkt | 16++++++++++------
Acollects/tests/scribble/docs/autobib-order.scrbl | 19+++++++++++++++++++
Acollects/tests/scribble/docs/autobib-order.txt | 7+++++++
Mcollects/tests/scribble/docs/autobib.txt | 6+++---
4 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/collects/scriblib/autobib.rkt b/collects/scriblib/autobib.rkt @@ -161,12 +161,16 @@ (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 (author/date<? a b) - ;; comparing just the authors causes non-deterministic render order. Use entire key. - (or (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 b) - (date<? a b)))) + ;; 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)) + (and (string-ci=? (auto-bib-key a) (auto-bib-key b)) + (auto-bib-date a) + (auto-bib-date b) + (date<? a b)))))) (define (ambiguous? a b) (and (string-ci=? (extract-bib-key a) (extract-bib-key b)) (auto-bib-date a) diff --git a/collects/tests/scribble/docs/autobib-order.scrbl b/collects/tests/scribble/docs/autobib-order.scrbl @@ -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) diff --git a/collects/tests/scribble/docs/autobib-order.txt b/collects/tests/scribble/docs/autobib-order.txt @@ -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. diff --git a/collects/tests/scribble/docs/autobib.txt b/collects/tests/scribble/docs/autobib.txt @@ -10,8 +10,8 @@ al. 2010, part II)  (Felleisen et al. 2010) Bibliography 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 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