You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pollen/doc/Decode.html

2 lines
153 KiB
HTML

<!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>10.2&nbsp;Decode</title><link rel="stylesheet" type="text/css" href="scribble.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"/><script type="text/javascript" src="scribble-common.js"></script><script type="text/javascript" src="manual-racket.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="scribble-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,&quot;tocview_0&quot;);">&#9658;</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Pollen:<span class="mywbr"> &nbsp;</span> the book is a program</a></td></tr></table></div><div class="tocviewsublisttop" style="display: none;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1&nbsp;</td><td><a href="Installation.html" class="tocviewlink" data-pltdoc="x">Installation</a></td></tr><tr><td align="right">2&nbsp;</td><td><a href="quick-tour.html" class="tocviewlink" data-pltdoc="x">Quick tour</a></td></tr><tr><td align="right">3&nbsp;</td><td><a href="Backstory.html" class="tocviewlink" data-pltdoc="x">Backstory</a></td></tr><tr><td align="right">4&nbsp;</td><td><a href="big-picture.html" class="tocviewlink" data-pltdoc="x">The big picture</a></td></tr><tr><td align="right">5&nbsp;</td><td><a href="first-tutorial.html" class="tocviewlink" data-pltdoc="x">First tutorial</a></td></tr><tr><td align="right">6&nbsp;</td><td><a href="second-tutorial.html" class="tocviewlink" data-pltdoc="x">Second tutorial</a></td></tr><tr><td align="right">7&nbsp;</td><td><a href="raco-pollen.html" class="tocviewlink" data-pltdoc="x">Using <span class="stt">raco pollen</span></a></td></tr><tr><td align="right">8&nbsp;</td><td><a href="File_formats.html" class="tocviewlink" data-pltdoc="x">File formats</a></td></tr><tr><td align="right">9&nbsp;</td><td><a href="reader.html" class="tocviewlink" data-pltdoc="x">&#9674; command overview</a></td></tr><tr><td align="right">10&nbsp;</td><td><a href="Module_reference.html" class="tocviewselflink" data-pltdoc="x">Module reference</a></td></tr><tr><td align="right">11&nbsp;</td><td><a href="Acknowledgments.html" class="tocviewlink" data-pltdoc="x">Acknowledgments</a></td></tr><tr><td align="right">12&nbsp;</td><td><a href="License___source_code.html" class="tocviewlink" data-pltdoc="x">License &amp; source code</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,&quot;tocview_1&quot;);">&#9660;</a></td><td>10&nbsp;</td><td><a href="Module_reference.html" class="tocviewlink" data-pltdoc="x">Module reference</a></td></tr></table><div class="tocviewsublist" style="display: block;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">10.1&nbsp;</td><td><a href="Cache.html" class="tocviewlink" data-pltdoc="x">Cache</a></td></tr><tr><td align="right">10.2&nbsp;</td><td><a href="Decode.html" class="tocviewselflink" data-pltdoc="x">Decode</a></td></tr><tr><td align="right">10.3&nbsp;</td><td><a href="file-types.html" class="tocviewlink" data-pltdoc="x">File</a></td></tr><tr><td align="right">10.4&nbsp;</td><td><a href="Pagetree.html" class="tocviewlink" data-pltdoc="x">Pagetree</a></td></tr><tr><td align="right">10.5&nbsp;</td><td><a href="Render.html" class="tocviewlink" data-pltdoc="x">Render</a></td></tr><tr><td align="right">10.6&nbsp;</td><td><a href="Template.html" class="tocviewlink" data-pltdoc="x">Template</a></td></tr><tr><td align="right">10.7&nbsp;</td><td><a href="Tag.html" class="tocviewlink" data-pltdoc="x">Tag</a></td></tr><tr><td align="right">10.8&nbsp;</td><td><a href="Top.html" class="tocviewlink" data-pltdoc="x">Top</a></td></tr><tr><td align="right">10.9&nbsp;</td><td><a href="World.html" class="tocviewlink" data-pltdoc="x">World</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,&quot;tocview_2&quot;);">&#9658;</a></td><td>10.2&nbsp;</td><td><a href="Decode.html" class="tocviewselflink" data-pltdoc="x">Decode</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_2"><table cellspacing="0" cellpadding="0"><tr><td align="right">10.2.1&nbsp;</td><td><a href="Decode.html#%28part._.Block%29" class="tocviewlink" data-pltdoc="x">Block</a></td></tr><tr><td align="right">10.2.2&nbsp;</td><td><a href="Decode.html#%28part._.Typography%29" class="tocviewlink" data-pltdoc="x">Typography</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><a href="#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">decode</span></span></a></td></tr><tr><td><span class="tocsublinknumber">10.2.1<tt>&nbsp;</tt></span><a href="#%28part._.Block%29" class="tocsubseclink" data-pltdoc="x">Block</a></td></tr><tr><td><a href="#%28def._%28%28lib._pollen%2Fdecode..rkt%29._project-block-tags%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">project-<wbr></wbr>block-<wbr></wbr>tags</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._pollen%2Fdecode..rkt%29._register-block-tag%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">register-<wbr></wbr>block-<wbr></wbr>tag</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._pollen%2Fdecode..rkt%29._block-txexpr~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">block-<wbr></wbr>txexpr?</span></span></a></td></tr><tr><td><span class="tocsublinknumber">10.2.2<tt>&nbsp;</tt></span><a href="#%28part._.Typography%29" class="tocsubseclink" data-pltdoc="x">Typography</a></td></tr><tr><td><a href="#%28def._%28%28lib._pollen%2Fdecode..rkt%29._whitespace~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">whitespace?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._pollen%2Fdecode..rkt%29._whitespace%2Fnbsp~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">whitespace/<span class="mywbr"> &nbsp;</span>nbsp?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._pollen%2Fdecode..rkt%29._smart-quotes%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">smart-<wbr></wbr>quotes</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._pollen%2Fdecode..rkt%29._smart-dashes%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">smart-<wbr></wbr>dashes</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-linebreaks%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">detect-<wbr></wbr>linebreaks</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-paragraphs%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">detect-<wbr></wbr>paragraphs</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._pollen%2Fdecode..rkt%29._wrap-hanging-quotes%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">wrap-<wbr></wbr>hanging-<wbr></wbr>quotes</span></span></a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="versionbox"><span class="version">6.0.1.13</span></div><div class="navsettop"><span class="navleft"><div class="nosearchform"></div>&nbsp;&nbsp;</span><span class="navright">&nbsp;&nbsp;<a href="Cache.html" title="backward to &quot;10.1 Cache&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="Module_reference.html" title="up to &quot;10 Module reference&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="file-types.html" title="forward to &quot;10.3 File&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div><h4>10.2<tt>&nbsp;</tt><a name="(part._.Decode)"></a><a name="(mod-path._pollen/decode)"></a>Decode</h4><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="Decode.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">pollen/decode</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller">&nbsp;package:</span> <span class="stt">pollen</span></span></td></tr></table></p><p>The <span class="RktSym">doc</span> export of a Pollen markup file is a simple X-expression. <span style="font-style: italic">Decoding</span> refers to any post-processing of this X-expression. The <span class="RktSym">pollen/decode</span> module provides tools for creating decoders.</p><p>The decode step can happen separately from the compilation of the file. But you can also attach a decoder to the markup file&rsquo;s <span class="RktSym">root</span> node, so the decoding happens automatically when the markup is compiled, and thus automatically incorporated into <span class="RktSym">doc</span>. (Following this approach, you could also attach multiple decoders to different tags within <span class="RktSym">doc</span>.)</p><p>You can, of course, embed function calls within Pollen markup. But since markup is optimized for authors, decoding is useful for operations that can or should be moved out of the authoring layer.</p><p>One example is presentation and layout. For instance, <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-paragraphs%29%29" class="RktValLink" data-pltdoc="x">detect-paragraphs</a></span> is a decoder function that lets authors mark paragraphs in their source simply by using two carriage returns.</p><p>Another example is conversion of output into a particular data format. Most Pollen functions are optimized for HTML output, but one could write a decoder that targets another format.</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><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._pollen/decode..rkt)._decode))"></a><span title="Provided from: pollen/decode | Package: pollen"><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValDef RktValLink" data-pltdoc="x">decode</a></span></span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktVar">tagged-xexpr</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span>[</td><td><span class="RktPn">#:txexpr-tag-proc</span><span class="hspace">&nbsp;</span><span class="RktVar">txexpr-tag-proc</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">#:txexpr-attrs-proc</span><span class="hspace">&nbsp;</span><span class="RktVar">txexpr-attrs-proc</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">#:txexpr-elements-proc</span><span class="hspace">&nbsp;</span><span class="RktVar">txexpr-elements-proc</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">#:block-txexpr-proc</span><span class="hspace">&nbsp;</span><span class="RktVar">block-txexpr-proc</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">#:inline-txexpr-proc</span><span class="hspace">&nbsp;</span><span class="RktVar">inline-txexpr-proc</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">#:string-proc</span><span class="hspace">&nbsp;</span><span class="RktVar">string-proc</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">#:symbol-proc</span><span class="hspace">&nbsp;</span><span class="RktVar">symbol-proc</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">#:valid-char-proc</span><span class="hspace">&nbsp;</span><span class="RktVar">valid-char-proc</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">#:cdata-proc</span><span class="hspace">&nbsp;</span><span class="RktVar">cdata-proc</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">#:exclude-tags</span><span class="hspace">&nbsp;</span><span class="RktVar">tags-to-exclude</span>]<span class="RktPn">)</span></td><td><span class="hspace">&nbsp;</span></td><td>&rarr;</td><td><span class="hspace">&nbsp;</span></td><td><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">tagged-xexpr</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr?</a></span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace">&nbsp;&nbsp;</span></td><td><span class="RktVar">txexpr-tag-proc</span></td><td><span class="hspace">&nbsp;</span></td><td>:</td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr-tag~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr-tag?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr-tag~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr-tag?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td>=</td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/creatingunits.html#%28form._%28%28lib._racket%2Funit..rkt%29._tag%29%29" class="RktStxLink" data-pltdoc="x">tag</a></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/creatingunits.html#%28form._%28%28lib._racket%2Funit..rkt%29._tag%29%29" class="RktStxLink" data-pltdoc="x">tag</a></span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace">&nbsp;&nbsp;</span></td><td><span class="RktVar">txexpr-attrs-proc</span></td><td><span class="hspace">&nbsp;</span></td><td>:</td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr-attrs~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr-attrs?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr-attrs~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr-attrs?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td>=</td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">attrs</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">attrs</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace">&nbsp;&nbsp;</span></td><td><span class="RktVar">txexpr-elements-proc</span></td><td><span class="hspace">&nbsp;</span></td><td>:</td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr-elements~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr-elements?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr-elements~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr-elements?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td>=</td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">elements</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">elements</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">block-txexpr-proc</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._block-txexpr~3f%29%29" class="RktValLink" data-pltdoc="x">block-txexpr?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/xml/index.html#%28def._%28%28lib._xml%2Fprivate%2Fxexpr-core..rkt%29._xexpr~3f%29%29" class="RktValLink" data-pltdoc="x">xexpr?</a></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">tx</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">inline-txexpr-proc</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/xml/index.html#%28def._%28%28lib._xml%2Fprivate%2Fxexpr-core..rkt%29._xexpr~3f%29%29" class="RktValLink" data-pltdoc="x">xexpr?</a></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">tx</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">string-proc</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/xml/index.html#%28def._%28%28lib._xml%2Fprivate%2Fxexpr-core..rkt%29._xexpr~3f%29%29" class="RktValLink" data-pltdoc="x">xexpr?</a></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">str</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">str</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">symbol-proc</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/symbols.html#%28def._%28%28quote._~23~25kernel%29._symbol~3f%29%29" class="RktValLink" data-pltdoc="x">symbol?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/xml/index.html#%28def._%28%28lib._xml%2Fprivate%2Fxexpr-core..rkt%29._xexpr~3f%29%29" class="RktValLink" data-pltdoc="x">xexpr?</a></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">sym</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">sym</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">valid-char-proc</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/xml/index.html#%28def._%28%28lib._xml%2Fmain..rkt%29._valid-char~3f%29%29" class="RktValLink" data-pltdoc="x">valid-char?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/xml/index.html#%28def._%28%28lib._xml%2Fprivate%2Fxexpr-core..rkt%29._xexpr~3f%29%29" class="RktValLink" data-pltdoc="x">xexpr?</a></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">vc</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">vc</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">cdata-proc</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/xml/index.html#%28def._%28%28lib._xml%2Fmain..rkt%29._cdata~3f%29%29" class="RktValLink" data-pltdoc="x">cdata?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/xml/index.html#%28def._%28%28lib._xml%2Fprivate%2Fxexpr-core..rkt%29._xexpr~3f%29%29" class="RktValLink" data-pltdoc="x">xexpr?</a></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/xml/index.html#%28def._%28%28lib._xml%2Fmain..rkt%29._cdata%29%29" class="RktValLink" data-pltdoc="x">cdata</a></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/xml/index.html#%28def._%28%28lib._xml%2Fmain..rkt%29._cdata%29%29" class="RktValLink" data-pltdoc="x">cdata</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">tags-to-exclude</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._listof%29%29" class="RktValLink" data-pltdoc="x">listof</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/symbols.html#%28def._%28%28quote._~23~25kernel%29._symbol~3f%29%29" class="RktValLink" data-pltdoc="x">symbol?</a></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28quote._~23~25kernel%29._null%29%29" class="RktValLink" data-pltdoc="x">null</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Recursively process a <span class="RktVar">tagged-xexpr</span>, usually the one exported from a Pollen source file as <span class="RktSym">doc</span>.</div></p><p>This function doesn&rsquo;t do much on its own. Rather, it provides the hooks upon which harder-working functions can be hung.</p><p>Recall from [future link: Pollen mechanics] that any tag can have a function attached to it. By default, the <span class="RktVar">tagged-xexpr</span> from a source file is tagged with <span class="RktSym">root</span>. So the typical way to use <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span> is to attach your decoding functions to it, and then define <span class="RktSym">root</span> to invoke your <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span> function. Then it will be automatically applied to every <span class="RktSym">doc</span> during compile.</p><p>For instance, here&rsquo;s how <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span> is attached to <span class="RktSym">root</span> in <span style="font-style: italic">Butterick&rsquo;s Practical Typography</span>. There&rsquo;s not much to it &#8212;</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">root</span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym">items</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._make-txexpr%29%29" class="RktValLink" data-pltdoc="x">make-txexpr</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">root</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">)</span><span class="hspace">&nbsp;</span><span class="RktSym">items</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:txexpr-elements-proc</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-paragraphs%29%29" class="RktValLink" data-pltdoc="x">detect-paragraphs</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:block-txexpr-proc</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/procedures.html#%28def._%28%28lib._racket%2Fprivate%2Flist..rkt%29._compose1%29%29" class="RktValLink" data-pltdoc="x">compose1</a></span><span class="hspace">&nbsp;</span><span class="RktSym">hyphenate</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._wrap-hanging-quotes%29%29" class="RktValLink" data-pltdoc="x">wrap-hanging-quotes</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">insert-nonbreaking-last-space</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:string-proc</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/procedures.html#%28def._%28%28lib._racket%2Fprivate%2Flist..rkt%29._compose1%29%29" class="RktValLink" data-pltdoc="x">compose1</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._smart-quotes%29%29" class="RktValLink" data-pltdoc="x">smart-quotes</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._smart-dashes%29%29" class="RktValLink" data-pltdoc="x">smart-dashes</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">#:exclude-tags</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">style</span><span class="hspace">&nbsp;</span><span class="RktVal">script</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>This illustrates another important point: even though <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span> presents an imposing list of arguments, you&rsquo;re unlikely to use all of them at once. These represent possibilities, not requirements. For instance, let&rsquo;s see what happens when <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span> is invoked without any of its optional arguments.</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">root</span><span class="hspace">&nbsp;</span><span class="RktVal">"I wonder"</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">em</span><span class="hspace">&nbsp;</span><span class="RktVal">"why"</span><span class="RktVal">)</span><span class="hspace">&nbsp;</span><span class="RktVal">"this works."</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(root "I wonder" (em "why") "this works.")</span></p></td></tr></table></blockquote></td></tr></table></p><p>Right &#8212;&#160;nothing. That&rsquo;s because the default value for the decoding arguments is the identity function, <span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="stt"> </span><span class="RktSym">x</span><span class="RktPn">)</span>. So all the input gets passed through intact unless another action is specified.</p><p>The <span class="RktVar">*-proc</span> arguments of <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span> take procedures that are applied to specific categories of elements within <span class="RktVar">txexpr</span>.</p><p>The <span class="RktVar">txexpr-tag-proc</span> argument is a procedure that handles X-expression tags.</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">p</span><span class="hspace">&nbsp;</span><span class="RktVal">"I'm from a strange"</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">strong</span><span class="hspace">&nbsp;</span><span class="RktVal">"namespace"</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">Tags are symbols, so a tag-proc should return a symbol</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:txexpr-tag-proc</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">t</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/symbols.html#%28def._%28%28quote._~23~25kernel%29._string-~3esymbol%29%29" class="RktValLink" data-pltdoc="x">string-&gt;symbol</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Writing.html#%28def._%28%28quote._~23~25kernel%29._format%29%29" class="RktValLink" data-pltdoc="x">format</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"ns:~a"</span><span class="hspace">&nbsp;</span><span class="RktSym">t</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(ns:p "I'm from a strange" (ns:strong "namespace"))</span></p></td></tr></table></blockquote></td></tr></table></p><p>The <span class="RktVar">txexpr-attrs-proc</span> argument is a procedure that handles lists of X-expression attributes. (The <a href="http://docs.racket-lang.org/txexpr/index.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">txexpr</span></a> module, included at no extra charge with Pollen, includes useful helper functions for dealing with these attribute lists.)</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">p</span><span class="hspace">&nbsp;</span><span class="RktVal">[</span><span class="RktVal">[</span><span class="RktVal">id</span><span class="hspace">&nbsp;</span><span class="RktVal">"first"</span><span class="RktVal">]</span><span class="RktVal">]</span><span class="hspace">&nbsp;</span><span class="RktVal">"If I only had a brain."</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">Attrs is a list, so cons is OK for simple cases</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:txexpr-attrs-proc</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">attrs</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28quote._~23~25kernel%29._cons%29%29" class="RktValLink" data-pltdoc="x">cons</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">[</span><span class="RktVal">class</span><span class="hspace">&nbsp;</span><span class="RktVal">"PhD"</span><span class="RktVal">]</span><span class="hspace">&nbsp;</span><span class="RktSym">attrs</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(p ((class "PhD") (id "first")) "If I only had a brain.")</span></p></td></tr></table></blockquote></td></tr></table></p><p>Note that <span class="RktVar">txexpr-attrs-proc</span> will change the attributes of every tagged X-expression, even those that don&rsquo;t have attributes. This is useful, because sometimes you want to add attributes where none existed before. But be careful, because the behavior may make your processing function overinclusive.</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">div</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">p</span><span class="hspace">&nbsp;</span><span class="RktVal">[</span><span class="RktVal">[</span><span class="RktVal">id</span><span class="hspace">&nbsp;</span><span class="RktVal">"first"</span><span class="RktVal">]</span><span class="RktVal">]</span><span class="hspace">&nbsp;</span><span class="RktVal">"If I only had a brain."</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVal">(</span><span class="RktVal">p</span><span class="hspace">&nbsp;</span><span class="RktVal">"Me too."</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">This will insert the new attribute everywhere</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:txexpr-attrs-proc</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">attrs</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28quote._~23~25kernel%29._cons%29%29" class="RktValLink" data-pltdoc="x">cons</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">[</span><span class="RktVal">class</span><span class="hspace">&nbsp;</span><span class="RktVal">"PhD"</span><span class="RktVal">]</span><span class="hspace">&nbsp;</span><span class="RktSym">attrs</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="RktRes">'(div</span></p></td></tr><tr><td><p><span class="RktRes"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktRes">((class "PhD"))</span></p></td></tr><tr><td><p><span class="RktRes"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktRes">(p ((class "PhD") (id "first")) "If I only had a brain.")</span></p></td></tr><tr><td><p><span class="RktRes"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktRes">(p ((class "PhD")) "Me too."))</span></p></td></tr></table></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">This will add the new attribute only to non-null attribute lists</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:txexpr-attrs-proc</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">attrs</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/if.html#%28form._%28%28quote._~23~25kernel%29._if%29%29" class="RktStxLink" data-pltdoc="x">if</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28quote._~23~25kernel%29._null~3f%29%29" class="RktValLink" data-pltdoc="x">null?</a></span><span class="hspace">&nbsp;</span><span class="RktSym">attrs</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">attrs</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28quote._~23~25kernel%29._cons%29%29" class="RktValLink" data-pltdoc="x">cons</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">[</span><span class="RktVal">class</span><span class="hspace">&nbsp;</span><span class="RktVal">"PhD"</span><span class="RktVal">]</span><span class="hspace">&nbsp;</span><span class="RktSym">attrs</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktRes">'(div (p ((class "PhD") (id "first")) "If I only had a brain.") (p "Me too."))</span></p></td></tr></table></blockquote></td></tr></table></p><p>The <span class="RktVar">txexpr-elements-proc</span> argument is a procedure that operates on the list of elements that represents the content of each tagged X-expression. Note that each element of an X-expression is subject to two passes through the decoder: once now, as a member of the list of elements, and also later, through its type-specific decoder (i.e., <span class="RktVar">string-proc</span>, <span class="RktVar">symbol-proc</span>, and so on).</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">div</span><span class="hspace">&nbsp;</span><span class="RktVal">"Double"</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">"toil"</span><span class="hspace">&nbsp;</span><span class="RktVal">amp</span><span class="hspace">&nbsp;</span><span class="RktVal">"trouble"</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">Every element gets doubled ...</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:txexpr-elements-proc</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">es</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28lib._racket%2Flist..rkt%29._append-map%29%29" class="RktValLink" data-pltdoc="x">append-map</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">e</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">`</span><span class="RktVal">(</span><span class="RktRdr">,</span><span class="RktSym">e</span><span class="hspace">&nbsp;</span><span class="RktRdr">,</span><span class="RktSym">e</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">es</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(div "Double" "Double" "\n" "\n" "toil" "toil" amp amp "trouble" "trouble")</span></p></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">... but only strings get capitalized</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:txexpr-elements-proc</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">es</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28lib._racket%2Flist..rkt%29._append-map%29%29" class="RktValLink" data-pltdoc="x">append-map</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">e</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">`</span><span class="RktVal">(</span><span class="RktRdr">,</span><span class="RktSym">e</span><span class="hspace">&nbsp;</span><span class="RktRdr">,</span><span class="RktSym">e</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym">es</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">#:string-proc</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">s</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/strings.html#%28def._%28%28quote._~23~25kernel%29._string-upcase%29%29" class="RktValLink" data-pltdoc="x">string-upcase</a></span><span class="hspace">&nbsp;</span><span class="RktSym">s</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktRes">'(div "DOUBLE" "DOUBLE" "\n" "\n" "TOIL" "TOIL" amp amp "TROUBLE" "TROUBLE")</span></p></td></tr></table></blockquote></td></tr></table></p><p>So why do you need <span class="RktVar">txexpr-elements-proc</span>? Because some types of element decoding depend on context, thus it&rsquo;s necessary to handle the elements as a group. For instance, the doubling function above, though useless, requires handling the element list as a whole, because elements are being added.</p><p>A more useful example: paragraph detection. The behavior is not merely a <span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28lib._racket%2Fprivate%2Fmap..rkt%29._map%29%29" class="RktValLink" data-pltdoc="x">map</a></span> across each element:</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">paras</span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:txexpr-elements-proc</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-paragraphs%29%29" class="RktValLink" data-pltdoc="x">detect-paragraphs</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">Context matters. Trailing whitespace is ignored ...</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">paras</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">body</span><span class="hspace">&nbsp;</span><span class="RktVal">"The first paragraph."</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n"</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(body "The first paragraph.")</span></p></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">... but whitespace between strings is converted to a break.</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">paras</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">body</span><span class="hspace">&nbsp;</span><span class="RktVal">"The first paragraph."</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">"And another."</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(body (p "The first paragraph.") (p "And another."))</span></p></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">A combination of both types</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">paras</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">body</span><span class="hspace">&nbsp;</span><span class="RktVal">"The first paragraph."</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">"And another."</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n"</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(body (p "The first paragraph.") (p "And another."))</span></p></td></tr></table></blockquote></td></tr></table></p><p>The <span class="RktVar">block-txexpr-proc</span> argument and the <span class="RktVar">inline-txexpr-proc</span> arguments are procedures that operate on tagged X-expressions. If the X-expression meets the <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._block-txexpr~3f%29%29" class="RktValLink" data-pltdoc="x">block-txexpr?</a></span> test, it is processed by <span class="RktVar">block-txexpr-proc</span>. Otherwise, it is processed by <span class="RktVar">inline-txexpr-proc</span>. Thus every tagged X-expression will be handled by one or the other. Of course, if you want block and inline elements to be handled the same way, you can set <span class="RktVar">block-txexpr-proc</span> and <span class="RktVar">inline-txexpr-proc</span> to be the same procedure.</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">div</span><span class="hspace">&nbsp;</span><span class="RktVal">"Please"</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">em</span><span class="hspace">&nbsp;</span><span class="RktVal">"mind the gap"</span><span class="RktVal">)</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">h1</span><span class="hspace">&nbsp;</span><span class="RktVal">"Tuesdays only"</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">add-ns</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">tx</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._make-txexpr%29%29" class="RktValLink" data-pltdoc="x">make-txexpr</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/symbols.html#%28def._%28%28quote._~23~25kernel%29._string-~3esymbol%29%29" class="RktValLink" data-pltdoc="x">string-&gt;symbol</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Writing.html#%28def._%28%28quote._~23~25kernel%29._format%29%29" class="RktValLink" data-pltdoc="x">format</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"ns:~a"</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._get-tag%29%29" class="RktValLink" data-pltdoc="x">get-tag</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._get-attrs%29%29" class="RktValLink" data-pltdoc="x">get-attrs</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._get-elements%29%29" class="RktValLink" data-pltdoc="x">get-elements</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">div and h1 are block elements, so this will only affect them</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:block-txexpr-proc</span><span class="hspace">&nbsp;</span><span class="RktSym">add-ns</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(ns:div "Please" (em "mind the gap") (ns:h1 "Tuesdays only"))</span></p></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">em is an inline element, so this will only affect it</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:inline-txexpr-proc</span><span class="hspace">&nbsp;</span><span class="RktSym">add-ns</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(div "Please" (ns:em "mind the gap") (h1 "Tuesdays only"))</span></p></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">this will affect all elements</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:block-txexpr-proc</span><span class="hspace">&nbsp;</span><span class="RktSym">add-ns</span><span class="hspace">&nbsp;</span><span class="RktPn">#:inline-txexpr-proc</span><span class="hspace">&nbsp;</span><span class="RktSym">add-ns</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(ns:div "Please" (ns:em "mind the gap") (ns:h1 "Tuesdays only"))</span></p></td></tr></table></blockquote></td></tr></table></p><p>The <span class="RktVar">string-proc</span>, <span class="RktVar">symbol-proc</span>, <span class="RktVar">valid-char-proc</span>, and <span class="RktVar">cdata-proc</span> arguments are procedures that operate on X-expressions that are strings, symbols, valid-chars, and CDATA, respectively. Deliberately, the output contracts for these procedures accept any kind of X-expression (meaning, the procedure can change the X-expression type).</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">A div with string, entity, character, and cdata elements</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktVal">`</span><span class="RktVal">(</span><span class="RktVal">div</span><span class="hspace">&nbsp;</span><span class="RktVal">"Moe"</span><span class="hspace">&nbsp;</span><span class="RktVal">amp</span><span class="hspace">&nbsp;</span><span class="RktVal">62</span><span class="hspace">&nbsp;</span><span class="RktRdr">,</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/xml/index.html#%28def._%28%28lib._xml%2Fmain..rkt%29._cdata%29%29" class="RktValLink" data-pltdoc="x">cdata</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktVal">"3 &gt; 2;"</span><span class="RktPn">)</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">rulify</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">hr</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">The rulify function is selectively applied to each</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:string-proc</span><span class="hspace">&nbsp;</span><span class="RktSym">rulify</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktOut">'(div (hr) amp 62 #(struct:cdata #f #f "3 &gt; 2;"))</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:symbol-proc</span><span class="hspace">&nbsp;</span><span class="RktSym">rulify</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktOut">'(div "Moe" (hr) 62 #(struct:cdata #f #f "3 &gt; 2;"))</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:valid-char-proc</span><span class="hspace">&nbsp;</span><span class="RktSym">rulify</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktOut">'(div "Moe" amp (hr) #(struct:cdata #f #f "3 &gt; 2;"))</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Writing.html#%28def._%28%28quote._~23~25kernel%29._print%29%29" class="RktValLink" data-pltdoc="x">print</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:cdata-proc</span><span class="hspace">&nbsp;</span><span class="RktSym">rulify</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktOut">'(div "Moe" amp 62 (hr))</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr></table></blockquote></td></tr></table></p><p>Finally, the <span class="RktVar">tags-to-exclude</span> argument is a list of tags that will be exempted from decoding. Though you could get the same result by testing the input within the individual decoding functions, that&rsquo;s tedious and potentially slower.</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">p</span><span class="hspace">&nbsp;</span><span class="RktVal">"I really think"</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">em</span><span class="hspace">&nbsp;</span><span class="RktVal">"italics"</span><span class="RktVal">)</span><span class="hspace">&nbsp;</span><span class="RktVal">"should be lowercase."</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:string-proc</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">s</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/strings.html#%28def._%28%28quote._~23~25kernel%29._string-upcase%29%29" class="RktValLink" data-pltdoc="x">string-upcase</a></span><span class="hspace">&nbsp;</span><span class="RktSym">s</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(p "I REALLY THINK" (em "ITALICS") "SHOULD BE LOWERCASE.")</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:string-proc</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">s</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/strings.html#%28def._%28%28quote._~23~25kernel%29._string-upcase%29%29" class="RktValLink" data-pltdoc="x">string-upcase</a></span><span class="hspace">&nbsp;</span><span class="RktSym">s</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">#:exclude-tags</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">em</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(p "I REALLY THINK" (em "italics") "SHOULD BE LOWERCASE.")</span></p></td></tr></table></blockquote></td></tr></table></p><p>The <span class="RktVar">tags-to-exclude</span> argument is useful if you&rsquo;re decoding source that&rsquo;s destined to become HTML. According to the HTML spec, material within a <span class="RktSym">&lt;style&gt;</span> or <span class="RktSym">&lt;script&gt;</span> block needs to be preserved literally. In this example, if the CSS and JavaScript blocks are capitalized, they won&rsquo;t work. So exclude <span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">style</span><span class="stt"> </span><span class="RktVal">script</span><span class="RktVal">)</span>, and problem solved.</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">body</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">h1</span><span class="hspace">&nbsp;</span><span class="RktVal">[</span><span class="RktVal">[</span><span class="RktVal">class</span><span class="hspace">&nbsp;</span><span class="RktVal">"Red"</span><span class="RktVal">]</span><span class="RktVal">]</span><span class="hspace">&nbsp;</span><span class="RktVal">"Let's visit Planet Telex."</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVal">(</span><span class="RktVal">style</span><span class="hspace">&nbsp;</span><span class="RktVal">[</span><span class="RktVal">[</span><span class="RktVal">type</span><span class="hspace">&nbsp;</span><span class="RktVal">"text/css"</span><span class="RktVal">]</span><span class="RktVal">]</span><span class="hspace">&nbsp;</span><span class="RktVal">".Red {color: green;}"</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVal">(</span><span class="RktVal">script</span><span class="hspace">&nbsp;</span><span class="RktVal">[</span><span class="RktVal">[</span><span class="RktVal">type</span><span class="hspace">&nbsp;</span><span class="RktVal">"text/javascript"</span><span class="RktVal">]</span><span class="RktVal">]</span><span class="hspace">&nbsp;</span><span class="RktVal">"var area = h * w;"</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:string-proc</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">s</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/strings.html#%28def._%28%28quote._~23~25kernel%29._string-upcase%29%29" class="RktValLink" data-pltdoc="x">string-upcase</a></span><span class="hspace">&nbsp;</span><span class="RktSym">s</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="RktRes">'(body</span></p></td></tr><tr><td><p><span class="RktRes"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktRes">(h1 ((class "Red")) "LET'S VISIT PLANET TELEX.")</span></p></td></tr><tr><td><p><span class="RktRes"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktRes">(style ((type "text/css")) ".RED {COLOR: GREEN;}")</span></p></td></tr><tr><td><p><span class="RktRes"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktRes">(script ((type "text/javascript")) "VAR AREA = H * W;"))</span></p></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:string-proc</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">s</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/strings.html#%28def._%28%28quote._~23~25kernel%29._string-upcase%29%29" class="RktValLink" data-pltdoc="x">string-upcase</a></span><span class="hspace">&nbsp;</span><span class="RktSym">s</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">#:exclude-tags</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">style</span><span class="hspace">&nbsp;</span><span class="RktVal">script</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="RktRes">'(body</span></p></td></tr><tr><td><p><span class="RktRes"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktRes">(h1 ((class "Red")) "LET'S VISIT PLANET TELEX.")</span></p></td></tr><tr><td><p><span class="RktRes"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktRes">(style ((type "text/css")) ".Red {color: green;}")</span></p></td></tr><tr><td><p><span class="RktRes"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktRes">(script ((type "text/javascript")) "var area = h * w;"))</span></p></td></tr></table></td></tr></table></blockquote></td></tr></table></p><h5>10.2.1<tt>&nbsp;</tt><a name="(part._.Block)"></a>Block</h5><p>Because it&rsquo;s convenient, Pollen categorizes tagged X-expressions into two categories: <span style="font-style: italic">block</span> and <span style="font-style: italic">inline</span>. Why is it convenient? When using <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span>, you often want to treat the two categories differently. Not that you have to. But this is how you can.</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>parameter</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._pollen/decode..rkt)._project-block-tags))"></a><span title="Provided from: pollen/decode | Package: pollen"><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._project-block-tags%29%29" class="RktValDef RktValLink" data-pltdoc="x">project-block-tags</a></span></span><span class="RktPn"></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._listof%29%29" class="RktValLink" data-pltdoc="x">listof</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr-tag~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr-tag?</a></span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="RktPn">(</span><span title="Provided from: pollen/decode | Package: pollen"><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._project-block-tags%29%29" class="RktValDef RktValLink" data-pltdoc="x">project-block-tags</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">block-tags</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/void.html#%28def._%28%28quote._~23~25kernel%29._void~3f%29%29" class="RktValLink" data-pltdoc="x">void?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">block-tags</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._listof%29%29" class="RktValLink" data-pltdoc="x">listof</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr-tag~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr-tag?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">A parameter that defines the set of tags that <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span> will treat as blocks. This parameter is initialized with the HTML block tags, namely:</div></p><p><span class="RktPn">(</span><span class="RktSym">address</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">article</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">aside</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">audio</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">blockquote</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">body</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">canvas</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">dd</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">div</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">dl</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">fieldset</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">figcaption</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">figure</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">footer</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">form</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">h1</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">h2</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">h3</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">h4</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">h5</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">h6</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">header</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">hgroup</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">noscript</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">ol</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">output</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">p</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">pre</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">section</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">table</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">tfoot</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">ul</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">video</span><span class="RktPn">)</span><span class="RktMeta"></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._pollen/decode..rkt)._register-block-tag))"></a><span title="Provided from: pollen/decode | Package: pollen"><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._register-block-tag%29%29" class="RktValDef RktValLink" data-pltdoc="x">register-block-tag</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">tag</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/void.html#%28def._%28%28quote._~23~25kernel%29._void~3f%29%29" class="RktValLink" data-pltdoc="x">void?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">tag</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr-tag~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr-tag?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Adds a tag to <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._project-block-tags%29%29" class="RktValLink" data-pltdoc="x">project-block-tags</a></span> so that <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._block-txexpr~3f%29%29" class="RktValLink" data-pltdoc="x">block-txexpr?</a></span> will report it as a block, and <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span> will process it with <span class="RktVar">block-txexpr-proc</span> rather than <span class="RktVar">inline-txexpr-proc</span>.</div></p><p>Pollen tries to do the right thing without being told. But this is the rare case where you have to be explicit. If you introduce a tag into your markup that you want treated as a block, you <span style="font-weight: bold">must</span> use this function to identify it, or you will get spooky behavior later on.</p><p>For instance, <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-paragraphs%29%29" class="RktValLink" data-pltdoc="x">detect-paragraphs</a></span> knows that block elements in the markup shouldn&rsquo;t be wrapped in a <span class="RktSym">p</span> tag. So if you introduce a new block element called <span class="RktSym">bloq</span> without registering it as a block, misbehavior will follow:</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">paras</span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:txexpr-elements-proc</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-paragraphs%29%29" class="RktValLink" data-pltdoc="x">detect-paragraphs</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">paras</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">body</span><span class="hspace">&nbsp;</span><span class="RktVal">"I want to be a paragraph."</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">bloq</span><span class="hspace">&nbsp;</span><span class="RktVal">"But not me."</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(body (p "I want to be a paragraph.") (p (bloq "But not me.")))</span></p></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">Wrong: bloq should not be wrapped</span></td></tr></table></blockquote></td></tr></table></p><p>But once you register <span class="RktSym">bloq</span> as a block, order is restored:</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">paras</span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:txexpr-elements-proc</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-paragraphs%29%29" class="RktValLink" data-pltdoc="x">detect-paragraphs</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._register-block-tag%29%29" class="RktValLink" data-pltdoc="x">register-block-tag</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">bloq</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">paras</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">body</span><span class="hspace">&nbsp;</span><span class="RktVal">"I want to be a paragraph."</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">bloq</span><span class="hspace">&nbsp;</span><span class="RktVal">"But not me."</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(body (p "I want to be a paragraph.") (bloq "But not me."))</span></p></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">Right: bloq is treated as a block</span></td></tr></table></blockquote></td></tr></table></p><p>If you find the idea of registering block tags unbearable, good news. The <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._project-block-tags%29%29" class="RktValLink" data-pltdoc="x">project-block-tags</a></span> include the standard HTML block tags by default. So if you just want to use things like <span class="RktSym">div</span> and <span class="RktSym">p</span> and <span class="RktSym">h1&#8211;h6</span>, you&rsquo;ll get the right behavior for free.</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">paras</span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tx</span><span class="hspace">&nbsp;</span><span class="RktPn">#:txexpr-elements-proc</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-paragraphs%29%29" class="RktValLink" data-pltdoc="x">detect-paragraphs</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">paras</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">body</span><span class="hspace">&nbsp;</span><span class="RktVal">"I want to be a paragraph."</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">div</span><span class="hspace">&nbsp;</span><span class="RktVal">"But not me."</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(body (p "I want to be a paragraph.") (div "But not me."))</span></p></td></tr></table></blockquote></td></tr></table></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._pollen/decode..rkt)._block-txexpr~3f))"></a><span title="Provided from: pollen/decode | Package: pollen"><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._block-txexpr~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">block-txexpr?</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Predicate that tests whether <span class="RktVar">v</span> is a tagged X-expression, and if so, whether the tag is among the <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._project-block-tags%29%29" class="RktValLink" data-pltdoc="x">project-block-tags</a></span>. If not, it is treated as inline. To adjust how this test works, use <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._register-block-tag%29%29" class="RktValLink" data-pltdoc="x">register-block-tag</a></span>.</div></p><h5>10.2.2<tt>&nbsp;</tt><a name="(part._.Typography)"></a>Typography</h5><p>An assortment of typography &amp; layout functions, designed to be used with <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._decode%29%29" class="RktValLink" data-pltdoc="x">decode</a></span>. These aren&rsquo;t hard to write. So if you like these, use them. If not, make your own.</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._pollen/decode..rkt)._whitespace~3f))"></a><span title="Provided from: pollen/decode | Package: pollen"><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._whitespace~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">whitespace?</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">A predicate that returns <span class="RktVal">#t</span> for any stringlike <span class="RktVar">v</span> that&rsquo;s entirely whitespace, but also the empty string, as well as lists and vectors that are made only of <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._whitespace~3f%29%29" class="RktValLink" data-pltdoc="x">whitespace?</a></span> members. Following the <span class="RktSym"><a href="http://docs.racket-lang.org/reference/regexp.html#%28def._%28%28quote._~23~25kernel%29._regexp-match%29%29" class="RktValLink" data-pltdoc="x">regexp-match</a></span> convention, <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._whitespace~3f%29%29" class="RktValLink" data-pltdoc="x">whitespace?</a></span> does not return <span class="RktVal">#t</span> for a nonbreaking space. If you prefer that behavior, use <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._whitespace%2Fnbsp~3f%29%29" class="RktValLink" data-pltdoc="x">whitespace/nbsp?</a></span>.</div></p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._whitespace~3f%29%29" class="RktValLink" data-pltdoc="x">whitespace?</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n</span><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktVal">"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._whitespace~3f%29%29" class="RktValLink" data-pltdoc="x">whitespace?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/symbols.html#%28def._%28%28quote._~23~25kernel%29._string-~3esymbol%29%29" class="RktValLink" data-pltdoc="x">string-&gt;symbol</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n</span><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktVal">"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._whitespace~3f%29%29" class="RktValLink" data-pltdoc="x">whitespace?</a></span><span class="hspace">&nbsp;</span><span class="RktVal">""</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._whitespace~3f%29%29" class="RktValLink" data-pltdoc="x">whitespace?</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">""</span><span class="hspace">&nbsp;</span><span class="RktVal">"</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktVal">"</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">" \n"</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">nonbreaking-space</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Writing.html#%28def._%28%28quote._~23~25kernel%29._format%29%29" class="RktValLink" data-pltdoc="x">format</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"~a"</span><span class="hspace">&nbsp;</span><span class="RktVal">#\u00A0</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._whitespace~3f%29%29" class="RktValLink" data-pltdoc="x">whitespace?</a></span><span class="hspace">&nbsp;</span><span class="RktSym">nonbreaking-space</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#f</span></p></td></tr></table></blockquote></td></tr></table></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._pollen/decode..rkt)._whitespace/nbsp~3f))"></a><span title="Provided from: pollen/decode | Package: pollen"><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._whitespace%2Fnbsp~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">whitespace/nbsp?</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Like <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._whitespace~3f%29%29" class="RktValLink" data-pltdoc="x">whitespace?</a></span>, but also returns <span class="RktVal">#t</span> for nonbreaking spaces.</div></p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._whitespace%2Fnbsp~3f%29%29" class="RktValLink" data-pltdoc="x">whitespace/nbsp?</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n</span><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktVal">"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._whitespace%2Fnbsp~3f%29%29" class="RktValLink" data-pltdoc="x">whitespace/nbsp?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/symbols.html#%28def._%28%28quote._~23~25kernel%29._string-~3esymbol%29%29" class="RktValLink" data-pltdoc="x">string-&gt;symbol</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n</span><span class="hspace">&nbsp;&nbsp;&nbsp;</span><span class="RktVal">"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._whitespace%2Fnbsp~3f%29%29" class="RktValLink" data-pltdoc="x">whitespace/nbsp?</a></span><span class="hspace">&nbsp;</span><span class="RktVal">""</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._whitespace%2Fnbsp~3f%29%29" class="RktValLink" data-pltdoc="x">whitespace/nbsp?</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">""</span><span class="hspace">&nbsp;</span><span class="RktVal">"</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktVal">"</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">" \n"</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">nonbreaking-space</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Writing.html#%28def._%28%28quote._~23~25kernel%29._format%29%29" class="RktValLink" data-pltdoc="x">format</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"~a"</span><span class="hspace">&nbsp;</span><span class="RktVal">#\u00A0</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._whitespace%2Fnbsp~3f%29%29" class="RktValLink" data-pltdoc="x">whitespace/nbsp?</a></span><span class="hspace">&nbsp;</span><span class="RktSym">nonbreaking-space</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr></table></blockquote></td></tr></table></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._pollen/decode..rkt)._smart-quotes))"></a><span title="Provided from: pollen/decode | Package: pollen"><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._smart-quotes%29%29" class="RktValDef RktValLink" data-pltdoc="x">smart-quotes</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">str</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">str</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Convert straight quotes in <span class="RktVar">str</span> to curly according to American English conventions.</div></p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tricky-string</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVal">"\"Why,\" she could've asked, \"are we in O&#8216;ahu watching 'Mame'?\""</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tricky-string</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktOut">"Why," she could've asked, "are we in O&#8216;ahu watching 'Mame'?"</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._smart-quotes%29%29" class="RktValLink" data-pltdoc="x">smart-quotes</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tricky-string</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktOut">&#8220;Why,&#8221; she could&#8217;ve asked, &#8220;are we in O&#8216;ahu watching &#8216;Mame&#8217;?&#8221;</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr></table></blockquote></td></tr></table></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._pollen/decode..rkt)._smart-dashes))"></a><span title="Provided from: pollen/decode | Package: pollen"><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._smart-dashes%29%29" class="RktValDef RktValLink" data-pltdoc="x">smart-dashes</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">str</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">str</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">In <span class="RktVar">str</span>, convert three hyphens to an em dash, and two hyphens to an en dash, and remove surrounding spaces.</div></p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tricky-string</span><span class="hspace">&nbsp;</span><span class="RktVal">"I had a few --- OK, like 6--8 --- thin mints."</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tricky-string</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktOut">I had a few --- OK, like 6--8 --- thin mints.</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._smart-dashes%29%29" class="RktValLink" data-pltdoc="x">smart-dashes</a></span><span class="hspace">&nbsp;</span><span class="RktSym">tricky-string</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktOut">I had a few&#8212;OK, like 6&#8211;8&#8212;thin mints.</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">Monospaced font not great for showing dashes, but you get the idea</span></td></tr></table></blockquote></td></tr></table></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><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._pollen/decode..rkt)._detect-linebreaks))"></a><span title="Provided from: pollen/decode | Package: pollen"><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-linebreaks%29%29" class="RktValDef RktValLink" data-pltdoc="x">detect-linebreaks</a></span></span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktVar">tagged-xexpr-elements</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span>[</td><td><span class="RktPn">#:separator</span><span class="hspace">&nbsp;</span><span class="RktVar">linebreak-sep</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">#:insert</span><span class="hspace">&nbsp;</span><span class="RktVar">linebreak</span>]<span class="RktPn">)</span></td><td><span class="hspace">&nbsp;</span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr-elements~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr-elements?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">tagged-xexpr-elements</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr-elements~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr-elements?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">linebreak-sep</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktSym"><a href="World.html#%28def._%28%28lib._pollen%2Fworld..rkt%29._world~3alinebreak-separator%29%29" class="RktValLink" data-pltdoc="x">world:linebreak-separator</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">linebreak</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/xml/index.html#%28def._%28%28lib._xml%2Fprivate%2Fxexpr-core..rkt%29._xexpr~3f%29%29" class="RktValLink" data-pltdoc="x">xexpr?</a></span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">br</span><span class="RktVal">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Within <span class="RktVar">tagged-xexpr-elements</span>, convert occurrences of <span class="RktVar">linebreak-sep</span> (<span class="RktVal">"\n"</span> by default) to <span class="RktVar">linebreak</span>, but only if <span class="RktVar">linebreak-sep</span> does not occur between blocks (see <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._block-txexpr~3f%29%29" class="RktValLink" data-pltdoc="x">block-txexpr?</a></span>). Why? Because block-level elements automatically display on a new line, so adding <span class="RktVar">linebreak</span> would be superfluous. In that case, <span class="RktVar">linebreak-sep</span> just disappears.</div></p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-linebreaks%29%29" class="RktValLink" data-pltdoc="x">detect-linebreaks</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">div</span><span class="hspace">&nbsp;</span><span class="RktVal">"Two items:"</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">em</span><span class="hspace">&nbsp;</span><span class="RktVal">"Eggs"</span><span class="RktVal">)</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">em</span><span class="hspace">&nbsp;</span><span class="RktVal">"Bacon"</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(div "Two items:" (br) (em "Eggs") (br) (em "Bacon"))</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-linebreaks%29%29" class="RktValLink" data-pltdoc="x">detect-linebreaks</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">div</span><span class="hspace">&nbsp;</span><span class="RktVal">"Two items:"</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">div</span><span class="hspace">&nbsp;</span><span class="RktVal">"Eggs"</span><span class="RktVal">)</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">div</span><span class="hspace">&nbsp;</span><span class="RktVal">"Bacon"</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(div "Two items:" (div "Eggs") (div "Bacon"))</span></p></td></tr></table></blockquote></td></tr></table></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><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._pollen/decode..rkt)._detect-paragraphs))"></a><span title="Provided from: pollen/decode | Package: pollen"><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-paragraphs%29%29" class="RktValDef RktValLink" data-pltdoc="x">detect-paragraphs</a></span></span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktVar">elements</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span>[</td><td><span class="RktPn">#:separator</span><span class="hspace">&nbsp;</span><span class="RktVar">paragraph-sep</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">#:tag</span><span class="hspace">&nbsp;</span><span class="RktVar">paragraph-tag</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">#:linebreak-proc</span><span class="hspace">&nbsp;</span><span class="RktVar">linebreak-proc</span>]<span class="RktPn">)</span></td><td><span class="hspace">&nbsp;</span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr-elements~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr-elements?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">elements</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr-elements~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr-elements?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">paragraph-sep</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktSym"><a href="World.html#%28def._%28%28lib._pollen%2Fworld..rkt%29._world~3aparagraph-separator%29%29" class="RktValLink" data-pltdoc="x">world:paragraph-separator</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">paragraph-tag</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/symbols.html#%28def._%28%28quote._~23~25kernel%29._symbol~3f%29%29" class="RktValLink" data-pltdoc="x">symbol?</a></span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">p</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace">&nbsp;&nbsp;</span></td><td><span class="RktVar">linebreak-proc</span></td><td><span class="hspace">&nbsp;</span></td><td>:</td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr-elements~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr-elements?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr-elements~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr-elements?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td>=</td><td><span class="hspace">&nbsp;</span></td><td><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-linebreaks%29%29" class="RktValLink" data-pltdoc="x">detect-linebreaks</a></span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Find paragraphs within <span class="RktVar">elements</span>, as denoted by <span class="RktVar">paragraph-sep</span>, and wrap them with <span class="RktVar">paragraph-tag</span>, unless the <span class="RktVar">element</span> is already a <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._block-txexpr~3f%29%29" class="RktValLink" data-pltdoc="x">block-txexpr?</a></span> (because in that case, the wrapping is superfluous). Thus, as a consequence, if <span class="RktVar">paragraph-sep</span> occurs between two blocks, it&rsquo;s ignored.</div></p><p>The <span class="RktVar">paragraph-tag</span> argument sets the tag used to wrap paragraphs.</p><p>The <span class="RktVar">linebreak-proc</span> argument allows you to use a different linebreaking procedure other than the usual <span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-linebreaks%29%29" class="RktValLink" data-pltdoc="x">detect-linebreaks</a></span>.</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-paragraphs%29%29" class="RktValLink" data-pltdoc="x">detect-paragraphs</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">"First para"</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">"Second para"</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'((p "First para") (p "Second para"))</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-paragraphs%29%29" class="RktValLink" data-pltdoc="x">detect-paragraphs</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">"First para"</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">"Second para"</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">"Second line"</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'((p "First para") (p "Second para" (br) "Second line"))</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-paragraphs%29%29" class="RktValLink" data-pltdoc="x">detect-paragraphs</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">"First para"</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">div</span><span class="hspace">&nbsp;</span><span class="RktVal">"Second block"</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'((p "First para") (div "Second block"))</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-paragraphs%29%29" class="RktValLink" data-pltdoc="x">detect-paragraphs</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">(</span><span class="RktVal">div</span><span class="hspace">&nbsp;</span><span class="RktVal">"First block"</span><span class="RktVal">)</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">div</span><span class="hspace">&nbsp;</span><span class="RktVal">"Second block"</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'((div "First block") (div "Second block"))</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-paragraphs%29%29" class="RktValLink" data-pltdoc="x">detect-paragraphs</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">"First para"</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">"Second para"</span><span class="RktVal">)</span><span class="hspace">&nbsp;</span><span class="RktPn">#:tag</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">ns:p</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'((ns:p "First para") (ns:p "Second para"))</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-paragraphs%29%29" class="RktValLink" data-pltdoc="x">detect-paragraphs</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">"First para"</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">"Second para"</span><span class="hspace">&nbsp;</span><span class="RktVal">"\n"</span><span class="hspace">&nbsp;</span><span class="RktVal">"Second line"</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">#:linebreak-proc</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">&#955;</a></span><span class="RktPn">(</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._detect-linebreaks%29%29" class="RktValLink" data-pltdoc="x">detect-linebreaks</a></span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktPn">#:insert</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">newline</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktRes">'((p "First para") (p "Second para" (newline) "Second line"))</span></p></td></tr></table></blockquote></td></tr></table></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><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._pollen/decode..rkt)._wrap-hanging-quotes))"></a><span title="Provided from: pollen/decode | Package: pollen"><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._wrap-hanging-quotes%29%29" class="RktValDef RktValLink" data-pltdoc="x">wrap-hanging-quotes</a></span></span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktVar">tx</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span>[</td><td><span class="RktPn">#:single-preprend</span><span class="hspace">&nbsp;</span><span class="RktVar">single-preprender</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktPn">#:double-preprend</span><span class="hspace">&nbsp;</span><span class="RktVar">double-preprender</span>]<span class="RktPn">)</span></td><td><span class="hspace">&nbsp;</span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">tx</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">single-preprender</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr-tag~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr-tag?</a></span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">squo</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">double-preprender</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/txexpr/index.html#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr-tag~3f%29%29" class="RktValLink" data-pltdoc="x">txexpr-tag?</a></span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">dquo</span></td></tr></table></blockquote></div><div class="SIntrapara">Find single or double quote marks at the beginning of <span class="RktVar">tx</span> and wrap them in an X-expression with the tag <span class="RktVar">single-preprender</span> or <span class="RktVar">double-preprender</span>, respectively. The default values are <span class="RktVal">'</span><span class="RktVal">squo</span> and <span class="RktVal">'</span><span class="RktVal">dquo</span>.</div></p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._wrap-hanging-quotes%29%29" class="RktValLink" data-pltdoc="x">wrap-hanging-quotes</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">p</span><span class="hspace">&nbsp;</span><span class="RktVal">"No quote to hang."</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(p "No quote to hang.")</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._wrap-hanging-quotes%29%29" class="RktValLink" data-pltdoc="x">wrap-hanging-quotes</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">p</span><span class="hspace">&nbsp;</span><span class="RktVal">"&#8220;What? We need to hang quotes?&#8221;"</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(p (dquo "&#8220;" "What? We need to hang quotes?&#8221;"))</span></p></td></tr></table></blockquote></td></tr></table></p><p>In pro typography, quotation marks at the beginning of a line or paragraph are often shifted into the margin slightly to make them appear more optically aligned with the left edge of the text. With a reflowable layout model like HTML, you don&rsquo;t know where your line breaks will be.</p><p>This function will simply insert the <span class="RktVal">'</span><span class="RktVal">squo</span> and <span class="RktVal">'</span><span class="RktVal">dquo</span> tags, which provide hooks that let you do the actual hanging via CSS, like so (actual measurement can be refined to taste):</p><p><table cellspacing="0" cellpadding="0"><tr><td><p><span class="stt">squo {margin-left: -0.25em;}</span></p></td></tr><tr><td><p><span class="stt">dquo {margin-left: -0.50em;}</span></p></td></tr></table></p><p>Be warned: there are many edge cases this function does not handle well.</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">Argh: this edge case is not handled properly</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Decode.html#%28def._%28%28lib._pollen%2Fdecode..rkt%29._wrap-hanging-quotes%29%29" class="RktValLink" data-pltdoc="x">wrap-hanging-quotes</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">p</span><span class="hspace">&nbsp;</span><span class="RktVal">"&#8220;"</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">em</span><span class="hspace">&nbsp;</span><span class="RktVal">"What?"</span><span class="RktVal">)</span><span class="hspace">&nbsp;</span><span class="RktVal">"We need to hang quotes?&#8221;"</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(p "&#8220;" (em "What?") "We need to hang quotes?&#8221;")</span></p></td></tr></table></blockquote></td></tr></table></p><div class="navsetbottom"><span class="navleft"><div class="nosearchform"></div>&nbsp;&nbsp;</span><span class="navright">&nbsp;&nbsp;<a href="Cache.html" title="backward to &quot;10.1 Cache&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="Module_reference.html" title="up to &quot;10 Module reference&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="file-types.html" title="forward to &quot;10.3 File&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div></div></div><div id="contextindicator">&nbsp;</div></body></html>