|  | 
| 413 | 413 |     Usage <- function() { | 
| 414 | 414 |         cat("Usage: R CMD Rdconv [options] FILE", | 
| 415 | 415 |             "", | 
| 416 |  | -            "Convert R documentation in FILE to other formats such as plain text,", | 
|  | 416 | +            "Convert an R documentation (Rd) FILE to other formats such as plain text,", | 
| 417 | 417 |             "HTML or LaTeX.", | 
| 418 | 418 |             "", | 
| 419 | 419 |             "Options:", | 
| 420 |  | -            "  -h, --help		print short help message and exit", | 
| 421 |  | -            "  -v, --version		print version info and exit", | 
| 422 |  | -            "  -t, --type=TYPE	convert to format TYPE", | 
| 423 |  | -            "  --encoding=enc        use 'enc' as the output encoding", | 
| 424 |  | -            "  --package=pkg         use 'pkg' as the package name", | 
| 425 |  | -            "  -o, --output=OUT	use 'OUT' as the output file", | 
| 426 |  | -            "      --os=NAME		assume OS 'NAME' (unix or windows)", | 
| 427 |  | -            "      --OS=NAME		the same as '--os'", | 
| 428 |  | -            "  --RdMacros=pkglist", | 
| 429 |  | -            "             		packages from which to get Rd macros", | 
|  | 420 | +            "  -h, --help              print short help message and exit", | 
|  | 421 | +            "  -v, --version           print version info and exit", | 
|  | 422 | +            "  -t, --type=TYPE         convert to format TYPE", | 
|  | 423 | +            "      --encoding=enc      use 'enc' as the output encoding", | 
|  | 424 | +            "      --package=pkg       use 'pkg' as the package name", | 
|  | 425 | +            "  -o, --output=OUT        use 'OUT' as the output file", | 
|  | 426 | +            "      --os=NAME           assume OS 'NAME' (unix or windows)", | 
|  | 427 | +            "      --OS=NAME           the same as '--os'", | 
|  | 428 | +            "      --RdMacros=pkglist  packages from which to get Rd macros", | 
| 430 | 429 |             "", | 
| 431 | 430 |             "Possible format specifications are 'txt' (plain text), 'html', 'latex',", | 
| 432 | 431 |             "and 'example' (extract R code in the examples).", | 
| 433 | 432 |             "", | 
| 434 | 433 |             "The default is to send output to stdout, which is also given by '-o -'.", | 
| 435 |  | -            "Using '-o \"\"' will choose an output filename by removing a '.Rd'", | 
| 436 |  | -            "extension from FILE and adding a suitable extension.", | 
|  | 434 | +            ## Long-documented but never worked post-Perl (script args end at ""): | 
|  | 435 | +            ## "Using '-o \"\"' will choose an output filename by removing a '.Rd'", | 
|  | 436 | +            ## "extension from FILE and adding a suitable extension.", | 
| 437 | 437 |             "", | 
| 438 | 438 |             "Report bugs at <https://bugs.R-project.org>.", sep = "\n") | 
| 439 | 439 |     } | 
|  | 
| 495 | 495 |     } | 
| 496 | 496 |     if (length(files) != 1L) | 
| 497 | 497 |         stop("exactly one Rd file must be specified", call. = FALSE) | 
| 498 |  | -    if (is.character(out) && !nzchar(out)) { | 
| 499 |  | -        ## choose 'out' from filename | 
| 500 |  | -        bf <- sub("\\.[Rr]d$", "", file) | 
| 501 |  | -        exts <- c(txt=".txt", html=".html", latex=".tex", example=".R") | 
| 502 |  | -        out <- paste0(bf,  exts[type]) | 
| 503 |  | -    } else if (is.null(out)) out <- "" | 
|  | 498 | +    ## if (is.character(out) && !nzchar(out)) { | 
|  | 499 | +    ##     ## choose 'out' from filename | 
|  | 500 | +    ##     bf <- sub("\\.[Rr]d$", "", files) | 
|  | 501 | +    ##     exts <- c(txt=".txt", html=".html", latex=".tex", example=".R") | 
|  | 502 | +    ##     out <- paste0(bf, exts[type]) | 
|  | 503 | +    ## } else | 
|  | 504 | +    if (is.null(out) || out == "-") out <- "" | 
| 504 | 505 |     if (!nzchar(os)) os <- .Platform$OS.type | 
| 505 | 506 |     macros <- initialRdMacros(pkglist = pkglist) | 
| 506 | 507 |     switch(type, | 
|  | 
0 commit comments