[racket] conditional includes in a Scribble file

From: Todd O'Bryan (toddobryan at gmail.com)
Date: Wed Jun 29 11:01:54 EDT 2011

That was just too easy. Let me see if I can come up with a hard question... :-)

On Wed, Jun 29, 2011 at 10:59 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> Ah --- to flatten at the decode level, use `splice':
>
> @(require scribble/decode)
>
> @(define (only-edition v . text)
>  (splice
>   (if (equal? (edition) v)
>       text
>       '())))
>
>
> At Wed, 29 Jun 2011 10:54:50 -0400, "Todd O'Bryan" wrote:
>> Here's a non-working example:
>> ---------
>> #lang scribble/base
>>
>> @(define edition (make-parameter "default"))
>>
>> @(edition "teacher")
>>
>> @(define (itemlist* . args)
>>   (apply itemlist (filter item? args)))
>>
>> @(define (only-edition v text)
>>   (when (equal? (edition) v)
>>     text))
>>
>> @title{Example}
>>
>> @section{This is a section}
>>
>> And it appears in all versions.
>>
>> @only-edition["teacher"]{
>> @section{This is another section}
>>
>> And it should only appear in the teacher edition.
>> }
>> -----
>>
>> As is, it says @only-edition expects 2 arguments and gets too many. If
>> you put a dot in front of text, it says it's not valid (something
>> about a pre-part). If you change text in the body to (values text) it
>> says that the context expects a single value and got 4.
>>
>> Basically I need to be able to consume and output (or not) an
>> arbitrary sequence of Scribble.
>>
>> Todd
>> On Wed, Jun 29, 2011 at 9:54 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
>> > At Wed, 29 Jun 2011 09:47:16 -0400, "Todd O'Bryan" wrote:
>> >> Any thoughts on the second problem--how to unwrap a (list el1 el2 el3
>> >> ...) so that Scribble interprets it as el1 el2 el3 ... ?
>> >
>> > I'm not sure I understand. Can you give me an example of the problem?
>> >
>> >
>



Posted on the users mailing list.