<html><head><metahttp-equiv="content-type"content="text/html; charset=utf-8"/><title>11.5 Render</title><linkrel="stylesheet"type="text/css"href="scribble.css"title="default"/><linkrel="stylesheet"type="text/css"href="racket.css"title="default"/><linkrel="stylesheet"type="text/css"href="manual-style.css"title="default"/><linkrel="stylesheet"type="text/css"href="manual-racket.css"title="default"/><scripttype="text/javascript"src="scribble-common.js"></script><scripttype="text/javascript"src="manual-racket.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><bodyid="scribble-racket-lang-org"><divclass="tocset"><divclass="tocview"><divclass="tocviewlist tocviewlisttopspace"><divclass="tocviewtitle"><tablecellspacing="0"cellpadding="0"><tr><tdstyle="width: 1em;"><ahref="javascript:void(0);"title="Expand/Collapse"class="tocviewtoggle"onclick="TocviewToggle(this,"tocview_0");">►</a></td><td></td><td><ahref="index.html"class="tocviewlink"data-pltdoc="x">Pollen:<spanclass="mywbr"> </span> the book is a program</a></td></tr></table></div><divclass="tocviewsublisttop"style="display: none;"id="tocview_0"><tablecellspacing="0"cellpadding="0"><tr><tdalign="right">1 </td><td><ahref="Installation.html"class="tocviewlink"data-pltdoc="x">Installation</a></td></tr><tr><tdalign="right">2 </td><td><ahref="quick-tour.html"class="tocviewlink"data-pltdoc="x">Quick tour</a></td></tr><tr><tdalign="right">3 </td><td><ahref="Backstory.html"class="tocviewlink"data-pltdoc="x">Backstory</a></td></tr><tr><tdalign="right">4 </td><td><ahref="big-picture.html"class="tocviewlink"data-pltdoc="x">The big picture</a></td></tr><tr><tdalign="right">5 </td><td><ahref="first-tutorial.html"class="tocviewlink"data-pltdoc="x">First tutorial</a></td></tr><tr><tdalign="right">6 </td><td><ahref="second-tutorial.html"class="tocviewlink"data-pltdoc="x">Second tutorial</a></td></tr><tr><tdalign="right">7 </td><td><ahref="third-tutorial.html"class="tocviewlink"data-pltdoc="x">Third tutorial</a></td></tr><tr><tdalign="right">8 </td><td><ahref="raco-pollen.html"class="tocviewlink"data-pltdoc="x">Using <spanclass="stt">raco pollen</span></a></td></tr><tr><tdalign="right">9 </td><td><ahref="File_formats.html"class="tocviewlink"data-pltdoc="x">File formats</a></td></tr><tr><tdalign="right">10 </td><td><ahref="reader.html"class="tocviewlink"data-pltdoc="x">◊ command overview</a></td></tr><tr><tdalign="right">11 </td><td><ahref="Module_reference.html"class="tocviewselflink"data-pltdoc="x">Module reference</a></td></tr><tr><tdalign="right">12 </td><td><ahref="Acknowledgments.html"class="tocviewlink"data-pltdoc="x">Acknowledgments</a></td></tr><tr><tdalign="right">13 </td><td><ahref="License___source_code.html"class="tocviewlink"data-pltdoc="x">License & source code</a></td></tr><tr><tdalign="right"></td><td><ahref="doc-index.html"class="tocviewlink"data-pltdoc="x">Index</a></td></tr></table></div></div><divclass="tocviewlist"><tablecellspacing="0"cellpadding="0"><tr><tdstyle="width: 1em;"><ahref="javascript:void(0);"title="Expand/Collapse"class="tocviewtoggle"onclick="TocviewToggle(this,"tocview_1");">▼</a></td><td>11 </td><td><ahref="Module_reference.html"class="tocviewlink"data-pltdoc="x">Module reference</a></td></tr></table><divclass="tocviewsublistbottom"style="display: block;"id="tocview_1"><tablecellspacing="0"cellpadding="0"><tr><tdalign="right">11.1 </td><td><ahref="Cache.html"class="tocviewlink"data-pltdoc="x">Cache</a></td></tr><tr><tdalign="right">11.2 </td><td><ahref="Decode.html"class="tocviewlink"data-pltdoc="x">Decode</a></td></tr><tr><tdalign="right">11.3 </td><td><ahref="file-types.html"class="tocviewlink"data-pltdoc="x">File</a></td></tr><tr><tdalign="right">11.4 </td><td><ahref="Pagetree.html"class="tocviewlink"data-pltdoc="x">Pagetr
</div><divclass="SIntrapara"><ol><li><p>The <spanclass="RktVar">force-render?</span> flag — set with the <spanclass="RktPn">#:force</span> keyword — is <spanclass="RktVal">#t</span>.</p></li><li><p>No file exists at <spanclass="RktVar">output-path</span>. (Thus, an easy way to force a render of a particular <spanclass="RktVar">output-path</span> is to delete it.)</p></li><li><p>Either <spanclass="RktVar">source-path</span> or <spanclass="RktVar">template-path</span> have changed since the last trip through <spanclass="RktSym"><ahref="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._render%29%29"class="RktValLink"data-pltdoc="x">render</a></span>.</p></li><li><p>One or more of the project requires have changed.</p></li></ol></div></p><p>If none of these conditions exist, <spanclass="RktVar">output-path</span> is deemed to be up to date, and the render is skipped.</p><p><divclass="SIntrapara"><blockquoteclass="SVInsetFlow"><tablecellspacing="0"cellpadding="0"class="boxed RBoxed"><tr><td><blockquoteclass="SubFlow"><divclass="RBackgroundLabel SIEHidden"><divclass="RBackgroundLabelInner"><p>procedure</p></div></div><pclass="RForeground"><spanclass="RktPn">(</span><aname="(def._((lib._pollen/render..rkt)._render-batch))"></a><spantitle="Provided from: pollen/render | Package: pollen"><spanclass="RktSym"><ahref="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._render-batch%29%29"class="RktValDef RktValLink"data-pltdoc="x">render-batch</a></span></span><spanclass="hspace"> </span><spanclass="RktVar">source-paths</span><spanclass="hspace"> </span><spanclass="RktMeta">...</span><spanclass="RktPn">)</span><spanclass="hspace"> </span>→<spanclass="hspace"> </span><spanclass="RktSym"><ahref="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><spanclass="hspace"> </span><spanclass="RktVar">source-paths</span><spanclass="hspace"> </span>:<spanclass="hspace"> </span><spanclass="RktPn">(</span><spanclass="RktSym"><ahref="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><spanclass="hspace"> </span><spanclass="RktSym"><spanclass="badlink"><spanclass="RktValLink">pathish?</span></span></span><spanclass="RktPn">)</span></td></tr></table></blockquote></div><divclass="SIntrapara">Render multiple <spanclass="RktVar">source-paths</span> in one go. This can be faster than <spanclass="RktPn">(</span><spanclass="RktSym"><ahref="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28lib._racket%2Fprivate%2Fmap..rkt%29._for-each%29%29"class="RktValLink"data-pltdoc="x">for-each</a></span><spanclass="stt"></span><spanclass="RktSym"><ahref="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._render%29%29"class="RktValLink"data-pltdoc="x">render</a></span><spanclass="stt"></span><spanclass="RktVar">source-paths</span><spanclass="RktPn">)</span> if your <spanclass="RktVar">source-paths</span> rely on a common set of templates. Templates may have their own source files that need to be compiled. If you use <spanclass="RktSym"><ahref="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._render%29%29"class="RktValLink"data-pltdoc="x">render</a></span>, the templates will be repeatedly (and needlessly) re-compiled. Whereas if you use <spanclass="RktSym"><ahref="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._render-batch%29%29"class="RktValLink"data-pltdoc="x">render-batch</a></span>, each template will only be compiled once.</div></p><p><divclass="SIntrapara"><blockquoteclass="SVInsetFlow"><tablecellspacing="0"cellpadding="0"class="boxed RBoxed"><tr><td><blockquoteclass="SubFlow"><divclass="RBackgroundLabel SIEHidden"><divclass="RBackgroundLabelInner"><p>procedure</p></div></div><pclass="RForeg
</div><divclass="SIntrapara"><ol><li><p>If the metas for <spanclass="RktVar">source-path</span> have a key for <spanclass="RktSym">template</span><spanclass="RktMeta"></span>, then use the value of this key.</p></li><li><p>If this key doesn’t exist, or if it points to a nonexistent file, look for a default template in the project directory with the name <spanclass="RktSym">template.</span><spanclass="RktPn">[</span><spanclass="RktSym">output</span><spanclass="RktMeta"></span><spanclass="hspace"> </span><spanclass="RktMeta"></span><spanclass="RktSym">extension</span><spanclass="RktPn">]</span><spanclass="RktMeta"></span>. Meaning, if <spanclass="RktVar">source-path</span> is <spanclass="RktSym">intro.html.pm</span><spanclass="RktMeta"></span>, the output path would be <spanclass="RktSym">intro.html</span><spanclass="RktMeta"></span>, so the default template would be <spanclass="RktSym">template.html</span><spanclass="RktMeta"></span>.</p></li><li><p>If this file doesn’t exist, use the fallback template as a last resort.</p></li></ol></div></p><p>This function is called when a template is needed, but a <spanclass="RktVar">template-path</span> argument is missing (for instance, in <spanclass="RktSym"><ahref="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._render%29%29"class="RktValLink"data-pltdoc="x">render</a></span> or <spanclass="RktSym"><ahref="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._render-to-file%29%29"class="RktValLink"data-pltdoc="x">render-to-file</a></span>).</p><divclass="navsetbottom"><spanclass="navleft"><divclass="nosearchform"></div> </span><spanclass="navright"> <ahref="Pagetree.html"title="backward to "11.4 Pagetree""data-pltdoc="x">← prev</a> <ahref="Module_reference.html"title="up to "11 Module reference""data-pltdoc="x">up</a> <ahref="Template.html"title="forward to "11.6 Template""data-pltdoc="x">next →</a></span> </div></div></div><divid="contextindicator"> </div></body></html>