On Tue, Jul 30, 2019 at 08:08:39PM +0200, Jens Axel Søgaard wrote: > Den tir. 30. jul. 2019 kl. 19.02 skrev Hendrik Boom <hend...@topoi.pooq.com > >: > > > I've found this as an example for getting coloured text: > > > > #lang scribble/base > > > > @(require scribble/core) > > > > @(define (colorize #:color c . content) > > (elem #:style (style #f (list (color-property c))) > > content)) > > > > @colorize[#:color "red"]{WARNING} > > > > > > But what if you want to call colorize from Racket code. > > For example, to make a function has the colour red built in, > > I tried > > > > @(define (redtext text) (colorize #:color "red" text)) > > > > which did not work. > > > > You are right that the contents isn't a single string, so change it to: > > @(define (redtext . contents) > (colorize #:color "red" contents)) > > @redtext{foo}
This works. It works if the call to redtext is in the same file as the definition. Now for the next problem. If I @include-section, an occurrence of redtext in the included section is recognised as an unbound identifier. Evidently I need to say something to get included sections to inherit bindings fro the main file. -- hendrik -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/20190730185540.xinuoy2hrdaxzc6v%40topoi.pooq.com.