The R Project SVN R

Rev

Rev 85324 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 85324 Rev 89543
Line 1... Line 1...
1
require("tools")
1
require("tools")
-
 
2
Rd2txt_options(underline_titles = FALSE)
2
 
3
 
3
# -------------------------------------------------------------------
4
# -------------------------------------------------------------------
4
# prepare_Rd() is OK with a top level \Sexpr that is yet to be rendered
5
# prepare_Rd() is OK with a top level \Sexpr that is yet to be rendered
5
 
6
 
6
txt <- "
7
txt <- "
Line 80... Line 81...
80
bad <- function (Rd) sum(startsWith(checkRd(Rd), "checkRd: (-1) "))
81
bad <- function (Rd) sum(startsWith(checkRd(Rd), "checkRd: (-1) "))
81
stopifnot(bad("Rd-braces_ignored.Rd") == 0L,
82
stopifnot(bad("Rd-braces_ignored.Rd") == 0L,
82
          bad("Rd-braces_reported.Rd") == 10L)
83
          bad("Rd-braces_reported.Rd") == 10L)
83
 
84
 
84
 
85
 
-
 
86
## "srcref" of usermacro expansion
-
 
87
rd <- parse_Rd(textConnection(r"(\newcommand{\Emph}{\emph{#1}}
-
 
88
\Emph{this}
-
 
89
)"), fragment = TRUE, verbose = TRUE, macros = FALSE)
-
 
90
print(rd) # shows the expansion, not the source
-
 
91
stopifnot(!grepl("\\Emph", paste(as.character(rd), collapse = ""), fixed = TRUE))
-
 
92
print(getSrcref(rd[[4]]), useSource = FALSE) # "chars 2:12 to 2:11"
-
 
93
## Maybe the expansion should not get a "srcref" in the first place?
-
 
94
## (Note that RdTextFilter would need to be updated in this case.)
-
 
95
 
-
 
96
 
85
## An unmatched un-escaped '{' in a comment in \examples{} ... should *NOT* trip up, but does
97
## An unmatched un-escaped '{' in a comment in \examples{} ... should *NOT* trip up, but does
86
 
98
 
87
txt <- r"(\title{Commented left-brace in Example}
99
txt <- r"(\title{Commented left-brace in Example}
88
\name{ex-comm-brace}
100
\name{ex-comm-brace}
89
\examples{
101
\examples{