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/Render.html

4 lines
31 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>11.5&nbsp;Render</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="third-tutorial.html" class="tocviewlink" data-pltdoc="x">Third tutorial</a></td></tr><tr><td align="right">8&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">9&nbsp;</td><td><a href="File_formats.html" class="tocviewlink" data-pltdoc="x">File formats</a></td></tr><tr><td align="right">10&nbsp;</td><td><a href="reader.html" class="tocviewlink" data-pltdoc="x">&#9674; command overview</a></td></tr><tr><td align="right">11&nbsp;</td><td><a href="Module_reference.html" class="tocviewselflink" data-pltdoc="x">Module reference</a></td></tr><tr><td align="right">12&nbsp;</td><td><a href="Acknowledgments.html" class="tocviewlink" data-pltdoc="x">Acknowledgments</a></td></tr><tr><td align="right">13&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>11&nbsp;</td><td><a href="Module_reference.html" class="tocviewlink" data-pltdoc="x">Module reference</a></td></tr></table><div class="tocviewsublistbottom" style="display: block;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">11.1&nbsp;</td><td><a href="Cache.html" class="tocviewlink" data-pltdoc="x">Cache</a></td></tr><tr><td align="right">11.2&nbsp;</td><td><a href="Decode.html" class="tocviewlink" data-pltdoc="x">Decode</a></td></tr><tr><td align="right">11.3&nbsp;</td><td><a href="file-types.html" class="tocviewlink" data-pltdoc="x">File</a></td></tr><tr><td align="right">11.4&nbsp;</td><td><a href="Pagetree.html" class="tocviewlink" data-pltdoc="x">Pagetree</a></td></tr><tr><td align="right">11.5&nbsp;</td><td><a href="Render.html" class="tocviewselflink" data-pltdoc="x">Render</a></td></tr><tr><td align="right">11.6&nbsp;</td><td><a href="Template.html" class="tocviewlink" data-pltdoc="x">Template</a></td></tr><tr><td align="right">11.7&nbsp;</td><td><a href="Tag.html" class="tocviewlink" data-pltdoc="x">Tag</a></td></tr><tr><td align="right">11.8&nbsp;</td><td><a href="Top.html" class="tocviewlink" data-pltdoc="x">Top</a></td></tr><tr><td align="right">11.9&nbsp;</td><td><a href="World.html" class="tocviewlink" data-pltdoc="x">World</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%2Frender..rkt%29._render%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">render</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._pollen%2Frender..rkt%29._render-to-file%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">render-<wbr></wbr>to-<wbr></wbr>file</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._pollen%2Frender..rkt%29._render-to-file-if-needed%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">render-<wbr></wbr>to-<wbr></wbr>file-<wbr></wbr>if-<wbr></wbr>needed</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._pollen%2Frender..rkt%29._render-batch%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">render-<wbr></wbr>batch</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._pollen%2Frender..rkt%29._render-pagetree%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">render-<wbr></wbr>pagetree</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._pollen%2Frender..rkt%29._get-template-for%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">get-<wbr></wbr>template-<wbr></wbr>for</span></span></a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="versionbox"><span class="version">6.1.0.8</span></div><div class="navsettop"><span class="navleft"><div class="nosearchform"></div>&nbsp;&nbsp;</span><span class="navright">&nbsp;&nbsp;<a href="Pagetree.html" title="backward to &quot;11.4 Pagetree&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="Module_reference.html" title="up to &quot;11 Module reference&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="Template.html" title="forward to &quot;11.6 Template&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div><h4>11.5<tt>&nbsp;</tt><a name="(part._.Render)"></a><a name="(mod-path._pollen/render)"></a>Render</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="Render.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">pollen/render</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><span style="font-style: italic">Rendering</span> is how Pollen source files get converted into output.</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/render..rkt)._render))"></a><span title="Provided from: pollen/render | Package: pollen"><span class="RktSym"><a href="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._render%29%29" class="RktValDef RktValLink" data-pltdoc="x">render</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">source-path</span><span class="hspace">&nbsp;</span>[<span class="RktVar">template-path</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/bytestrings.html#%28def._%28%28quote._~23~25kernel%29._bytes~3f%29%29" class="RktValLink" data-pltdoc="x">bytes?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">source-path</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._complete-path~3f%29%29" class="RktValLink" data-pltdoc="x">complete-path?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">template-path</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%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._complete-path~3f%29%29" class="RktValLink" data-pltdoc="x">complete-path?</a></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Renders <span class="RktVar">source-path</span>. The rendering behavior depends on the type of source file:</div></p><p>A [pollen/pre] file is rendered without a template.</p><p>A [pollen/markup] or [pollen/markdown] file is rendered with a template. If no template is provided with <span class="RktVar">template-path</span>, Pollen finds one using <span class="RktSym"><a href="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._get-template-for%29%29" class="RktValLink" data-pltdoc="x">get-template-for</a></span>.</p><p>Be aware that rendering with a template uses <span class="RktSym"><a href="http://docs.racket-lang.org/web-server/templates.html#%28form._%28%28lib._web-server%2Ftemplates..rkt%29._include-template%29%29" class="RktStxLink" data-pltdoc="x">include-template</a></span> within <span class="RktSym"><a href="http://docs.racket-lang.org/reference/eval.html#%28def._%28%28quote._~23~25kernel%29._eval%29%29" class="RktValLink" data-pltdoc="x">eval</a></span>. For complex pages, it can be slow the first time. Caching is used to make subsequent requests faster.</p><p>For those panicked at the use of <span class="RktSym"><a href="http://docs.racket-lang.org/reference/eval.html#%28def._%28%28quote._~23~25kernel%29._eval%29%29" class="RktValLink" data-pltdoc="x">eval</a></span>, please don&rsquo;t be. As the author of <span class="RktSym"><a href="http://docs.racket-lang.org/web-server/templates.html#%28form._%28%28lib._web-server%2Ftemplates..rkt%29._include-template%29%29" class="RktStxLink" data-pltdoc="x">include-template</a></span> has already advised, &ldquo;If you insist on dynamicism&rdquo; &#8212; and yes, I do insist &#8212; &ldquo;<a href="http://docs.racket-lang.org/web-server/faq.html#%28part._.How_do_.I_use_templates__dynamically__%29">there is always <span class="RktSym"><span class="RktValLink">eval</span></span>.</a>&rdquo;</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/render..rkt)._render-to-file))"></a><span title="Provided from: pollen/render | Package: pollen"><span class="RktSym"><a href="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._render-to-file%29%29" class="RktValDef RktValLink" data-pltdoc="x">render-to-file</a></span></span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktVar">source-path</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="RktVar">template-path</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="RktVar">output-path</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/reference/void.html#%28def._%28%28quote._~23~25kernel%29._void~3f%29%29" class="RktValLink" data-pltdoc="x">void?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">source-path</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._complete-path~3f%29%29" class="RktValLink" data-pltdoc="x">complete-path?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">template-path</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%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._complete-path~3f%29%29" class="RktValLink" data-pltdoc="x">complete-path?</a></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">output-path</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%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._complete-path~3f%29%29" class="RktValLink" data-pltdoc="x">complete-path?</a></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Like <span class="RktSym"><a href="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._render%29%29" class="RktValLink" data-pltdoc="x">render</a></span>, but saves the file to <span class="RktVar">output-path</span>, overwriting whatever was already there. If no <span class="RktVar">output-path</span> is provided, it&rsquo;s derived from <span class="RktVar">source-path</span> using <span class="RktSym"><a href="file-types.html#%28def._%28%28lib._pollen%2Ffile..rkt%29._-~3eoutput-path%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>output-path</a></span>.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._pollen/render..rkt)._render-to-file-if-needed))"></a><span title="Provided from: pollen/render | Package: pollen"><span class="RktSym"><a href="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._render-to-file-if-needed%29%29" class="RktValDef RktValLink" data-pltdoc="x">render-to-file-if-needed</a></span></span></td><td><span class="hspace">&nbsp;</span></td><td><span class="RktVar">source-path</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="RktVar">template-path</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="RktVar">output-path</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">#:force</span><span class="hspace">&nbsp;</span><span class="RktVar">force-render?</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/reference/void.html#%28def._%28%28quote._~23~25kernel%29._void~3f%29%29" class="RktValLink" data-pltdoc="x">void?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">source-path</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._complete-path~3f%29%29" class="RktValLink" data-pltdoc="x">complete-path?</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">template-path</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%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._complete-path~3f%29%29" class="RktValLink" data-pltdoc="x">complete-path?</a></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">output-path</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%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._complete-path~3f%29%29" class="RktValLink" data-pltdoc="x">complete-path?</a></span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">force-render?</span><span class="hspace">&nbsp;</span>:<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><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Like <span class="RktSym"><a href="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._render-to-file%29%29" class="RktValLink" data-pltdoc="x">render-to-file</a></span>, but the render only happens if one of these conditions exist:
</div><div class="SIntrapara"><ol><li><p>The <span class="RktVar">force-render?</span> flag &#8212;&#160;set with the <span class="RktPn">#:force</span> keyword &#8212; is <span class="RktVal">#t</span>.</p></li><li><p>No file exists at <span class="RktVar">output-path</span>. (Thus, an easy way to force a render of a particular <span class="RktVar">output-path</span> is to delete it.)</p></li><li><p>Either <span class="RktVar">source-path</span> or <span class="RktVar">template-path</span> have changed since the last trip through <span class="RktSym"><a href="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, <span class="RktVar">output-path</span> is deemed to be up to date, and the render is skipped.</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/render..rkt)._render-batch))"></a><span title="Provided from: pollen/render | Package: pollen"><span class="RktSym"><a href="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._render-batch%29%29" class="RktValDef RktValLink" data-pltdoc="x">render-batch</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">source-paths</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</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">source-paths</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"><span class="badlink"><span class="RktValLink">pathish?</span></span></span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Render multiple <span class="RktVar">source-paths</span> in one go. This can be faster than <span class="RktPn">(</span><span class="RktSym"><a href="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><span class="stt"> </span><span class="RktSym"><a href="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._render%29%29" class="RktValLink" data-pltdoc="x">render</a></span><span class="stt"> </span><span class="RktVar">source-paths</span><span class="RktPn">)</span> if your <span class="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 <span class="RktSym"><a href="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 <span class="RktSym"><a href="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><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/render..rkt)._render-pagetree))"></a><span title="Provided from: pollen/render | Package: pollen"><span class="RktSym"><a href="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._render-pagetree%29%29" class="RktValDef RktValLink" data-pltdoc="x">render-pagetree</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">pagetree</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">pagetree</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym">pagetree?</span></td></tr><tr><td><span class="RktPn">(</span><span title="Provided from: pollen/render | Package: pollen"><span class="RktSym"><a href="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._render-pagetree%29%29" class="RktValDef RktValLink" data-pltdoc="x">render-pagetree</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">pagetree-source</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">pagetree-source</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><span class="badlink"><span class="RktValLink">pathish?</span></span></span></td></tr></table></blockquote></div><div class="SIntrapara">Using <span class="RktVar">pagetree</span>, or a pagetree loaded from <span class="RktVar">pagetree-source</span>, render the pages in that pagetree using <span class="RktSym"><a href="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._render-batch%29%29" class="RktValLink" data-pltdoc="x">render-batch</a></span>.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._pollen/render..rkt)._get-template-for))"></a><span title="Provided from: pollen/render | Package: pollen"><span class="RktSym"><a href="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._get-template-for%29%29" class="RktValDef RktValLink" data-pltdoc="x">get-template-for</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">source-path</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%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._complete-path~3f%29%29" class="RktValLink" data-pltdoc="x">complete-path?</a></span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">source-path</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._complete-path~3f%29%29" class="RktValLink" data-pltdoc="x">complete-path?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Find a template file for <span class="RktVar">source-path</span>, with the following priority:
</div><div class="SIntrapara"><ol><li><p>If the metas for <span class="RktVar">source-path</span> have a key for <span class="RktSym">template</span><span class="RktMeta"></span>, then use the value of this key.</p></li><li><p>If this key doesn&rsquo;t exist, or if it points to a nonexistent file, look for a default template in the project directory with the name <span class="RktSym">template.</span><span class="RktPn">[</span><span class="RktSym">output</span><span class="RktMeta"></span><span class="hspace">&nbsp;</span><span class="RktMeta"></span><span class="RktSym">extension</span><span class="RktPn">]</span><span class="RktMeta"></span>. Meaning, if <span class="RktVar">source-path</span> is <span class="RktSym">intro.html.pm</span><span class="RktMeta"></span>, the output path would be <span class="RktSym">intro.html</span><span class="RktMeta"></span>, so the default template would be <span class="RktSym">template.html</span><span class="RktMeta"></span>.</p></li><li><p>If this file doesn&rsquo;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 <span class="RktVar">template-path</span> argument is missing (for instance, in <span class="RktSym"><a href="Render.html#%28def._%28%28lib._pollen%2Frender..rkt%29._render%29%29" class="RktValLink" data-pltdoc="x">render</a></span> or <span class="RktSym"><a href="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><div class="navsetbottom"><span class="navleft"><div class="nosearchform"></div>&nbsp;&nbsp;</span><span class="navright">&nbsp;&nbsp;<a href="Pagetree.html" title="backward to &quot;11.4 Pagetree&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="Module_reference.html" title="up to &quot;11 Module reference&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="Template.html" title="forward to &quot;11.6 Template&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div></div></div><div id="contextindicator">&nbsp;</div></body></html>