/usr/share/doc/racket/scribble-pp/text.html is in racket-doc 6.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>1 Text Generation</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="shaded.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_0");">▼</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Scribble as Preprocessor</a></td></tr></table></div><div class="tocviewsublisttop" style="display: block;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Text Generation</a></td></tr><tr><td align="right">2 </td><td><a href="html.html" class="tocviewlink" data-pltdoc="x">HTML Generation</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_1");">►</a></td><td>1 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Text Generation</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">1.1 </td><td><a href="#%28part._.Writing_.Text_.Files%29" class="tocviewlink" data-pltdoc="x">Writing Text Files</a></td></tr><tr><td align="right">1.2 </td><td><a href="#%28part._.Defining_.Functions_and_.More%29" class="tocviewlink" data-pltdoc="x">Defining Functions and More</a></td></tr><tr><td align="right">1.3 </td><td><a href="#%28part._.Using_.Printouts%29" class="tocviewlink" data-pltdoc="x">Using Printouts</a></td></tr><tr><td align="right">1.4 </td><td><a href="#%28part._.Indentation_in_.Preprocessed_output%29" class="tocviewlink" data-pltdoc="x">Indentation in Preprocessed output</a></td></tr><tr><td align="right">1.5 </td><td><a href="#%28part._.Using_.External_.Files%29" class="tocviewlink" data-pltdoc="x">Using External Files</a></td></tr><tr><td align="right">1.6 </td><td><a href="#%28part._.Text_.Generation_.Functions%29" class="tocviewlink" data-pltdoc="x">Text Generation Functions</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber">1.1<tt> </tt></span><a href="#%28part._.Writing_.Text_.Files%29" class="tocsubseclink" data-pltdoc="x">Writing Text Files</a></td></tr><tr><td><span class="tocsublinknumber">1.2<tt> </tt></span><a href="#%28part._.Defining_.Functions_and_.More%29" class="tocsubseclink" data-pltdoc="x">Defining Functions and More</a></td></tr><tr><td><span class="tocsublinknumber">1.3<tt> </tt></span><a href="#%28part._.Using_.Printouts%29" class="tocsubseclink" data-pltdoc="x">Using Printouts</a></td></tr><tr><td><span class="tocsublinknumber">1.4<tt> </tt></span><a href="#%28part._.Indentation_in_.Preprocessed_output%29" class="tocsubseclink" data-pltdoc="x">Indentation in Preprocessed output</a></td></tr><tr><td><span class="tocsublinknumber">1.5<tt> </tt></span><a href="#%28part._.Using_.External_.Files%29" class="tocsubseclink" data-pltdoc="x">Using External Files</a></td></tr><tr><td><span class="tocsublinknumber">1.6<tt> </tt></span><a href="#%28part._.Text_.Generation_.Functions%29" class="tocsubseclink" data-pltdoc="x">Text Generation Functions</a></td></tr><tr><td><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._outputable%2Fc%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">outputable/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._output%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">output</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._block%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">block</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._splice%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">splice</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._disable-prefix%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">disable-<wbr></wbr>prefix</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._restore-prefix%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">restore-<wbr></wbr>prefix</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._add-prefix%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">add-<wbr></wbr>prefix</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._set-prefix%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">set-<wbr></wbr>prefix</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._flush%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">flush</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._with-writer%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">with-<wbr></wbr>writer</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._add-newlines%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">add-<wbr></wbr>newlines</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._split-lines%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">split-<wbr></wbr>lines</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._scribble%2Ftext..rkt%29._include%2Ftext%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">include/<span class="mywbr"> </span>text</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._scribble%2Ftext..rkt%29._begin%2Ftext%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">begin/<span class="mywbr"> </span>text</span></span></a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="index.html" title="backward to "Scribble as Preprocessor"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Scribble as Preprocessor"" data-pltdoc="x">up</a> <a href="html.html" title="forward to "2 HTML Generation"" data-pltdoc="x">next →</a></span> </div><h3 x-source-module="(lib "scribblings/scribble/scribble-pp.scrbl")" x-part-tag=""text"">1<tt> </tt><a name="(part._text)"></a><a name="(mod-path._scribble/text)"></a>Text Generation</h3><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace"> </span><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace"> </span><a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">scribble/text</span></a></td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">scribble-text-lib</span></span></td></tr></table></div><div class="SIntrapara">The <a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">scribble/text</span></a>
language provides everything from <span class="RktSym">racket/base</span>,
<span class="RktSym">racket/promise</span>, <span class="RktSym">racket/list</span>, and
<span class="RktSym">racket/string</span>, but with additions and a changed treatment of
the module top level to make it suitable as for text generation or a
preprocessor language:</div><div class="SIntrapara"><ul><li><p>The language uses <span class="RktSym">read-syntax-inside</span> to read the body
of the module, similar to <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=scribble&rel=docreader.html&version=6.1" class="Sq" data-pltdoc="x">Document Reader</a>. This means that
by default, all text is read in as Racket strings; and
<a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=scribble&rel=reader.html&version=6.1" class="Sq" data-pltdoc="x">@-forms</a> can be used to use Racket
functions and expression escapes.</p></li><li><p>Values of expressions are printed with a custom <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._output%29%29" class="RktValLink" data-pltdoc="x">output</a></span>
function. This function displays most values in a similar way
to <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Writing.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._display%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">display</a></span>, except that it is more convenient for a
textual output.</p></li></ul></div></p><p>When <a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">scribble/text</span></a> is used via <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span>
instead of <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a>, then it does not change the printing of
values, it does not include the bindings of <span class="RktSym">racket/base</span>,
<span class="RktSym"><a href="#%28form._%28%28lib._scribble%2Ftext..rkt%29._include%2Ftext%29%29" class="RktStxLink" data-pltdoc="x">include</a></span> is provided as <span class="RktSym"><a href="#%28form._%28%28lib._scribble%2Ftext..rkt%29._include%2Ftext%29%29" class="RktStxLink" data-pltdoc="x">include/text</a></span>, and
<span class="RktSym"><a href="#%28form._%28%28lib._scribble%2Ftext..rkt%29._begin%2Ftext%29%29" class="RktStxLink" data-pltdoc="x">begin</a></span> is provided as <span class="RktSym"><a href="#%28form._%28%28lib._scribble%2Ftext..rkt%29._begin%2Ftext%29%29" class="RktStxLink" data-pltdoc="x">begin/text</a></span>.</p><h4 x-source-module="(lib "scribblings/scribble/scribble-pp.scrbl")" x-part-tag=""Writing_Text_Files"">1.1<tt> </tt><a name="(part._.Writing_.Text_.Files)"></a>Writing Text Files</h4><p>The combination of the two features makes text in files in the
<span class="RktSym">scribble/text</span> language be read as strings, which get printed
out when the module is <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span>d, for example, when a file is
given as an argument to <span class="stt">racket</span>. (In these example the left
part shows the source input, and the right part the printed result.)</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Programming languages should</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">be designed not by piling</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">feature on top of feature, but</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">blah blah blah.</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">Programming languages should</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">be designed not by piling</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">feature on top of feature, but</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">blah blah blah.</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>Using <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=scribble&rel=reader.html&version=6.1" class="Sq" data-pltdoc="x">@-forms</a>, we can define and use Racket
functions.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(require racket/list)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define Foo "Preprocessing")</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (3x . x)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">;; racket syntax here</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(add-between (list x x x) " "))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@Foo languages should</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">be designed not by piling</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">feature on top of feature, but</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@3x{blah}.</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">Preprocessing languages should</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">be designed not by piling</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">feature on top of feature, but</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">blah blah blah.</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>As demonstrated in this case, the <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._output%29%29" class="RktValLink" data-pltdoc="x">output</a></span> function simply
scans nested list structures recursively, which makes them convenient
for function results. In addition, <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._output%29%29" class="RktValLink" data-pltdoc="x">output</a></span> prints most values
similarly to <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Writing.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._display%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">display</a></span> —<wbr></wbr> notable exceptions are void and
false values which cause no output to appear. This can be used for
convenient conditional output.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (errors n)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(list n</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">" error"</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(and (not (= n 1)) "s")))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">You have @errors[3] in your code,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">I fixed @errors[1].</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">You have 3 errors in your code,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">I fixed 1 error.</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>Using the scribble <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=scribble&rel=reader.html&version=6.1" class="Sq" data-pltdoc="x">@-forms</a> syntax, you can write
functions more conveniently too.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (errors n)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">;; note the use of `unless'</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{@n error@unless[(= n 1)]{s}})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">You have @errors[3] in your code,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">I fixed @errors[1].</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">You have 3 errors in your code,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">I fixed 1 error.</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>Following the details of the scribble reader, you may notice that in
these examples there are newline strings after each definition, yet
they do not show in the output. To make it easier to write
definitions, newlines after definitions and indentation spaces before
them are ignored.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="hspace"> </span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (plural n)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(unless (= n 1) "s"))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="hspace"> </span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (errors n)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{@n error@plural[n]})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="hspace"> </span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">You have @errors[3] in your code,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@(define fixed 1)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">I fixed @errors[fixed].</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">You have 3 errors in your code,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">I fixed 1 error.</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>These end-of-line newline strings are not ignored when they follow
other kinds of expressions, which may lead to redundant empty lines in
the output.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (count n str)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(for/list ([i (in-range 1 (add1 n))])</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{@i @str,@"\n"}))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Start...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@count[3]{Mississippi}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">... and I'm done.</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">Start...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">1 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">2 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">3 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="hspace"> </span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">... and I'm done.</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>There are several ways to avoid having such empty lines in your
output. The simplest way is to arrange for the function call’s form
to end right before the next line begins, but this is often not too
convenient. An alternative is to use a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">@;</span><span class="hspace"></span></span> comment, which
makes the scribble reader ignore everything that follows it up to and
including the newline. (These methods can be applied to the line that
precedes the function call too, but the results are likely to have
what looks like erroneous indentation. More about this below.)</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (count n str)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(for/list ([i (in-range 1 (+ n 1))])</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{@i @str,@"\n"}))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Start...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@count[3]{Mississippi</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">}... done once.</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="hspace"> </span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Start again...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@count[3]{Massachusetts}@;</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">... and I'm done again.</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">Start...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">1 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">2 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">3 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">... done once.</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="hspace"> </span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Start again...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">1 Massachusetts,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">2 Massachusetts,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">3 Massachusetts,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">... and I'm done again.</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>A better approach is to generate newlines only when needed.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(require racket/list)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (counts n str)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(add-between</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(for/list ([i (in-range 1 (+ n 1))])</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{@i @str,})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">"\n"))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Start...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@counts[3]{Mississippi}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">... and I'm done.</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">Start...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">1 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">2 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">3 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">... and I'm done.</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>In fact, this is common enough that the <span class="RktSym">scribble/text</span>
language provides a convenient facility: <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._add-newlines%29%29" class="RktValLink" data-pltdoc="x">add-newlines</a></span> is a
function that is similar to <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Flist..rkt%2529._add-between%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">add-between</a></span> using a newline
string as the default separator, except that false and void values are
filtered out before doing so.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (count n str)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(add-newlines</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(for/list ([i (in-range 1 (+ n 1))])</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{@i @str,})))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Start...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@count[3]{Mississippi}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">... and I'm done.</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">Start...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">1 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">2 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">3 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">... and I'm done.</span></span></p></td></tr></table></blockquote></td></tr></table></p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (count n str)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(add-newlines</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(for/list ([i (in-range 1 (+ n 1))])</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@(and (even? i) @list{@i @str,}))))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Start...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@count[6]{Mississippi}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">... and I'm done.</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">Start...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">2 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">4 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">6 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">... and I'm done.</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>The separator can be set to any value.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (count n str)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(add-newlines #:sep ",\n"</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(for/list ([i (in-range 1 (+ n 1))])</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{@i @str})))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Start...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@count[3]{Mississippi}.</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">... and I'm done.</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">Start...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">1 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">2 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">3 Mississippi.</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">... and I'm done.</span></span></p></td></tr></table></blockquote></td></tr></table></p><h4 x-source-module="(lib "scribblings/scribble/scribble-pp.scrbl")" x-part-tag=""Defining_Functions_and_More"">1.2<tt> </tt><a name="(part._.Defining_.Functions_and_.More)"></a>Defining Functions and More</h4><p>(Note: most of the tips in this section are applicable to any code
that uses the Scribble <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=scribble&rel=reader.html%23%2528tech._%7E40._form%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">@-forms</span></a> syntax.)</p><p>Because the Scribble reader is uniform, you can use it in place of any
expression where it is more convenient. (By convention, we use a
plain S-expression syntax when we want a Racket expression escape, and
an <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=scribble&rel=reader.html%23%2528tech._%7E40._form%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">@-forms</span></a> for expressions that render as text, which, in the
<span class="RktSym">scribble/text</span> language, is any value-producing expression.)
For example, you can use an <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=scribble&rel=reader.html%23%2528tech._%7E40._form%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">@-forms</span></a> for a function that you define.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define @bold[text] @list{*@|text|*})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">An @bold{important} note.</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">An *important* note.</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>This is not commonly done, since most functions that operate with text
will need to accept a variable number of arguments. In fact, this
leads to a common problem: what if we want to write a function that
consumes a number of “text arguments” rathen than a single
“rest-like” body? The common solution for this is to provide the
separate text arguments in the S-expression part of an <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=scribble&rel=reader.html%23%2528tech._%7E40._form%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">@-forms</span></a>.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (choose 1st 2nd)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{Either @1st, or @|2nd|@"."})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define who "us")</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@choose[@list{you're with @who}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{against @who}]</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">Either you're with us, or against us.</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>You can even use <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=scribble&rel=reader.html%23%2528tech._%7E40._form%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">@-forms</span></a>s with a Racket quote or quasiquote as the
“head” part to make it shorter, or use a macro to get grouping of
sub-parts without dealing with quotes.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (choose 1st 2nd)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{Either @1st, or @|2nd|@"."})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define who "us")</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@choose[@list{you're with @who}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{against @who}]</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define-syntax-rule (compare (x ...) ...)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(add-newlines</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(list (list "* " x ...) ...)))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Shopping list:</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@compare[@{apples}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@{oranges}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@{@(* 2 3) bananas}]</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">Either you're with us, or against us.</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Shopping list:</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">* apples</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">* oranges</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">* 6 bananas</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>Yet another solution is to look at the text values and split the input
arguments based on a specific token. Using <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=match.html%23%2528form._%2528%2528lib._racket%252Fmatch..rkt%2529._match%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">match</a></span> can make it
convenient —<wbr></wbr> you can even specify the patterns with <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=scribble&rel=reader.html%23%2528tech._%7E40._form%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">@-forms</span></a>s.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(require racket/match)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (features . text)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(match text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">[@list{@|1st|@...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">---</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@|2nd|@...}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{>> Pros <<</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@1st;</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">>> Cons <<</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@|2nd|.}]))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@features{fast,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">reliable</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">---</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">expensive,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">ugly}</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">>> Pros <<</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">fast,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">reliable;</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">>> Cons <<</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">expensive,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">ugly.</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>In particular, it is often convenient to split the input by lines,
identified by delimiting <span class="RktVal">"\n"</span> strings. Since this can be
useful, a <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._split-lines%29%29" class="RktValLink" data-pltdoc="x">split-lines</a></span> function is provided.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(require racket/list)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (features . text)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(add-between (split-lines text)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">", "))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@features{red</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">fast</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">reliable}.</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">red, fast, reliable.</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>Finally, the Scribble reader accepts <span style="font-style: italic">any</span> expression as the head
part of an @-form —<wbr></wbr> even an @ form. This makes it possible to
get a number of text bodies by defining a curried function, where each
step accepts any number of arguments. This, however, means that the
number of body expressions must be fixed.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define ((choose . 1st) . 2nd)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{Either you're @1st, or @|2nd|.})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define who "me")</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@@choose{with @who}{against @who}</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">Either you're with me, or against me.</span></span></p></td></tr></table></blockquote></td></tr></table></p><h4 x-source-module="(lib "scribblings/scribble/scribble-pp.scrbl")" x-part-tag=""Using_Printouts"">1.3<tt> </tt><a name="(part._.Using_.Printouts)"></a>Using Printouts</h4><p>Because the text language simply displays each toplevel value as the
file is run, it is possible to print text directly as part of the
output.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">First</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@display{Second}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Third</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">First</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Second</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Third</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>Taking this further, it is possible to write functions that output
some text <span style="font-style: italic">instead</span> of returning values that represent the text.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (count n)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(for ([i (in-range 1 (+ n 1))])</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(printf "~a Mississippi,\n" i)))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Start...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@count[3]@; avoid an empty line</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">... and I'm done.</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">Start...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">1 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">2 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">3 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">... and I'm done.</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>This can be used to produce a lot of output text, even infinite.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (count n)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(printf "~a Mississippi,\n" n)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(count (add1 n)))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Start...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@count[1]</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">this line is never printed!</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">Start...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">1 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">2 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">3 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">4 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">5 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">...</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>However, you should be careful not to mix returning values with
printouts, as the results are rarely desirable.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@list{1 @display{two} 3}</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">two1</span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">3</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>Note that you don’t need side-effects if you want infinite output.
The <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._output%29%29" class="RktValLink" data-pltdoc="x">output</a></span> function iterates thunks and (composable)
promises, so you can create a loop that is delayed in either form.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (count n)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(cons @list{@n Mississippi,@"\n"}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(lambda ()</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(count (add1 n)))))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Start...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@count[1]</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">this line is never printed!</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">Start...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">1 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">2 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">3 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">4 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">5 Mississippi,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">...</span></span></p></td></tr></table></blockquote></td></tr></table></p><h4 x-source-module="(lib "scribblings/scribble/scribble-pp.scrbl")" x-part-tag=""Indentation_in_Preprocessed_output"">1.4<tt> </tt><a name="(part._.Indentation_in_.Preprocessed_output)"></a>Indentation in Preprocessed output</h4><p>An issue that can be very important in many text generation applications
is the indentation of the output. This can be crucial in some cases, if
you’re generating code for an indentation-sensitive language (e.g.,
Haskell, Python, or C preprocessor directives). To get a better
understanding of how the pieces interact, you may want to review how the
<a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=scribble&rel=reader.html&version=6.1" class="Sq" data-pltdoc="x">Scribble reader</a> section, but also remember that
you can use quoted forms to see how some form is read.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(format "~s" '@list{</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">a</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">b</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">c})</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">(list "a" "\n" "</span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">" "b" "\n" "c")</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>The Scribble reader ignores indentation spaces in its body. This is an
intentional feature, since you usually do not want an expression to
depend on its position in the source. But the question is whether we
<span style="font-style: italic">can</span> render some output text with proper indentation. The
<span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._output%29%29" class="RktValLink" data-pltdoc="x">output</a></span> function achieves that by introducing <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._block%29%29" class="RktValLink" data-pltdoc="x">block</a></span>s.
Just like a list, a <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._block%29%29" class="RktValLink" data-pltdoc="x">block</a></span> contains a list of elements, and when
one is rendered, it is done in its own indentation level. When a
newline is part of a <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._block%29%29" class="RktValLink" data-pltdoc="x">block</a></span>’s contents, it causes the following
text to appear with indentation that corresponds to the column position
at the beginning of the block.</p><p>In addition, lists are also rendered as blocks by default, so they can
be used for the same purpose. In most cases, this makes the output
appear “as intended” where lists are used for nested pieces of text
—<wbr></wbr> either from a literal <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span> expression, or an expression
that evaluates to a list, or when a list is passed on as a value; either
as a toplevel expression, or as a nested value; either appearing after
spaces, or after other output.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">foo @block{1</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">2</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">3}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">foo @list{4</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">5</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">6}</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">foo 1</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">2</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">3</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">foo 4</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">5</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">6</span></span></p></td></tr></table></blockquote></td></tr></table></p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (code . text)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{begin</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">end})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@code{first</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">second</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@code{</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">third</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">fourth}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">last}</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">begin</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">first</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">second</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">begin</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">third</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">fourth</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">end</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">last</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">end</span></span></p></td></tr></table></blockquote></td></tr></table></p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (enumerate . items)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(add-newlines #:sep ";\n"</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(for/list ([i (in-naturals 1)]</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">[item (in-list items)])</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{@|i|. @item})))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Todo: @enumerate[@list{Install Racket}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{Hack, hack, hack}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{Profit}].</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">Todo: 1. Install Racket;</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">2. Hack, hack, hack;</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">3. Profit.</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>There are, however, cases when you need more refined control over the
output. The <span class="RktSym">scribble/text</span> language provides a few functions
for such cases in addition to <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._block%29%29" class="RktValLink" data-pltdoc="x">block</a></span>. The <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._splice%29%29" class="RktValLink" data-pltdoc="x">splice</a></span>
function groups together a number of values but avoids introducing a new
indentation context. Furthermore, lists are not always rendered as
<span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._block%29%29" class="RktValLink" data-pltdoc="x">block</a></span>s —<wbr></wbr> instead, they are rendered as <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._splice%29%29" class="RktValLink" data-pltdoc="x">splice</a></span>s when
they are used inside one, so you essentially use <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._splice%29%29" class="RktValLink" data-pltdoc="x">splice</a></span> to
avoid the “indentation group” behavior, and <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._block%29%29" class="RktValLink" data-pltdoc="x">block</a></span> to restore
it.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (blah . text)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@splice{{</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">blah(@block{@text});</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">}})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">start</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@splice{foo();</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">loop:}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{if (something) @blah{one,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">two}}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">end</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">start</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">foo();</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">loop:</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">if (something) {</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">blah(one,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">two);</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">end</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>The <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._disable-prefix%29%29" class="RktValLink" data-pltdoc="x">disable-prefix</a></span> function disables all indentation
printouts in its contents, including the indentation before the body
of the <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._disable-prefix%29%29" class="RktValLink" data-pltdoc="x">disable-prefix</a></span> value itself. It is useful, for
example, to print out CPP directives.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (((IFFOO . var) . expr1) . expr2)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(define (array e1 e2)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{[@e1,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@e2]})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{var @var;</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@disable-prefix{#ifdef FOO}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@var = @array[expr1 expr2];</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@disable-prefix{#else}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@var = @array[expr2 expr1];</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@disable-prefix{#endif}})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="hspace"> </span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">function blah(something, something_else) {</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@disable-prefix{#include "stuff.inc"}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@@@IFFOO{i}{something}{something_else}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">}</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">function blah(something, something_else) {</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">#include "stuff.inc"</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">var i;</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">#ifdef FOO</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">i = [something,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">something_else];</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">#else</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">i = [something_else,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">something];</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">#endif</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">}</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>If there are values after a <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._disable-prefix%29%29" class="RktValLink" data-pltdoc="x">disable-prefix</a></span> value on the same
line, they <span style="font-style: italic">will</span> get indented to the goal column (unless the
output is already beyond it).</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (thunk name . body)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{function @name() {</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@body</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">}})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (ifdef cond then else)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{@disable-prefix{#}ifdef @cond</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@then</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@disable-prefix{#}else</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@else</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@disable-prefix{#}endif})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="hspace"> </span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@thunk['do_stuff]{</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">init();</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@ifdef["HAS_BLAH"</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{var x = blah();}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@thunk['blah]{</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@ifdef["BLEHOS"</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{@disable-prefix{#}@;</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">include <bleh.h></span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">bleh();}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{error("no bleh");}]</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">}]</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">more_stuff();</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">}</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">function do_stuff() {</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">init();</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"># ifdef HAS_BLAH</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">var x = blah();</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"># else</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">function blah() {</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">#</span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">ifdef BLEHOS</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">#</span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">include <bleh.h></span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">bleh();</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">#</span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">else</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">error("no bleh");</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">#</span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">endif</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"># endif</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">more_stuff();</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">}</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>There are cases where each line should be prefixed with some string
other than a plain indentation. The <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._add-prefix%29%29" class="RktValLink" data-pltdoc="x">add-prefix</a></span> function
causes its contents to be printed using some given string prefix for
every line. The prefix gets accumulated to an existing indentation,
and indentation in the contents gets added to the prefix.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (comment . body)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@add-prefix["// "]{@body})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@comment{add : int int -> string}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">char *foo(int x, int y) {</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@comment{</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">skeleton:</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">allocate a string</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">print the expression into it</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@comment{...more work...}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">char *buf = malloc(@comment{FIXME!</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">This is bad}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">100);</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">}</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">// add : int int -> string</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">char *foo(int x, int y) {</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">// skeleton:</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">//</span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">allocate a string</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">//</span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">print the expression into it</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">//</span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">// ...more work...</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">char *buf = malloc(// FIXME!</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">// This is bad</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">100);</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">}</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>When combining <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._add-prefix%29%29" class="RktValLink" data-pltdoc="x">add-prefix</a></span> and <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._disable-prefix%29%29" class="RktValLink" data-pltdoc="x">disable-prefix</a></span> there
is an additional value that can be useful: <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._flush%29%29" class="RktValLink" data-pltdoc="x">flush</a></span>. This is a
value that causes <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._output%29%29" class="RktValLink" data-pltdoc="x">output</a></span> to print the current indentation and
prefix. This makes it possible to get the “ignored as a prefix”
property of <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._disable-prefix%29%29" class="RktValLink" data-pltdoc="x">disable-prefix</a></span> but only for a nested prefix.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (comment . text)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(list flush</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@add-prefix[" *"]{</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@disable-prefix{/*} @text */}))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">function foo(x) {</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@comment{blah</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">more blah</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">yet more blah}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">if (x < 0) {</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@comment{even more</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">blah here</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@comment{even</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">nested}}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">do_stuff();</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">}</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">function foo(x) {</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">/* blah</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">* more blah</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">* yet more blah */</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">if (x < 0) {</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">/* even more</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">* blah here</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">* /* even</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">*</span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">* nested */ */</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">do_stuff();</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">}</span></span></p></td></tr></table></blockquote></td></tr></table></p><h4 x-source-module="(lib "scribblings/scribble/scribble-pp.scrbl")" x-part-tag=""Using_External_Files"">1.5<tt> </tt><a name="(part._.Using_.External_.Files)"></a>Using External Files</h4><p>Using additional files that contain code for your preprocessing is
trivial: the source text is still source code in a module, so you can
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span> additional files with utility functions.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(require "itemize.rkt")</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Todo:</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@itemize[@list{Hack some}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{Sleep some}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{Hack some</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">more}]</span></span></p></td></tr></table></blockquote></td></tr><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><blockquote class="Rfilebox"><p class="Rfiletitle"><span class="Rfilename"><span class="stt">"itemize.rkt"</span></span></p><blockquote class="Rfilecontent"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang racket</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">(provide itemize)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">(define (itemize . items)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(add-between (map (lambda (item)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(list "* " item))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">items)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">"\n"))</span></span></p></td></tr></table></blockquote></blockquote></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">Todo:</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">* Hack some</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">* Sleep some</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">* Hack some</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">more</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>Note that the <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=scribble&rel=reader-internals.html%23%2528part._at-exp-lang%2529&version=6.1" class="Sq" data-pltdoc="x"><span class="RktSym">at-exp</span> language</a> can
often be useful here, since such files need to deal with texts. Using
it, it is easy to include a lot of textual content.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(require "stuff.rkt")</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">Todo:</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@itemize[@list{Hack some}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{Sleep some}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{Hack some</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">more}]</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@summary</span></span></p></td></tr></table></blockquote></td></tr><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><blockquote class="Rfilebox"><p class="Rfiletitle"><span class="Rfilename"><span class="stt">"stuff.rkt"</span></span></p><blockquote class="Rfilecontent"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang at-exp racket/base</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">(require racket/list)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">(provide (all-defined-out))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">(define (itemize . items)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(add-between (map (lambda (item)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{* @item})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">items)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">"\n"))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">(define summary</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{If that's not enough,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">I don't know what is.})</span></span></p></td></tr></table></blockquote></blockquote></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">Todo:</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">* Hack some</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">* Sleep some</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">* Hack some</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">more</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">If that's not enough,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">I don't know what is.</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>Of course, the extreme side of this will be to put all of your content
in a plain Racket module, using <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=scribble&rel=reader.html%23%2528tech._%7E40._form%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">@-forms</span></a>s for convenience. However,
there is no need to use the text language in this case; instead, you can
<span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><span class="RktSym">scribble/text</span><span class="RktPn">)</span>, which will get all of the bindings
that are available in the <span class="RktSym">scribble/text</span> language. Using
<span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._output%29%29" class="RktValLink" data-pltdoc="x">output</a></span>, switching from a preprocessed files to a Racket file is
very easy —<wbr></wbr>- choosing one or the other depends on whether it is more
convenient to write a text file with occasional Racket expressions or
the other way.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang at-exp racket/base</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">(require scribble/text racket/list)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">(define (itemize . items)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(add-between (map (lambda (item)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{* @item})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">items)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">"\n"))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">(define summary</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{If that's not enough,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">I don't know what is.})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">(output</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">Todo:</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@itemize[@list{Hack some}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{Sleep some}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{Hack some</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">more}]</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@summary</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">})</span></span></p></td></tr></table></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">Todo:</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">* Hack some</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">* Sleep some</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">* Hack some</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">more</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">If that's not enough,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">I don't know what is.</span></span></p></td></tr></table></blockquote></td></tr></table></p><p>However, you might run into a case where it is desirable to include a
mostly-text file from a <span class="RktSym">scribble/text</span> source file. It might be
because you prefer to split the source text to several files, or because
you need to use a template file that cannot have a <span class="RktInBG"><span class="hspace"></span><span class="RktIn">#lang</span><span class="hspace"></span></span>
header (for example, an HTML template file that is the result of an
external editor). In these cases, the <span class="RktSym">scribble/text</span> language
provides an <span class="RktSym"><a href="#%28form._%28%28lib._scribble%2Ftext..rkt%29._include%2Ftext%29%29" class="RktStxLink" data-pltdoc="x">include</a></span> form that includes a file in the
preprocessor syntax (where the default parsing mode is text).</p><p><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="center"><table cellspacing="0" cellpadding="0"><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt">#lang scribble/text</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(require racket/list)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define (itemize . items)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(list</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">"<ul>"</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(add-between</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">(map (lambda (item)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{<li>@|item|</li>})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">items)</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">"\n")</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">"</ul>"))</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define title "Todo")</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@(define summary</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{If that's not enough,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">I don't know what is.})</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="hspace"> </span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt">@include["template.html"]</span></span></p></td></tr></table></blockquote></td></tr><tr><td align="left" valign="top"><blockquote class="SCodeFlow"><blockquote class="Rfilebox"><p class="Rfiletitle"><span class="Rfilename"><span class="stt">"template.html"</span></span></p><blockquote class="Rfilecontent"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt"><html></span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"><head><title>@|title|</title></head></span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"><body></span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt"><h1>@|title|</h1></span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@itemize[@list{Hack some}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{Sleep some}</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">@list{Hack some</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">more}]</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt"><p><i>@|summary|</i></p></span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></body></span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></html></span></span></p></td></tr></table></blockquote></blockquote></blockquote></td></tr></table></td><td align="left" valign="center" class="Short"><p> → </p></td><td align="left" valign="center"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="Smaller"><span class="stt"><html></span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"><head><title>Todo</title></head></span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"><body></span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt"><h1>Todo</h1></span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt"><ul><li>Hack some</li></span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt"><li>Sleep some</li></span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt"><li>Hack some</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">more</li></ul></span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt"><p><i>If that's not enough,</span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></span></span><span class="Smaller"><span class="hspace"> </span></span><span class="Smaller"><span class="stt">I don't know what is.</i></p></span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></body></span></span></p></td></tr><tr><td><p><span class="Smaller"><span class="stt"></html></span></span></p></td></tr></table></blockquote></td></tr></table></p><p>(Using <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span> with a text file in the <span class="RktSym">scribble/text</span>
language will not work as intended: the language will display the text
is when the module is invoked, so the required file’s contents will be
printed before any of the requiring module’s text does. If you find
yourself in such a situation, it is better to switch to a
Racket-with-@-expressions file as shown above.)</p><h4 x-source-module="(lib "scribblings/scribble/scribble-pp.scrbl")" x-part-tag=""Text_Generation_Functions"">1.6<tt> </tt><a name="(part._.Text_.Generation_.Functions)"></a>Text Generation Functions</h4><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._scribble/text..rkt)._outputable/c))"></a><span title="Provided from: scribble/text | Package: scribble-text-lib"><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._outputable%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">outputable/c</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=contract-utilities.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._contract%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">contract?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A contract that (in principle) corresponds to value that can be output
by <span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._output%29%29" class="RktValLink" data-pltdoc="x">output</a></span>. Currently, however, this contract accepts all
values (to avoid the cost of checking at every boundary).</div></p><p class="SHistory">Added in version 1.1 of package <span class="stt">scribble-text-lib</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._scribble/text..rkt)._output))"></a><span title="Provided from: scribble/text | Package: scribble-text-lib"><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._output%29%29" class="RktValDef RktValLink" data-pltdoc="x">output</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>[<span class="RktVar">port</span>]<span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._outputable%2Fc%29%29" class="RktValLink" data-pltdoc="x">outputable/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">port</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=port-ops.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._output-port%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">output-port?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=port-ops.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._current-output-port%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">current-output-port</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Outputs values to <span class="RktVar">port</span> as follows for each kind of <span class="RktVar">v</span>:</div></p><ul><li><p><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528tech._string%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">strings</span></a>, <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528tech._byte._string%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">byte strings</span></a>, <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=symbols.html%23%2528tech._symbol%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">symbols</span></a>,
<a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pathutils.html%23%2528tech._path%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">paths</span></a>, <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=keywords.html%23%2528tech._keyword%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">keywords</span></a>, <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=numbers.html%23%2528tech._number%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">numbers</span></a>, and
<a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=characters.html%23%2528tech._character%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">characters</span></a>: converts the value to a string along the
same lines as <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Writing.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._display%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">display</a></span>, and then passes the string to
the <a name="(tech._current._writer)"></a><span style="font-style: italic">current writer</span>, which is initially
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Writing.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._display%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">display</a></span></p></li><li><p><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=void_undefined.html&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="nobreak"><span class="RktRes">#<void></span></span></a>, <span class="RktVal">#f</span>, or <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._null%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">null</a></span>: no output</p></li><li><p><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528tech._list%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">list</span></a>: output depends on the current mode, which is
initially <a href="#%28tech._splice._mode%29" class="techoutside" data-pltdoc="x"><span class="techinside">splice mode</span></a>:</p><ul><li><p><a name="(tech._block._mode)"></a><span style="font-style: italic">block mode</span>: each item in order, using the
starting column as the <a name="(tech._current._indentation)"></a><span style="font-style: italic">current
indentation</span> (which starts out empty)</p></li><li><p><a name="(tech._splice._mode)"></a><span style="font-style: italic">splice mode</span>: outputs each item in order</p></li></ul></li><li><p><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._block%29%29" class="RktValLink" data-pltdoc="x">block</a></span><span class="stt"> </span><span class="RktVar">v2</span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span>: outputs each <span class="RktVar">v2</span> in <a href="#%28tech._block._mode%29" class="techoutside" data-pltdoc="x"><span class="techinside">block mode</span></a>.</p></li><li><p><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._splice%29%29" class="RktValLink" data-pltdoc="x">splice</a></span><span class="stt"> </span><span class="RktVar">v2</span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span>: outputs each <span class="RktVar">v2</span> in <a href="#%28tech._splice._mode%29" class="techoutside" data-pltdoc="x"><span class="techinside">splice mode</span></a>.</p></li><li><p><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._set-prefix%29%29" class="RktValLink" data-pltdoc="x">set-prefix</a></span><span class="stt"> </span><span class="RktVar">pfx</span><span class="stt"> </span><span class="RktVar">v2</span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span>: sets the <a name="(tech._current._prefix)"></a><span style="font-style: italic">current
prefix</span>, which is initially empty, to <span class="RktVar">pfx</span> while
outputting each <span class="RktVar">v2</span>.</p></li><li><p><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._add-prefix%29%29" class="RktValLink" data-pltdoc="x">add-prefix</a></span><span class="stt"> </span><span class="RktVar">pfx</span><span class="stt"> </span><span class="RktVar">v2</span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span>: sets the <a href="#%28tech._current._prefix%29" class="techoutside" data-pltdoc="x"><span class="techinside">current
prefix</span></a> to by adding <span class="RktVar">pfx</span> while outputting each
<span class="RktVar">v2</span>.</p></li><li><p><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._disable-prefix%29%29" class="RktValLink" data-pltdoc="x">disable-prefix</a></span><span class="stt"> </span><span class="RktVar">v2</span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span>: sets the <a href="#%28tech._current._prefix%29" class="techoutside" data-pltdoc="x"><span class="techinside">current
prefix</span></a> to empty while outputting each <span class="RktVar">v2</span>.</p></li><li><p><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._restore-prefix%29%29" class="RktValLink" data-pltdoc="x">restore-prefix</a></span><span class="stt"> </span><span class="RktVar">v2</span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span>: rewinds the
<a href="#%28tech._current._prefix%29" class="techoutside" data-pltdoc="x"><span class="techinside">current prefix</span></a> by one enclosing adjustments while
outputting each <span class="RktVar">v2</span>.</p></li><li><p><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._flush%29%29" class="RktValLink" data-pltdoc="x">flush</a></span>: outputs the <a href="#%28tech._current._indentation%29" class="techoutside" data-pltdoc="x"><span class="techinside">current indentation</span></a> and <a href="#%28tech._current._prefix%29" class="techoutside" data-pltdoc="x"><span class="techinside">current prefix</span></a>.</p></li><li><p><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._with-writer%29%29" class="RktValLink" data-pltdoc="x">with-writer</a></span><span class="stt"> </span><span class="RktVar">writer</span><span class="stt"> </span><span class="RktVar">v2</span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span>: sets the <a href="#%28tech._current._writer%29" class="techoutside" data-pltdoc="x"><span class="techinside">current writer</span></a>
to <span class="RktVar">writer</span> with outputting each <span class="RktVar">v2</span>.</p></li><li><p><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Delayed_Evaluation.html%23%2528tech._promise%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">promise</span></a>: outputs the result of <span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Delayed_Evaluation.html%23%2528def._%2528%2528lib._racket%252Fpromise..rkt%2529._force%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">force</a></span><span class="stt"> </span><span class="RktVar">v</span><span class="RktPn">)</span></p></li><li><p><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=boxes.html%23%2528tech._box%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">box</span></a>: outputs the result of <span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=boxes.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._unbox%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">unbox</a></span><span class="stt"> </span><span class="RktVar">v</span><span class="RktPn">)</span></p></li><li><p>procedure of 0 arguments: outputs the result of <span class="RktPn">(</span><span class="RktVar">v</span><span class="RktPn">)</span></p></li></ul><p>Any other kind of <span class="RktVar">v</span> triggers an exception.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._scribble/text..rkt)._block))"></a><span title="Provided from: scribble/text | Package: scribble-text-lib"><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._block%29%29" class="RktValDef RktValLink" data-pltdoc="x">block</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._outputable%2Fc%29%29" class="RktValLink" data-pltdoc="x">outputable/c</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._outputable%2Fc%29%29" class="RktValLink" data-pltdoc="x">outputable/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Produces a value that outputs each <span class="RktVar">v</span> in <a href="#%28tech._block._mode%29" class="techoutside" data-pltdoc="x"><span class="techinside">block mode</span></a>.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._scribble/text..rkt)._splice))"></a><span title="Provided from: scribble/text | Package: scribble-text-lib"><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._splice%29%29" class="RktValDef RktValLink" data-pltdoc="x">splice</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._outputable%2Fc%29%29" class="RktValLink" data-pltdoc="x">outputable/c</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._outputable%2Fc%29%29" class="RktValLink" data-pltdoc="x">outputable/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Produces a value that outputs each <span class="RktVar">v</span> in <a href="#%28tech._splice._mode%29" class="techoutside" data-pltdoc="x"><span class="techinside">splice mode</span></a>.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._scribble/text..rkt)._disable-prefix))"></a><span title="Provided from: scribble/text | Package: scribble-text-lib"><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._disable-prefix%29%29" class="RktValDef RktValLink" data-pltdoc="x">disable-prefix</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._outputable%2Fc%29%29" class="RktValLink" data-pltdoc="x">outputable/c</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._outputable%2Fc%29%29" class="RktValLink" data-pltdoc="x">outputable/c</a></span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._scribble/text..rkt)._restore-prefix))"></a><span title="Provided from: scribble/text | Package: scribble-text-lib"><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._restore-prefix%29%29" class="RktValDef RktValLink" data-pltdoc="x">restore-prefix</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._outputable%2Fc%29%29" class="RktValLink" data-pltdoc="x">outputable/c</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._outputable%2Fc%29%29" class="RktValLink" data-pltdoc="x">outputable/c</a></span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._scribble/text..rkt)._add-prefix))"></a><span title="Provided from: scribble/text | Package: scribble-text-lib"><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._add-prefix%29%29" class="RktValDef RktValLink" data-pltdoc="x">add-prefix</a></span></span><span class="hspace"> </span><span class="RktVar">pfx</span><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._outputable%2Fc%29%29" class="RktValLink" data-pltdoc="x">outputable/c</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">pfx</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._outputable%2Fc%29%29" class="RktValLink" data-pltdoc="x">outputable/c</a></span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._scribble/text..rkt)._set-prefix))"></a><span title="Provided from: scribble/text | Package: scribble-text-lib"><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._set-prefix%29%29" class="RktValDef RktValLink" data-pltdoc="x">set-prefix</a></span></span><span class="hspace"> </span><span class="RktVar">pfx</span><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._outputable%2Fc%29%29" class="RktValLink" data-pltdoc="x">outputable/c</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">pfx</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._outputable%2Fc%29%29" class="RktValLink" data-pltdoc="x">outputable/c</a></span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Produces a value that outputs with an adjusted <a href="#%28tech._current._prefix%29" class="techoutside" data-pltdoc="x"><span class="techinside">current prefix</span></a>.
An integer as a prefix is equivalent to a string with as many space
characters.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._scribble/text..rkt)._flush))"></a><span title="Provided from: scribble/text | Package: scribble-text-lib"><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._flush%29%29" class="RktValDef RktValLink" data-pltdoc="x">flush</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A value that outputs as the <a href="#%28tech._current._indentation%29" class="techoutside" data-pltdoc="x"><span class="techinside">current indentation</span></a> plus <a href="#%28tech._current._prefix%29" class="techoutside" data-pltdoc="x"><span class="techinside">current prefix</span></a>.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._scribble/text..rkt)._with-writer))"></a><span title="Provided from: scribble/text | Package: scribble-text-lib"><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._with-writer%29%29" class="RktValDef RktValLink" data-pltdoc="x">with-writer</a></span></span><span class="hspace"> </span><span class="RktVar">writer</span><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._outputable%2Fc%29%29" class="RktValLink" data-pltdoc="x">outputable/c</a></span></p></blockquote></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace"> </span></td><td><span class="RktVar">writer</span></td><td><span class="hspace"> </span></td><td>:</td><td><span class="hspace"> </span></td><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%252A%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span>*</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=port-ops.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._output-port%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">output-port?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr></table></td></tr></table></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._outputable%2Fc%29%29" class="RktValLink" data-pltdoc="x">outputable/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Produces a value that outputs with an adjusted <a href="#%28tech._current._writer%29" class="techoutside" data-pltdoc="x"><span class="techinside">current writer</span></a>,
where <span class="RktVal">#f</span> indicates <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Byte_and_String_Output.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._write-string%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">write-string</a></span>.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._scribble/text..rkt)._add-newlines))"></a><span title="Provided from: scribble/text | Package: scribble-text-lib"><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._add-newlines%29%29" class="RktValDef RktValLink" data-pltdoc="x">add-newlines</a></span></span><span class="hspace"> </span><span class="RktVar">items</span><span class="hspace"> </span>[<span class="RktPn">#:sep</span><span class="hspace"> </span><span class="RktVar">sep</span>]<span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">items</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">sep</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym">an/y</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">"\n"</span></td></tr></table></blockquote></div><div class="SIntrapara">Like <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528lib._racket%252Flist..rkt%2529._add-between%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">add-between</a></span>, but first removes <span class="RktVal">#f</span> and <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=void_undefined.html&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="nobreak"><span class="RktRes">#<void></span></span></a>
elements of <span class="RktVar">items</span>.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._scribble/text..rkt)._split-lines))"></a><span title="Provided from: scribble/text | Package: scribble-text-lib"><span class="RktSym"><a href="#%28def._%28%28lib._scribble%2Ftext..rkt%29._split-lines%29%29" class="RktValDef RktValLink" data-pltdoc="x">split-lines</a></span></span><span class="hspace"> </span><span class="RktVar">items</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list?</a></span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">items</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Converts <span class="RktVar">items</span> to a list of lists, where consecutive
non-<span class="RktVal">"\n"</span> values are kept together in a nested list, and
<span class="RktVal">"\n"</span> values are dropped.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._scribble/text..rkt)._include/text))"></a><span title="Provided from: scribble/text | Package: scribble-text-lib"><span class="RktSym"><a href="#%28form._%28%28lib._scribble%2Ftext..rkt%29._include%2Ftext%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">include/text</a></span></span><span class="hspace"> </span><span class="RktVar">maybe-char</span><span class="hspace"> </span><span class="RktVar">path-spec</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="stt"> </span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="specgrammar"><tr><td align="right" valign="baseline"><span class="RktVar">maybe-char</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td></td></tr></table></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">#:command-char</span><span class="hspace"> </span><span class="RktVar">command-char</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Like <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=include.html%23%2528form._%2528%2528lib._racket%252Finclude..rkt%2529._include%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">include</a></span> from <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=include.html&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">racket/include</span></a>, but reads the
file at <span class="RktVar">path-spec</span> in the same way as for
<a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">scribble/text</span></a>. If <span class="RktVar">command-char</span> is supplied,
then it replaces <span class="RktInBG"><span class="hspace"></span><span class="RktIn">@</span><span class="hspace"></span></span> as the escape character.</div></p><p>The <a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">scribble/text</span></a> language via <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a> provides
<span class="RktSym"><a href="#%28form._%28%28lib._scribble%2Ftext..rkt%29._include%2Ftext%29%29" class="RktStxLink" data-pltdoc="x">include/text</a></span> as <span class="RktSym"><a href="#%28form._%28%28lib._scribble%2Ftext..rkt%29._include%2Ftext%29%29" class="RktStxLink" data-pltdoc="x">include</a></span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._scribble/text..rkt)._begin/text))"></a><span title="Provided from: scribble/text | Package: scribble-text-lib"><span class="RktSym"><a href="#%28form._%28%28lib._scribble%2Ftext..rkt%29._begin%2Ftext%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">begin/text</a></span></span><span class="hspace"> </span><span class="RktVar">form</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Like <span class="RktSym"><a href="#%28form._%28%28lib._scribble%2Ftext..rkt%29._begin%2Ftext%29%29" class="RktStxLink" data-pltdoc="x">begin</a></span>, but the results of expression <span class="RktSym">forms</span> are
collected into a list that is returned as the result of the
<span class="RktSym">begin/list</span> form.</div></p><p>The <a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">scribble/text</span></a> language via <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a> provides
<span class="RktSym"><a href="#%28form._%28%28lib._scribble%2Ftext..rkt%29._begin%2Ftext%29%29" class="RktStxLink" data-pltdoc="x">begin/text</a></span> as <span class="RktSym"><a href="#%28form._%28%28lib._scribble%2Ftext..rkt%29._begin%2Ftext%29%29" class="RktStxLink" data-pltdoc="x">begin</a></span>.</p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="index.html" title="backward to "Scribble as Preprocessor"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Scribble as Preprocessor"" data-pltdoc="x">up</a> <a href="html.html" title="forward to "2 HTML Generation"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|