reindent_PhantomJS {prettifyAddins} | R Documentation |
Reindent code using PhantomJS
Description
Reindent some code using PhantomJS.
Usage
reindent_PhantomJS(contents = NA, language = NA, tabSize = NULL)
Arguments
contents |
the code to be reindented; there are three possibilities for
this argument:
|
language |
the language of the code, such as |
tabSize |
number of spaces of the indentation (usually |
Value
The reindented code in a character string.
Note
This function requires the 'phantomjs' command-line utility.
Examples
library(prettifyAddins)
code <- c(
'if test == 1:',
'print "it is one"',
'else:',
'print "it is not one"'
)
if(Sys.which("phantomjs") != "") {
cat(reindent_PhantomJS(code, "python"))
}