[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Noms de fichiers de sortie
From: |
Valentin Villenave |
Subject: |
Re: Noms de fichiers de sortie |
Date: |
Fri, 3 Apr 2020 21:16:35 +0000 |
On 4/3/20, Olivier Geay <address@hidden> wrote:
> c'est à dire commencer la numérotation des fichiers à 1, car
> généralement je nomme « 1 » le premier exercice !
Grmblbl ça devrait être 0, on n’est pas chez les romains ici… gmblblbl
Enfin, voici comment l’obtenir (il suffit en gros de recopier un gros
bout du fichier scm/lily-library.scm) :
%%%%
#(define (my-print-book-with book process-procedure)
(define (get-current-filename book)
(or (paper-variable book 'output-filename)
(ly:parser-output-name)))
(define (get-current-suffix book)
(let ((book-output-suffix (paper-variable book 'output-suffix)))
(if (not (string? book-output-suffix))
(ly:parser-lookup 'output-suffix)
book-output-suffix)))
(define (get-outfile-name book)
(let* ((base-name (get-current-filename book))
(output-suffix (get-current-suffix book))
(alist-key (format #f "~a~a" base-name output-suffix))
(counter-alist (ly:parser-lookup 'counter-alist))
(output-count (assoc-get alist-key counter-alist 1)) ; 0))
(result base-name))
(if (string? output-suffix)
(set! result
(format #f "~a-~a"
result
(string-regexp-substitute
"[^-[:alnum:]]" "_"
output-suffix))))
; (if (> output-count 0)
(set! result (format #f "~a-~a" result output-count)); )
(ly:parser-define! 'counter-alist
(assoc-set! counter-alist alist-key (1+
output-count)))
(set! current-outfile-name result)
result)) ;)
(let* ((paper (ly:parser-lookup '$defaultpaper))
(layout (ly:parser-lookup '$defaultlayout))
(outfile-name (get-outfile-name book)))
(process-procedure book paper layout outfile-name)))
#(define-public (print-book-with-my-defaults book)
(my-print-book-with book ly:book-process))
#(define toplevel-book-handler print-book-with-my-defaults)
%%%%
Bon courage !
V.
Re: Noms de fichiers de sortie,
Valentin Villenave <=