NAME

PDF::Make::Markup::Render - template and data in, PDF out

SYNOPSIS

use PDF::Make::Markup::Render;

my $pdf = PDF::Make::Markup::Render->render(<<'TPL', $data);
<doc page-size="A4" margin="36">
  <h1>Invoice {% invoice.number %}</h1>
  <text>Amount due: <b>{% invoice.total | money %}</b></text>
  <table>
    {% for l in invoice.lines %}
    <tr><td>{% l.name %}</td><td align="right">{% l.qty %}</td></tr>
    {% end %}
  </table>
</doc>
TPL

DESCRIPTION

Three stages, in one place:

  1. PDF::Make::Markup::Profile runs the template. Values are escaped, the filter list is fixed, and {% raw %} is refused.

  2. PDF::Make::Markup::Parse parses the markup that came out. Anything outside the grammar is an error with a line and a column.

  3. PDF::Make::Markup::Build compiles the tree onto PDF::Make::Builder.

Reproducibility

Set SOURCE_DATE_EPOCH and two renders of the same template and data produce identical bytes. Without it the output carries the wall clock, and nothing downstream - a golden corpus, a diff of one engine version against the next - can be checked.

Engine versions

engine_version selects the layout engine. There is one, and a template may pin it. Asking for a version this build does not have is an error that says whether the template is from the future or the past, rather than quietly rendering with something else.

SEE ALSO

PDF::Make::Markup::Profile, PDF::Make::Markup::Parse, PDF::Make::Markup::Build