[racket] Generating svg-images rather than png-images from Scribble
That hint helped.
I have now added (not comitted yet) a html-property render-pict-as
which has the
values 'png-images and 'svg-images.
The following example, where I set the style for the title works, in
the sense that svgs are
being generated.
#lang scribble/base
@(require scribble/core scribble/html-properties)
@(define svg-style (make-style "svg" (list (render-pict-as 'svg-images))))
@(require (only-in pict standard-fish))
@title[#:style svg-style]{@(standard-fish 100 100)}
However I can't figure out how to set a style for the part that represents
the whole Scribble document.
2013/10/14 Matthew Flatt <mflatt at cs.utah.edu>:
> The relevant method is `render-part`. The `d` argument to the method is
> a part.
>
> In the same way that `current-version` is parameterized by extracting a
> version from the style properties of `d` (see the inherited
> implementation of `extract-version` from "base-render.rkt"), you could
> set the parameter that controls image rendering by looking for
> 'png-images or 'svg-images in the style properties of `d`.
>
> At Mon, 14 Oct 2013 19:36:23 +0200, Jens Axel Søgaard wrote:
>> I took a look at the HTML renderer and have to admit, that I can't see
>> the forest for the trees.
>>
>> 2013/10/14 Matthew Flatt <mflatt at cs.utah.edu>:
>> > At Mon, 14 Oct 2013 18:10:18 +0200, Jens Axel Søgaard wrote:
>> >> The parameter that controls whether pngs or svgs are being used is called
>> >> current-html-render-pict-as. I am not completely sure the way I added
>> >> the parameter is The Right Way, so speak up, if there is another way.
>> >
>> > I think the HTML renderer should recognize an 'svg-images or
>> > 'png-images style property on a `part` and adjust the image conversion
>> > while rendering that part.
>> >
>> > That style property could even work as a replacement for the parameter
>> > (although a parameter may be needed internally). That is, to change the
>> > rendering of a document, a style property could be added to the
>> > document to be rendered instead of setting a global parameter.
>> >
>>
>>
>>
>> --
>> --
>> Jens Axel Søgaard
--
--
Jens Axel Søgaard