| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/print.R |
| 3 |
\name{print.jinjar_template} |
| 4 |
\alias{print.jinjar_template} |
| 5 |
\title{Print a template} |
| 6 |
\usage{ |
| 7 |
\method{print}{jinjar_template}(x, ..., n = 10) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{x}{A parsed template (use \code{\link[=parse_template]{parse_template()}}).} |
| 11 |
|
| 12 |
\item{...}{These dots are for future extensions and must be empty.} |
| 13 |
|
| 14 |
\item{n}{Number of lines to show. If \code{Inf}, will print all lines. Default: \code{10}.} |
| 15 |
} |
| 16 |
\description{ |
| 17 |
Once a template has been parsed, it can be printed with color highlighting of |
| 18 |
the templating blocks. |
| 19 |
} |
| 20 |
\examples{ |
| 21 |
input <- '<!DOCTYPE html> |
| 22 |
<html lang="en"> |
| 23 |
<head> |
| 24 |
<title>{{ title }}</title> |
| 25 |
</head> |
| 26 |
<body> |
| 27 |
<ul id="navigation"> |
| 28 |
{\% for item in navigation -\%} |
| 29 |
<li><a href="{{ item.href }}">{{ item.caption }}</a></li> |
| 30 |
{\% endfor -\%} |
| 31 |
</ul> |
| 32 |
{# a comment #} |
| 33 |
</body> |
| 34 |
</html>' |
| 35 |
|
| 36 |
x <- parse_template(input) |
| 37 |
|
| 38 |
print(x) |
| 39 |
|
| 40 |
print(x, n = Inf) |
| 41 |
} |