templates: Get template for formatting full text output.

get_templateR Documentation

Get template for formatting full text output.

Description

Templates are used to format the markdown/html of fulltext. get_template() loads and parses the content of the JSON template file, if it is found in the slot "template" of .Object.

Usage

get_template(.Object, ...)

## S4 method for signature 'character'
get_template(.Object, warn = FALSE)

## S4 method for signature 'corpus'
get_template(.Object, warn = FALSE)

## S4 method for signature 'subcorpus'
get_template(.Object, warn = FALSE)

Arguments

.Object

A corpus, subcorpus or partition object, or a length-one character vector with a corpus ID.

...

Further arguments.

warn

A logical value, whether to issue a warning if template is not available. Defaults to FALSE.

Details

To learn how to write templates, consult the sample files in the folder "templates" of the installed package - see examples.

Value

If a template is available, a list with the parsed content of the template file, otherwise NULL.

Examples

use("polmineR")
corpus("GERMAPARLMINI") %>%
  get_template()

# template files included in the package   
template_dir <- system.file(package = "polmineR", "templates")
list.files(template_dir)

polmineR documentation built on Nov. 2, 2023, 5:52 p.m.