Skip to content

Commit 7a1dd39

Browse files
authored
Drop stringi dep (#1839)
1 parent 8e90d6b commit 7a1dd39

4 files changed

Lines changed: 44 additions & 85 deletions

File tree

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ Imports:
3131
pkgload (>= 1.0.2),
3232
R6 (>= 2.1.2),
3333
rlang (>= 1.1.0),
34-
stringi,
3534
stringr (>= 1.0.0),
3635
utils,
3736
withr,

R/rd-backref.R

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ format.rd_section_backref <- function(x, ...) {
1717
fsep = "/"
1818
)
1919

20-
lines <- stringi::stri_wrap(
20+
lines <- strwrap(
2121
paste0("Please edit documentation in ", paste(filename, collapse = ", ")),
2222
initial = "% ",
2323
prefix = "% ",
24-
width = 80,
25-
whitespace_only = TRUE
24+
width = 80
2625
)
2726

28-
paste0(paste0(lines, collapse = "\n"))
27+
paste0(lines, collapse = "\n")
2928
}

R/utils.R

Lines changed: 40 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -9,88 +9,49 @@ internal_f <- function(p, f) {
99
if (length(a) > 0) a else b
1010
}
1111

12-
subs <- matrix(
13-
ncol = 2,
14-
byrow = T,
15-
c(
16-
# Common special function names
17-
'[<-',
18-
'subset',
19-
'[',
20-
'sub',
21-
'<-',
22-
'set',
23-
24-
# Infix verbs
25-
'!',
26-
'not',
27-
'&',
28-
'and',
29-
'|',
30-
'or',
31-
'*',
32-
'times',
33-
'+',
34-
'plus',
35-
'^',
36-
'pow',
37-
38-
# Others
39-
'"',
40-
'quote',
41-
'#',
42-
'hash',
43-
'$',
44-
'cash',
45-
'%',
46-
'grapes',
47-
"'",
48-
'single-quote',
49-
'(',
50-
'open-paren',
51-
')',
52-
'close-paren',
53-
':',
54-
'colon',
55-
';',
56-
'semi-colon',
57-
'<',
58-
'less-than',
59-
'==',
60-
'equals',
61-
'=',
62-
'equals',
63-
'>',
64-
'greater-than',
65-
'?',
66-
'help',
67-
'@',
68-
'at',
69-
']',
70-
'close-brace',
71-
'\\',
72-
'backslash',
73-
'/',
74-
'slash',
75-
'`',
76-
'tick',
77-
'{',
78-
'open-curly',
79-
'}',
80-
'close',
81-
'~',
82-
'twiddle'
83-
)
12+
subs <- c(
13+
# Common special function names
14+
"[<-" = "-subset-",
15+
"[" = "-sub-",
16+
"<-" = "-set-",
17+
18+
# Infix verbs
19+
"!" = "-not-",
20+
"&" = "-and-",
21+
"|" = "-or-",
22+
"*" = "-times-",
23+
"+" = "-plus-",
24+
"^" = "-pow-",
25+
26+
# Others
27+
'"' = "-quote-",
28+
"#" = "-hash-",
29+
"$" = "-cash-",
30+
"%" = "-grapes-",
31+
"'" = "-single-quote-",
32+
"(" = "-open-paren-",
33+
")" = "-close-paren-",
34+
":" = "-colon-",
35+
";" = "-semi-colon-",
36+
"<" = "-less-than-",
37+
"==" = "-equals-",
38+
"=" = "-equals-",
39+
">" = "-greater-than-",
40+
"?" = "-help-",
41+
"@" = "-at-",
42+
"]" = "-close-brace-",
43+
"\\" = "-backslash-",
44+
"/" = "-slash-",
45+
"`" = "-tick-",
46+
"{" = "-open-curly-",
47+
"}" = "-close-",
48+
"~" = "-twiddle-"
8449
)
85-
subs[, 2] <- paste0("-", subs[, 2], "-")
8650

8751
nice_name <- function(x) {
88-
x <- stringi::stri_replace_all_fixed(
89-
x,
90-
subs[, 1],
91-
subs[, 2],
92-
vectorize_all = FALSE
93-
)
52+
for (i in seq_along(subs)) {
53+
x <- gsub(names(subs)[[i]], subs[[i]], x, fixed = TRUE)
54+
}
9455

9556
# Clean up any remaining
9657
x <- str_replace_all(x, "[^A-Za-z0-9_.-]+", "-")

vignettes/extending.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ roxy_tag_parse.roxy_tag_memo <- function(x) {
263263
return()
264264
}
265265
266-
parsed <- stringi::stri_match(str = x$raw, regex = "\\[(.*)\\](.*)")[1, ]
266+
parsed <- regmatches(x$raw, regexec("\\[(.*)\\](.*)", x$raw))[[1]]
267267
268268
x$val <- list(
269269
header = parsed[[2]],

0 commit comments

Comments
 (0)