Re: [racket-users] Calling function with Scribble text as argument(s)

2019-07-30 Thread Hendrik Boom
On Tue, Jul 30, 2019 at 04:04:38PM -0400, Ben Greenman wrote:
> > 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.
> 
> `include-section` is much closer to Racket's `require` than TeX's `include`

I see.

So the included section has to do its own definition of redtext, or require
it from a common source.

-- 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/20190731024034.2swj2sqr7gxybhni%40topoi.pooq.com.


Re: [racket-users] Calling function with Scribble text as argument(s)

2019-07-30 Thread Ben Greenman
> 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.

`include-section` is much closer to Racket's `require` than TeX's `include`

-- 
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/CAFUu9R7LHUmW163zoBESuTdJeXW-%2B-OHtxbRgz4SuLw0kvWCYA%40mail.gmail.com.


Re: [racket-users] Calling function with Scribble text as argument(s)

2019-07-30 Thread Hendrik Boom
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  >:
> 
> > 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.


Re: [racket-users] Calling function with Scribble text as argument(s)

2019-07-30 Thread Jens Axel Søgaard
Den tir. 30. jul. 2019 kl. 19.02 skrev Hendrik Boom :

> 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}

-- 
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/CABefVgyY1ED0HcbdXvvLGWxQO9j9AFBe99Db8uR16ieJL__J_A%40mail.gmail.com.


[racket-users] Calling function with Scribble text as argument(s)

2019-07-30 Thread Hendrik Boom
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.

Presumably the (summary text) has to accept text as a bunch of 
arguments, not just one.
 and the last argument to colorize needs to be 
understood accordingly.

By analogy to the definition of colorize I probably have to start with
somethng like
@(define (summary . text)  
but then how to pass text to colorize as a bunch of arguments, not 
just one?


-- 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/20190730170158.cng7swt3bq45hfvy%40topoi.pooq.com.