<html><head><metahttp-equiv="content-type"content="text/html; charset=utf-8"/><title>8.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><!--[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="System_overview.html"class="tocviewlink"data-pltdoc="x">System overview</a></td></tr><tr><tdalign="right">5 </td><td><ahref="Using_raco_pollen.html"class="tocviewlink"data-pltdoc="x">Using <spanclass="stt">raco pollen</span></a></td></tr><tr><tdalign="right">6 </td><td><ahref="File_formats.html"class="tocviewlink"data-pltdoc="x">File formats</a></td></tr><tr><tdalign="right">7 </td><td><ahref="reader.html"class="tocviewlink"data-pltdoc="x">◊ command overview</a></td></tr><tr><tdalign="right">8 </td><td><ahref="Module_reference.html"class="tocviewselflink"data-pltdoc="x">Module reference</a></td></tr><tr><tdalign="right">9 </td><td><ahref="Acknowledgments.html"class="tocviewlink"data-pltdoc="x">Acknowledgments</a></td></tr><tr><tdalign="right">10 </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>8 </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">8.1 </td><td><ahref="Cache.html"class="tocviewlink"data-pltdoc="x">Cache</a></td></tr><tr><tdalign="right">8.2 </td><td><ahref="Decode.html"class="tocviewlink"data-pltdoc="x">Decode</a></td></tr><tr><tdalign="right">8.3 </td><td><ahref="File.html"class="tocviewlink"data-pltdoc="x">File</a></td></tr><tr><tdalign="right">8.4 </td><td><ahref="Pagetree.html"class="tocviewlink"data-pltdoc="x">Pagetree</a></td></tr><tr><tdalign="right">8.5 </td><td><ahref="Render.html"class="tocviewselflink"data-pltdoc="x">Render</a></td></tr><tr><tdalign="right">8.6 </td><td><ahref="Template.html"class="tocviewlink"data-pltdoc="x">Template</a></td></tr><tr><tdalign="right">8.7 </td><td><ahref="Tag.html"class="tocviewlink"data-pltdoc="x">Tag</a></td></tr><tr><tdalign="right">8.8 </td><td><ahref="Top.html"class="tocviewlink"data-pltdoc="x"
</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"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"><ahref="http://docs.racket-lang.org/sugar/Coercion.html#%28def._%28%28lib._sugar%2Fcoerce%2Fvalue..rkt%29._pathish~3f%29%29"class="RktValLink"data-pltdoc="x">pathish?</a></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"class="boxed RBoxed"><tr><td><blockquoteclass="SubFlow"><divclass="RBackgroundLabel SIEHidden"><divcl
</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="RktSym">.pt</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.pt</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"> </span><spanclass="navright"> <ahref="Pagetree.html"title="backward to "8.4 Pagetree""data-pltdoc="x">← prev</a> <ahref="Module_reference.html"title="up to "8 Module reference""data-pltdoc="x">up</a> <ahref="Template.html"title="forward to "8.6 Template""data-pltdoc="x">next →</a></span> </div></div></div><divid="contextindicator"> </div></body></html>