helpers_handlebars
All Handlebars helpers: format_time, markdown, equal block.
Browse this template in the repository →
The PDFs below are rendered live by PDF Server from the shipped examples.
equal
markdown
timezone
utc
Inputs
Render data
equal
examples/equal.json
{
"equal_examples": {
"enabled": true
}
}markdown
examples/markdown.json
{
"markdown_examples": {
"multi_line": "line1\nline2",
"list": "1. One\n2. Two"
}
}timezone
examples/timezone.json
{
"time_examples": {
"from_time":"2015-01-01T00:00:00+05:00",
"to_time":"2015-01-01T00:00:00-05:00"
}
}utc
examples/utc.json
{
"time_examples": {
"from_time": "2022-04-01T12:34:56Z",
"to_time": "2024-04-01T09:58:47Z"
}
}Data schema
schema.json
{
"type": "object",
"properties": {
"time_examples": {
"type": "object",
"properties": {
"from_time": {
"type": "string",
"format": "date-time"
},
"to_time": {
"type": "string",
"format": "date-time"
}
}
},
"markdown_examples": {
"type": "object",
"properties": {
"multi_line": {
"type": "string"
},
"list": {
"type": "string"
}
}
},
"equal_examples": {
"type": "object"
}
}
}Template
template.handlebars
<html>
<head>
</head>
<body>
{{#time_examples}}
<h1>Format time</h1>
<p>
From: {{format_time "%Y-%m-%dT%H:%M:%S" time_examples.from_time }} ({{ time_examples.from_time }})
</p>
<p>
To: {{format_time "%A %d %B, %y" time_examples.to_time }} ({{ time_examples.to_time }})
</p>
<p>
Static time: {{format_time "%A %d %B, %y" "2014-01-01T00:00:00Z" }} (2014-01-01T00:00:00Z)
</p>
{{/time_examples}}
{{#markdown_examples}}
<h1>Markdown</h1>
<h2>Multiline</h2>
<div>{{ markdown markdown_examples.multi_line }}</div>
<h2>List</h2>
<div>{{ markdown markdown_examples.list }}</div>
{{/markdown_examples}}
{{#with equal_examples}}
<section>
<h1>#equal</h1>
<p>{{#equal "true" "true"}}true{{/equal}}</p>
<p>{{#equal "true" "false"}}{{else}}false{{/equal}}</p>
</section>
{{/with}}
</body>
</html>