6 Conditional Content
As much as possible, Scribble documents should be independent of the target format for rendering the document. To customize generated output, use styes plus “back end” configurations for each target format (see Extending and Configuring Scribble Output in Scribble: The Racket Documentation Tool).
As a last resort, the cond-element and cond-block forms support varying the document content depending on the target format. More precisely, they generate parts of a document where content is delayed until the traverse pass of document rendering. Format detection relies on the 'scribble:current-render-mode registration that is accessible through a traverse-element or traverse-block.
The syntax of cond-element and cond-block is based on SRFI-0.
(cond-element [feature-requirement body ...+]) (cond-element [feature-requirement body ...+] [else body ...+])
feature-requirement = identifier | (not feature-requirement) | (and feature-requirement ...) | (or feature-requirement ...)
A feature-requirement can be any identifier; a useful identifier is one whose symbol form can appear in a 'scribble:current-render-mode list. The identifier matches when its symbol form is in the 'scribble:current-render-mode list. Typically, the identifier is html, latex, or text to indicate the corresponding rendering target.
A (not feature-requirement) test matches when feature-requirement does not match, and so on. An else clause always matches. If no else clause is present and no clause matches, then the exn:fail:contract exception is raised. Similarly, if the result of the selected body is not content according to content?, then the exn:fail:contract exception is raised.
(cond-block [feature-requirement body ...+]) (cond-block [feature-requirement body ...+] [else body ...+])