I'm having trouble with the type structure of Scribble and hoping someone can 
help me get this right.

Let's say I want to write content like this:

=====

@exercise{
@question{The expression @code{1 + 2} evaluates to}
@answer{
@itemlist[
@item{@code{2}}
@item{@code{3}}
@item{@code{4}}
]
}
}

=====

That is, an `exercise` contains within it a `question` and an `answer` (and 
maybe other parts). Each of those can contain compound content (text, code, 
itemlists...). In my (HTML) output I would like each of these to have their own 
class tags, so the structure looks like

  <div class="exercise">
    ...
    <div class="question">
      ...
    </div>
    ...
    <div class="answer">
      ...
    </div>
    ...
  </div>

I have set up styles as follows:

  (define exercise-style (make-style "exercise" null))
  (define question-style (make-style "question" null))
  (define answer-style (make-style "answer" null))

What I'm trying to do is create the correct form of "pass-through" abstraction 
for the `exercise`, `question`, and `answer` functions that just attach the 
style and leave everything else alone: e.g.,

  (define (exercise . t) (nested-flow exercise-style t))
  (define (question . t) (nested #:style question-style t))

I have tried a whole bunch of things (`nested`, `nested-flow`, etc.) and cannot 
get anything to work correctly, consistently: each thing I try eventually 
results in a contract violation such as

  make-nested-flow: contract violation
    expected: block?
    given: "\n"

TIA,
Shriram

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to