summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Court`es2007-08-29 13:21:09 +0000
committerLudovic Court`es2007-08-29 13:21:09 +0000
commit3b765c35b128e495991e654c400057112e4b7722 (patch)
tree0f3d3c89122ff4ba04fa68efb8cb9248dd6b979f
parent2da2bb053a1cc252c71966135e7a9b675649ff1d (diff)
parent1cf52b9cef7629a95dc7c3ddf82ea907967d9ca4 (diff)
downloadskribilo-3b765c35b128e495991e654c400057112e4b7722.tar.gz
skribilo-3b765c35b128e495991e654c400057112e4b7722.tar.lz
skribilo-3b765c35b128e495991e654c400057112e4b7722.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: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-155
-rw-r--r--ChangeLog18
-rw-r--r--src/guile/skribilo/biblio/author.scm16
2 files changed, 30 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index ab14ff6..7c20a61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,24 @@
 # arch-tag: automatic-ChangeLog--skribilo@sv.gnu.org--2006/skribilo--devo--1.2
 #
 
+2007-08-29 13:21:09 GMT	Ludovic Court`es <ludovic.courtes@laas.fr>	patch-155
+
+    Summary:
+      biblio: Properly handle non-string authors.
+    Revision:
+      skribilo--devo--1.2--patch-155
+
+    * src/guile/skribilo/biblio/author.scm
+      (bib-sort/first-author-last-name)[maybe-first-author-last-name]: New.
+      Use it.
+
+    modified files:
+     ChangeLog src/guile/skribilo/biblio/author.scm
+
+    new patches:
+     lcourtes@laas.fr--2006-libre/skribilo--devo--1.2--patch-97
+
+
 2007-08-29 13:20:34 GMT	Ludovic Court`es <ludovic.courtes@laas.fr>	patch-154
 
     Summary:
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 ()