I think the problem is that you have (build-path md)
where you mean (build-path asymptote-dir md) At Sun, 16 Jan 2011 17:44:40 +0100, Jens Axel Søgaard wrote: > 2011/1/10 Matthew Flatt <[email protected]>: > > At Mon, 10 Jan 2011 10:38:55 +0100, Jens Axel Søgaard wrote: > >> Another small issue (for me): Since Asymptote is used to produce the > >> geometric figures, I can produce both a pdf and a png version of each > >> image. > >> I was expecting/hoping that the Scribble would pick the pdf version > >> when the output format is pdf and png when the output format is html, > >> but Scribble AFAIR just picks one. > > > > Did you try > > > > @image[#:suffixes '(".pdf" ".png") filename-without-suffix] > > > > ? > > Now I remember the problem with the suffix less version. > > Although the source of html-renderer suggests that it calls > install-file on the correct file, something goes wrong. > > Using the code below I get the following error: > > copy-file: source file does not exist; cannot copy: > /Users/soegaard/Dropbox/matematikbog/geometri/geometribogen/3baed4ae12c212682cdd > 916559546fe1 > to: > /Users/soegaard/Dropbox/matematikbog/geometri/geometribogen/3baed4ae12c212682cdd > 916559546fe1 > > === context === > /Users/soegaard/Racket/Racket > v5.0.99.6/collects/scribble/base-render.rkt:692:4: core > /Users/soegaard/Racket/Racket > v5.0.99.6/collects/scribble/html-render.rkt:946:4: render-content > method in ...bble/html-render.rkt:178:2 > /Users/soegaard/Racket/Racket > v5.0.99.6/collects/scribble/base-render.rkt:658:4: render-content > method in render% > /Users/soegaard/Racket/Racket > v5.0.99.6/collects/scribble/html-render.rkt:905:4: do-render-paragraph > method in ...bble/html-render.rkt:178:2 > /Users/soegaard/Racket/Racket > v5.0.99.6/collects/racket/private/map.rkt:18:11: map > /Users/soegaard/Racket/Racket > v5.0.99.6/collects/racket/list.rkt:312:2: append-map > /Users/soegaard/Racket/Racket > v5.0.99.6/collects/scribble/html-render.rkt:1255:4: render-nested-flow > method in ...bble/html-render.rkt:178:2 > /Users/soegaard/Racket/Racket > v5.0.99.6/collects/scribble/html-render.rkt:928:4: > render-intrapara-block method in ...bble/html-render.rkt:178:2 > /Users/soegaard/Racket/Racket > v5.0.99.6/collects/scribble/base-render.rkt:605:4: > render-compound-paragraph method in render% > /Users/soegaard/Racket/Racket > v5.0.99.6/collects/scribble/html-render.rkt:1264:4: > render-compound-paragraph method in ...bble/html-render.rkt:178:2 > /Users/soegaard/Racket/Racket > v5.0.99.6/collects/scribble/html-render.rkt:892:6: loop > ... > > Here the images are > 3baed4ae12c212682cdd916559546fe1.svg > 3baed4ae12c212682cdd916559546fe1.png > 3baed4ae12c212682cdd916559546fe1.pdf > all are generated the subdirectory asymptote-images. > > > And the source is: > > (define (asymptote s . strs) > (define asymptote-dir "asymptote-images") > (let* ([strs (apply string-append (cons s strs))] > [md (bytes->string/utf-8 (md5 strs))] > [asy-name (string-append md ".asy")] > [asy-path (build-path asymptote-dir asy-name)] > [png-name (string-append md ".png")] > [png-path (build-path asymptote-dir png-name)] > [pdf-name (string-append md ".pdf")] > [pdf-path (build-path asymptote-dir pdf-name)] > [svg-name (string-append md ".svg")] > [svg-path (build-path asymptote-dir svg-name)]) > ;; create directory if neccessary > (unless (directory-exists? asymptote-dir) > (make-directory asymptote-dir)) > ;; save asymptote code to <md5-of-input>.asy > (with-output-to-file asy-path > (lambda () (display strs) (newline)) > #:exists 'replace) > (parameterize ([current-directory (build-path (current-directory) > asymptote-dir)]) > (unless (file-exists? svg-name) > (system (format "asy -f svg ~a" asy-name))) > (unless (file-exists? pdf-name) > (system (format "asy -v -f pdf ~a" asy-name))) > (unless (file-exists? png-name) > (system (format "asy -v -f png ~a" asy-name))) > (image (build-path md) #:suffixes (list ".pdf" ".svg" ".png")) ; 1. > ; (image svg-path #:suffixes (list ".svg" #;".pdf" )) ; 2. > ))) > > If I use the line 2 instead of 1, everything works. > Furthermore if I after using line 2 switch back to line 1, it > too works (since the image file now was installed by line 2). > > -- > Jens Axel Søgaard _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

