[racket-dev] conditional scribble documents

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Apr 25 18:38:40 EDT 2012

For HtDP/2e, I use plain old conditionals and variables. 
I used to set an environment variable when I ran a shell
script. Then I converted everything to Racket and set 
variables according to shell arguments: 

 $ ./xhtml draft 

creates the draft version of HtDP/2e by setting a *draft 
variable to #t and in other places I simply write 

 @(if *draft "Draft" "Release")

and such. -- Matthias




On Apr 25, 2012, at 3:58 PM, Danny Yoo wrote:

> 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!
> _________________________
>  Racket Developers list:
>  http://lists.racket-lang.org/dev


Posted on the dev mailing list.