R/roxygen-examples.R
style_roxygen_example_snippet.Rd
Given a code snippet is dont* or run, style it
style_roxygen_example_snippet(
code_snippet,
transformers,
is_dont,
base_indention
)
A character vector with code to style.
Passed to cache_make_key()
to generate a key.
Whether the snippet to process is a dontrun, dontshow, donttest segment or not.
Integer scalar indicating by how many spaces the whole
output text should be indented. Note that this is not the same as splitting
by line and add a base_indention
spaces before the code in the case
multi-line strings are present. See 'Examples'.
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()
.