commit 9415df28d5526a8481bd05dd5e76bc91baa71c43
parent 51639146ddbecf4b25381025db4fb3b179a0386a
Author: Sam Tobin-Hochstadt <samth@cs.indiana.edu>
Date: Sun, 19 Jul 2020 21:09:31 -0400
Convert GIF size to string.
Repairs a problem with #232.
Relevant to racket/racket#3300.
Diffstat:
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/scribble-lib/scribble/html-render.rkt b/scribble-lib/scribble/html-render.rkt
@@ -27,6 +27,9 @@
(provide render-mixin
render-multi-mixin)
+(define (number->decimal-string s)
+ (number->string (if (integer? s) s (exact->inexact s))))
+
(define as-literal
(let ([loc (xml:make-location 0 0 0)])
(lambda strings (xml:make-cdata loc loc (string-append* strings)))))
@@ -1470,12 +1473,7 @@
(if (and (not (list? cvt))
(equal? request 'png@2x-bytes))
(/ v 2.0)
- v))]
- [number->decimal-string (lambda (s)
- (number->string
- (if (integer? s)
- s
- (exact->inexact s))))])
+ v))])
(list
(add-padding
cvt
@@ -1508,7 +1506,10 @@
(define height (+ (bytes-ref gif-bytes 8) (* (bytes-ref gif-bytes 9) 256)))
(define image-tag
- `(img ([src ,gif-src] [type "image/gif"] [width ,width] [height ,height])))
+ `(img ([src ,gif-src]
+ [type "image/gif"]
+ [width ,(number->decimal-string width)]
+ [height ,(number->decimal-string height)])))
(list image-tag))]
[else #f])))