|(require pollen/render)||package: pollen|
Rendering is how Pollen source files get converted into output.
source-path : complete-path? template-path : (or/c #f complete-path?) = #f
A pollen/pre file is rendered without a template.
(render-to-file source-path [ template-path output-path]) → void? source-path : complete-path? template-path : (or/c #f complete-path?) = #f output-path : (or/c #f complete-path?) = #f
(render-to-file-if-needed source-path [ template-path output-path]) → void? source-path : complete-path? template-path : (or/c #f complete-path?) = #f output-path : (or/c #f complete-path?) = #f
No file exists at output-path. (Thus, an easy way to force a render of a particular output-path is to delete it.)
Either source-path, template-path, or the associated "pollen.rkt" has changed since the last trip through render.
The render cache is deactivated.
If none of these conditions exist, output-path is deemed to be up to date, and the render is skipped.
Note that pt-or-pt-source is used strictly as a list of files to render, like a batch file. It is not used as the navigational pagetree for the rendered files.
If the metas for source-path have a key for template, then use the value of this key, e.g. —
◊(define-meta template "my-template.html")
If your project has multiple output targets, you can supply a list of templates, and the template with an extension matching the current output target will be selected automatically, e.g. —
If this key doesn’t exist, or refers to a nonexistent file, look for a default template with the name template.[output extension]. Meaning, if source-path is intro.html.pm, the output path would be intro.html, so the default template would be template.html. Look for this default template in the same directory as the source file, and then search upwards within successive parent directories. (Corollary: a default template in the project root will apply to all files in the project unless overridden within a subdirectory.)
If this file doesn’t exist, use the fallback template as a last resort. (See Templates.)