Skip to content

Commit 95a6610

Browse files
committed
Improve ordering
1 parent 60621e8 commit 95a6610

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

R/rd-family.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,15 @@ topics_process_family <- function(topics, env) {
5151
if (length(others) < 1)
5252
next
5353

54-
by_file <- map_chr(aliases[others], function(x) {
54+
other_aliases <- aliases[others]
55+
other_aliases_order <- map_chr(other_aliases, function(x) escape(x[1]))
56+
57+
by_file <- map_chr(other_aliases[order_c(other_aliases_order)], function(x) {
5558
obj <- find_object(x[1], env)
5659
suffix <- if (is.function(obj$value)) "()" else ""
5760
paste0("\\code{\\link{", escape(x[1]), "}", suffix, "}")
5861
})
59-
links <- paste(sort_c(by_file), collapse = ",\n")
62+
links <- paste(by_file, collapse = ",\n")
6063
seealso <- topics_process_family_prefix(family)
6164

6265
topic$add(rd_section("seealso", paste0(seealso, "\n", links)))

R/util-locale.R

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,10 @@ with_collate <- function(locale, code) {
1111
force(code)
1212
}
1313

14-
sort_c <- function(x, ...) with_collate("C", sort(x, ...))
14+
sort_c <- function(x, ...) {
15+
with_collate("C", sort(x, ...))
16+
}
17+
18+
order_c <- function(x, ...) {
19+
with_collate("C", order(x, ...))
20+
}

tests/testthat/_snaps/rd-family.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
}
1818
\seealso{
1919
Other a:
20-
\code{\link{foo2}()},
21-
\code{\link{foo}()}
20+
\code{\link{foo}()},
21+
\code{\link{foo2}()}
2222
}
2323
\concept{a}
2424
@@ -36,8 +36,8 @@
3636
}
3737
\seealso{
3838
Other a:
39-
\code{\link{foo1}()},
40-
\code{\link{foo}()}
39+
\code{\link{foo}()},
40+
\code{\link{foo1}()}
4141
}
4242
\concept{a}
4343

0 commit comments

Comments
 (0)