print: Print a template

print.jinjar_templateR Documentation

Print a template

Description

Once a template has been parsed, it can be printed with color highlighting of the templating blocks.

Usage

## S3 method for class 'jinjar_template'
print(x, ..., n = 10)

Arguments

x

A parsed template (use parse_template()).

...

These dots are for future extensions and must be empty.

n

Number of lines to show. If Inf, will print all lines. Default: 10.

Examples

input <- '<!DOCTYPE html>
<html lang="en">
<head>
    <title>{{ title }}</title>
</head>
<body>
    <ul id="navigation">
    {% for item in navigation -%}
        <li><a href="{{ item.href }}">{{ item.caption }}</a></li>
    {% endfor -%}
    </ul>
{# a comment #}
</body>
</html>'

x <- parse_template(input)

print(x)

print(x, n = Inf)

jinjar documentation built on Nov. 2, 2023, 5:37 p.m.