[racket] Making a section optional in Scribble

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Dec 16 21:27:54 EST 2014

A 'when' expression returns the value of the last expression, in your case the content of the section. By lifting the when out, you get both pieces: 

#lang scribble/base

@(define some-condition #true)

@section{Section one}

Section one is for everyone.

@(when some-condition @section{Section two})
@(when some-condition
   "Section two is for some, but not all.")

This is clearly unsatisfactory but I am sure you can make this look decent with a bit of macrology 

-- Matthias

On Dec 16, 2014, at 9:08 PM, Daniel Prager wrote:

> Thanks Matthias
> I should have been clearer: The conditional part works fine.
> I am challenged to produce a valid element consisting of a section header plus some other stuff. In my example, id some-condition is true, everything compiles and runs, but the Section two heading doesn't appear.
> Dan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141216/31c38b91/attachment.html>

Posted on the users mailing list.