wordwrap_source {rock} | R Documentation |
Wordwrapping a source
Description
This function wordwraps a source.
Usage
wordwrap_source(
input,
output = NULL,
length = 40,
removeNewlines = FALSE,
removeTrailingNewlines = TRUE,
rlWarn = rock::opts$get(rlWarn),
preventOverwriting = rock::opts$get("preventOverwriting"),
encoding = rock::opts$get(encoding),
silent = rock::opts$get(silent),
utteranceMarker = rock::opts$get("utteranceMarker")
)
Arguments
input |
For |
output |
For |
length |
At how many characters to word wrap. |
removeNewlines |
Whether to remove all newline characters from the source before starting to clean them. Be careful: if the source contains YAML fragments, these will also be affected by this, and will probably become invalid! |
removeTrailingNewlines |
Whether to remove trailing newline characters (i.e. at the end of a character value in a character vector); |
rlWarn |
Whether to let |
preventOverwriting |
Whether to prevent overwriting of output files. |
encoding |
The encoding of the source(s). |
silent |
Whether to suppress the warning about not editing the cleaned source. |
utteranceMarker |
The character(s) between utterances (i.e. marking where one utterance ends and the next one starts). By default, this is a line break, and only change this if you know what you are doing. |
Value
A character vector.
Examples
exampleText <-
paste0(
"Lorem ipsum dolor sit amet, consectetur ",
"adipiscing elit. Nunc non commodo ex, ac ",
"varius mi. Praesent feugiat nunc eget urna ",
"euismod lobortis. Sed hendrerit suscipit ",
"nisl, ac tempus magna porta et. ",
"Quisque libero massa, tempus vel tristique ",
"lacinia, tristique in nulla. Nam cursus enim ",
"dui, non ornare est tempor eu. Vivamus et massa ",
"consectetur, tristique magna eget, viverra elit."
);
### Show example text
cat(exampleText);
### Show preprocessed example text
cat(
paste0(
rock::wordwrap_source(
exampleText
),
collapse = "\n"
)
);