styler (version 1.1.0)

style_roxygen_code_example: Style a roxygen code example that may contain dontrun and friends

Description

Parses roxygen2 comments into code, breaks it into dont* (dontrun, dontest, dontshow) and run sections and processes each segment indicidually using style_roxygen_example_snippet().

Usage

style_roxygen_code_example(example, transformers)

Arguments

example

Roxygen example code.

transformers

A list of named transformer functions

Hierarchy

Styling involves splitting roxygen example code into segments, and segments into snippets. This describes the process for input of parse_transform_serialize_roxygen():

  • Splitting code into roxygen example code and other code. Downstream, we are only concerned about roxygen code. See parse_transform_serialize_roxygen().

  • Every roxygen example code can have zero or more dontrun / dontshow / donttest sequences. We next create segments of roxygen code examples that contain at most one of these. See style_roxygen_code_example().

  • We further split the segment that contains at most one dont* sequence into snippets that are either don* or not. See style_roxygen_code_example_segment().

Finally, that we have roxygen code snippets that are either dont* or not, we style them in style_roxygen_example_snippet() using parse_transform_serialize_r().