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

11 years ago
<!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">Pagetr
</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="RForeg
</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>