aboutsummaryrefslogtreecommitdiff
path: root/src/guile/skribilo/engine/lout.scm
diff options
context:
space:
mode:
authorLudovic Court`es2007-06-29 11:32:41 +0000
committerLudovic Court`es2007-06-29 11:32:41 +0000
commite6880448f8001d0659d69a49d9b16fdf63daaa18 (patch)
tree7b89c8c4769a8eac59c1089240ddb976d72f5df2 /src/guile/skribilo/engine/lout.scm
parent8a1f7eb9754c09f76c1ac79850db6361b62a8915 (diff)
downloadskribilo-e6880448f8001d0659d69a49d9b16fdf63daaa18.tar.gz
skribilo-e6880448f8001d0659d69a49d9b16fdf63daaa18.tar.lz
skribilo-e6880448f8001d0659d69a49d9b16fdf63daaa18.zip
Factorized `bib-ref+', add a `:sort-bib-refs' options to `ref'.
* src/guile/skribilo/biblio.scm (bib-sort-refs/number): New. * src/guile/skribilo/engine/base.scm: Use `%skribilo-module-reader' instead of the Skribe reader. (bib-ref, bib-ref+): New writer. Handle `:sort-bib-refs' in `bib-ref+'. * src/guile/skribilo/engine/context.scm (bib-ref+): Removed. * src/guile/skribilo/engine/html.scm (bib-ref+): Removed. * src/guile/skribilo/engine/latex.scm (bib-ref, bib-ref+): Removed. * src/guile/skribilo/engine/lout.scm (lout-bib-refs-sort/number): Removed. (lout-engine): Documented `bib-refs-sort-proc' as unused. (bib-ref, bib-ref+): Removed. * src/guile/skribilo/package/base.scm (ref): New `:sort-bib-refs' option. [bib-ref]: Add it to the markup's option list. git-archimport-id: lcourtes@laas.fr--2006-libre/skribilo--devo--1.2--patch-80
Diffstat (limited to 'src/guile/skribilo/engine/lout.scm')
-rw-r--r--src/guile/skribilo/engine/lout.scm87
1 files changed, 2 insertions, 85 deletions
diff --git a/src/guile/skribilo/engine/lout.scm b/src/guile/skribilo/engine/lout.scm
index b500488..bc796bd 100644
--- a/src/guile/skribilo/engine/lout.scm
+++ b/src/guile/skribilo/engine/lout.scm
@@ -538,21 +538,6 @@
(output (bold title) engine)
(output title engine)))))
-(define (lout-bib-refs-sort/number entry1 entry2)
- ;; Default implementation of the `bib-refs-sort-proc' custom. Compare
- ;; bibliography entries `entry1' and `entry2' (of type `&bib-entry') for
- ;; use by `sort' in `bib-ref+'.
- (let ((ident1 (markup-option entry1 :title))
- (ident2 (markup-option entry2 :title)))
- (if (and (markup? ident1) (markup? ident2))
- (let ((n1 (markup-option ident1 'number))
- (n2 (markup-option ident2 'number)))
- (and (number? n1) (number? n2)
- (< n1 n2)))
- (begin
- (format (current-error-port) "i1: ~a, ~a" ident1 entry1)
- (format (current-error-port) "i2: ~a, ~a" ident2 entry2)))))
-
(define (lout-pdf-bookmark-title node engine)
;; Default implementation of the `pdf-bookmark-title-proc' custom that
;; returns a title (a string) for the PDF bookmark of `node'.
@@ -636,14 +621,8 @@
(doc-cover-sheet-proc
,lout-make-doc-cover-sheet)
- ;; Procedure used to sort bibliography
- ;; references when several are referred to at
- ;; the same time, as in:
- ;; (ref :bib '("smith03" "jones98")) .
- ;; By default they are sorted by number. If
- ;; `#f' is given, they are left as is.
- (bib-refs-sort-proc
- ,lout-bib-refs-sort/number)
+ ;; Kept for backward compability, do not use.
+ (bib-refs-sort-proc #f)
;; Lout code for paragraph gaps (similar to
;; `@PP' with `@ParaGap' equal to `1.0vx' by
@@ -2458,68 +2437,6 @@
(if show-page-num?
(format #t (lout-page-of ident))))))))))
-
-;*---------------------------------------------------------------------*/
-;* bib-ref ... */
-;*---------------------------------------------------------------------*/
-(markup-writer 'bib-ref
- :options '(:text :bib)
- :before "["
- :action (lambda (n e)
- (let ((entry (handle-ast (markup-body n))))
- (output (markup-option entry :title) e)))
- :after "]")
-
-;*---------------------------------------------------------------------*/
-;* bib-ref+ ... */
-;*---------------------------------------------------------------------*/
-(markup-writer 'bib-ref+
- ;; When several references are passed. Strangely enough, the list of
- ;; entries passed to this writer (as its body) contains both `bib-ref' and
- ;; `bib-entry' objects, hence the `canonicalize-entry' function below.
- :options '(:text :bib)
- :before "["
- :action (lambda (n e)
- (let* ((entries (markup-body n))
- (canonicalize-entry (lambda (x)
- (cond
- ((is-markup? x 'bib-entry) x)
- ((is-markup? x 'bib-ref)
- (handle-ast (markup-body x)))
- ((is-markup? x 'unref) #f)
- (else
- (skribe-error
- 'lout
- "bib-ref+: invalid entry type"
- x)))))
- (help-proc (lambda (proc)
- (lambda (e1 e2)
- (let ((e1 (canonicalize-entry e1))
- (e2 (canonicalize-entry e2)))
- ;; don't pass `unref's to PROC
- (if (and e1 e2)
- (proc e1 e2)
- #f)))))
- (sort-proc (engine-custom e 'bib-refs-sort-proc)))
-
- (let loop ((rs (if sort-proc
- (sort entries (help-proc sort-proc))
- entries)))
- (cond
- ((null? rs)
- #f)
- (else
- (if (is-markup? (car rs) 'bib-ref)
- (invoke (writer-action (markup-writer-get 'bib-ref e))
- (car rs)
- e)
- (output (car rs) e))
- (if (pair? (cdr rs))
- (begin
- (display ", ")
- (loop (cdr rs)))))))))
- :after "]")
-
;*---------------------------------------------------------------------*/
;* lout-make-url-breakable ... */
;*---------------------------------------------------------------------*/