View source: R/check_brackets.R
check_brackets | R Documentation |
Checks an RTF file for balanced curly brackets. The RTF file must
start with {\rtf1
and ends at the first closing }
.
check_brackets(filename)
filename |
a length-one character vector indicating the RTF filename to check |
An RTF file must begin with {\rtf1
and ends as soon as that
opening curly bracket is closed. (Usually anything after the closing
curly bracket is ignored by RTF readers.)
Curly brackets appearing in an RTF document need to be escaped with a backslash; this function ignores these.
This function returns a “status code” of zero if the RTF file checks out and has balanced curly brackets. Non-zero status codes indicate a problem. These non-zero status codes are as follows:
Code | Meaning |
1 | Cannot open the file to check curly brackets |
2 | File did not begin with the required {\rtf1 |
3 | The curly brackets in the file nest too deeply for this program |
4 | A closing } was found without a prior { |
5 | The opening {\rtf1 was never closed |
6 | There is an opening { that was never closed
|
Stephen Weigand <weigand.stephen@mayo.edu>
## A valid RTF file check_brackets(system.file("examples", "hello-world.rtf", package = "rtfSweave")) ## An RTF file missing a closing curly bracket check_brackets(system.file("examples", "unbalanced.rtf", package = "rtfSweave"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.