diff options
author | Ludovic Court`es | 2007-05-04 13:38:47 +0000 |
---|---|---|
committer | Ludovic Court`es | 2007-05-04 13:38:47 +0000 |
commit | f18224ad16296c276583368e9572bced7a57bb53 (patch) | |
tree | 3082df38aeebc0b3c9bce210430b2d026cb82ea0 /src/guile/skribilo/engine/lout.scm | |
parent | 2d553df91dc10ed7cbac0abe0181f3ec6d27f377 (diff) | |
download | skribilo-f18224ad16296c276583368e9572bced7a57bb53.tar.gz skribilo-f18224ad16296c276583368e9572bced7a57bb53.tar.lz skribilo-f18224ad16296c276583368e9572bced7a57bb53.zip |
biblio: Implemented the `name+year' label style.
* src/guile/skribilo/biblio.scm: Use `biblio author'.
(assign-entries-numbers!): New (formerly `count!' in `resolve-the-bib').
(assign-entries-name+years!): New.
(resolve-the-bib): New optional `assign-entries-identifiers!' argument.
Use it.
* src/guile/skribilo/biblio/author.scm (short-author-names): New.
* src/guile/skribilo/engine/lout.scm (lout-bib-refs-sort/number): Accept
non-number identifiers.
(&the-bibliography): Use simply `@TaggedList' when a style other than
`number' is used.
(&bib-entry): Use `@DropTagItem' when the bibliography style is not
`number'.
* src/guile/skribilo/package/base.scm (the-bibliography): New `:labels'
option. Pass the right label assignment function to `resolve-the-bib'.
--This line, and those below, will be ignored--
Files to commit:
src/guile/skribilo/package/base.scm
src/guile/skribilo/engine/lout.scm
src/guile/skribilo/biblio.scm
doc/user/bib.skb
src/guile/skribilo/biblio/author.scm
This list might be incomplete or outdated if editing the log
message was not invoked from an up-to-date changes buffer!
git-archimport-id: lcourtes@laas.fr--2006-libre/skribilo--devo--1.2--patch-51
Diffstat (limited to 'src/guile/skribilo/engine/lout.scm')
-rw-r--r-- | src/guile/skribilo/engine/lout.scm | 104 |
1 files changed, 61 insertions, 43 deletions
diff --git a/src/guile/skribilo/engine/lout.scm b/src/guile/skribilo/engine/lout.scm index 4648217..e00d213 100644 --- a/src/guile/skribilo/engine/lout.scm +++ b/src/guile/skribilo/engine/lout.scm @@ -1,6 +1,7 @@ ;;; lout.scm -- A Lout engine. ;;; -;;; Copyright 2004, 2005, 2006 Ludovic Courtès <ludovic.courtes@laas.fr> +;;; Copyright 2004, 2005, 2006, 2007 +;;; Ludovic Courtès <ludovic.courtes@laas.fr> ;;; ;;; ;;; This program is free software; you can redistribute it and/or modify @@ -21,6 +22,8 @@ ;;; Taken from `lcourtes@laas.fr--2004-libre', ;;; `skribe-lout--main--0.2--patch-15'. ;;; Based on `latex.skr', copyright 2003, 2004 Manuel Serrano. +;;; +;;; For more information on Lout, see http://lout.sf.net/ . (define-skribe-module (skribilo engine lout) @@ -518,8 +521,10 @@ (let ((ident1 (markup-option entry1 :title)) (ident2 (markup-option entry2 :title))) (if (and (markup? ident1) (markup? ident2)) - (< (markup-option ident1 'number) - (markup-option ident2 'number)) + (let ((n1 (markup-option ident1 'number)) + (n2 (markup-option ident2 'number))) + (and (number? n1) (number? n2) + (< n1 n2))) (begin (fprint (current-error-port) "i1: " ident1 ", " entry1) (fprint (current-error-port) "i2: " ident2 ", " entry2))))) @@ -2532,7 +2537,7 @@ (output (car rs) e)) (if (pair? (cdr rs)) (begin - (display ",") + (display ", ") (loop (cdr rs))))))))) :after "]") @@ -2591,44 +2596,45 @@ ;*---------------------------------------------------------------------*/ (markup-writer '&the-bibliography :before (lambda (n e) - ;; Compute the length (in characters) of the longest entry label - ;; so that the label width of the list is adjusted. - (let loop ((entries (markup-body n)) - (label-width 0)) - (if (null? entries) - (begin - (display "\n# the-bibliography\n@LP\n") - ;; usually, the tag with be something like "[7]", hence - ;; the `+ 1' below (`[]' is narrower than 2f) - (printf "@TaggedList labelwidth { ~af }\n" - (+ 1 label-width))) - (loop (cdr entries) - (let ((entry-length - (let liip ((e (car entries))) - (cond - ((markup? e) - (cond ((is-markup? e '&bib-entry) - (liip (markup-option e :title))) - ((is-markup? e '&bib-entry-ident) - (liip (markup-option e 'number))) - (else - (liip (markup-body e))))) - ((string? e) - (string-length e)) - ((number? e) - (liip (number->string e))) - ((list? e) - (apply + (map liip e))) - (else 0))))) -; (fprint (current-error-port) -; "node=" (car entries) -; " body=" (markup-body (car entries)) -; " title=" (markup-option (car entries) -; :title) -; " len=" entry-length) - (if (> label-width entry-length) - label-width - entry-length)))))) + (display "\n# the-bibliography\n@LP\n") + + (case (markup-option n 'labels) + ((number) + ;; Compute the length (in characters) of the longest entry + ;; label so that the label width of the list is adjusted. + (let loop ((entries (markup-body n)) + (label-width 0)) + (if (null? entries) + ;; usually, the tag with be something like "[7]", hence + ;; the `+ 1' below (`[]' is narrower than 2f) + (printf "@TaggedList labelwidth { ~af }\n" + (+ 1 label-width)) + (loop (cdr entries) + (let ((entry-length + (let liip ((e (car entries))) + (cond + ((markup? e) + (cond ((is-markup? e '&bib-entry) + (liip (markup-option e :title))) + ((is-markup? e '&bib-entry-ident) + (liip (markup-option e 'number))) + (else + (liip (markup-body e))))) + ((string? e) + (string-length e)) + ((number? e) + (liip (number->string e))) + ((list? e) + (apply + (map liip e))) + (else 0))))) + + (if (> label-width entry-length) + label-width + entry-length)))))) + + (else ;; `name+year' and others. + (display "@TaggedList\n")))) + :after (lambda (n e) (display "\n@EndList # the-bibliography (end)\n"))) @@ -2637,13 +2643,25 @@ ;*---------------------------------------------------------------------*/ (markup-writer '&bib-entry :options '(:title) - :before "@TagItem " + + :before (lambda (n e) + (let ((ident (markup-option n :title))) + (if (is-markup? ident '&bib-entry-ident) + (let ((number (markup-option ident 'number))) + (cond ((number? number) + (display "@TagItem ")) + (else + ;; probably `name+year'-style. + (display "@DropTagItem ")))) + (display "@TagItem ")))) + :action (lambda (n e) (display " { ") (output n e (markup-writer-get '&bib-entry-label e)) (display " } { ") (output n e (markup-writer-get '&bib-entry-body e)) (display " }")) + :after "\n") ;*---------------------------------------------------------------------*/ |