to_specList: Producing a list of specifications

View source: R/to_specList.R

to_specListR Documentation

Producing a list of specifications

Description

This function is for internal use, but has been exported in case it's useful for people working 'manually' with lists of justifications.

Usage

to_specList(x, types, type, idsRequired = TRUE, silent = TRUE)

Arguments

x

The list to parse.

types

The class to assign to the specification list (the justifierSpecList object to return).

type

The class to assign to each specification (in addition to justifierSpec).

idsRequired

Whether to require identifiers.

silent

Whether to be chatty or silent.

Value

A list of classes c("justifierSpecList", types) where each element is a specification of class c("justifierSpec", type).

Examples

### Specify an example text
exampleFile <-
  system.file("extdata",
              "simple-example.jmd",
              package="justifier");

### Show contents
cat(readLines(exampleFile), sep="\n");

### Load it with yum::load_and_simplify()
loadedMinutes <- yum::load_and_simplify(exampleFile);

### Show contents
names(loadedMinutes);

### Show classes
class(loadedMinutes["assertion"]);

### Convert to specification list
res <- to_specList(loadedMinutes["assertion"],
                   type="assertion",
                   types="assertions");
### Show classes
class(res);

### Show original and parsed objects
loadedMinutes["assertion"];
res;


justifier documentation built on March 7, 2023, 6:59 p.m.