[racket-dev] conditional scribble documents

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Wed Apr 25 15:58:32 EDT 2012

I'm working on building a Scribble extension that lets me write
conditional bits of Scribble code.

Some use cases: 1.  writing a document that can be author-anonymized
2. tutorial material, with solutions to be generated in the document
targetted for teachers.

I do not want to hide or show content with styles: it's too easy to do
"View Source" on an HTML document.  I really do want conditional
generation.


Unlike cond-element, the branch should not be tied to the output
format, but rather to some external parameterization.

However, I don't see a clean way of introducing the parameterization
when Scribble is being executed.  I could hack with the '++xref' flag
so that the module/function I name there will be a no-op in terms of
returning xrefs, but will as a side-effect set up the parameters I
need.  But that makes me feel extremely dirty.

I do want to be able to say something like:

   scribble ... ++load my-module.rkt ...

where my-module.rkt will add the parameterizations I need to generate
conditional content, but of course there's no such thing as "++load"
yet.



Suggestions?  Thanks!

Posted on the dev mailing list.