diff options
author | Ludovic Court`es | 2007-08-29 12:00:15 +0000 |
---|---|---|
committer | Ludovic Court`es | 2007-08-29 12:00:15 +0000 |
commit | 1cf52b9cef7629a95dc7c3ddf82ea907967d9ca4 (patch) | |
tree | 232fe4413ed8d1913f7fa46ee98fb6f904a7f697 /src | |
parent | 5d9b0e84c21a4d87e204b0f28a3e60d3f297d4ab (diff) | |
download | skribilo-1cf52b9cef7629a95dc7c3ddf82ea907967d9ca4.tar.gz skribilo-1cf52b9cef7629a95dc7c3ddf82ea907967d9ca4.tar.lz skribilo-1cf52b9cef7629a95dc7c3ddf82ea907967d9ca4.zip |
biblio: Properly handle non-string authors.
* src/guile/skribilo/biblio/author.scm
(bib-sort/first-author-last-name)[maybe-first-author-last-name]: New.
Use it.
git-archimport-id: lcourtes@laas.fr--2006-libre/skribilo--devo--1.2--patch-97
Diffstat (limited to 'src')
-rw-r--r-- | src/guile/skribilo/biblio/author.scm | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/guile/skribilo/biblio/author.scm b/src/guile/skribilo/biblio/author.scm index fe4e0e6..785f948 100644 --- a/src/guile/skribilo/biblio/author.scm +++ b/src/guile/skribilo/biblio/author.scm @@ -131,6 +131,14 @@ (define (bib-sort/first-author-last-name entries) ;; May be passed as the `:sort' argument of `the-bibliography'. + (define (maybe-first-author-last-name author) + (cond ((string? author) + (first-author-last-name author)) + (else + ;; AUTHOR cannot be abbreviated, maybe because it is enclosed in a + ;; `noabbrev' markup (e.g., because it's not a person name). + (string-trim (ast->string author))))) + (define (entry-field entry name) (let ((o (markup-option entry name))) (and o (markup-body o)))) @@ -159,10 +167,10 @@ (lambda (e1 e2) (and (check-author e1) (check-author e2) - (let* ((a1 (first-author-last-name - (markup-body (markup-option e1 'author)))) - (a2 (first-author-last-name - (markup-body (markup-option e2 'author))))) + (let ((a1 (maybe-first-author-last-name + (markup-body (markup-option e1 'author)))) + (a2 (maybe-first-author-last-name + (markup-body (markup-option e2 'author))))) (if (string-ci=? a1 a2) (<=? e1 e2 'year (lambda () |