diff --git a/DESCRIPTION b/DESCRIPTION
index 4abb05108..0db43ed67 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
Package: tinytex
Type: Package
Title: Helper Functions to Install and Maintain TeX Live, and Compile LaTeX Documents
-Version: 0.53.2
+Version: 0.53.3
Authors@R: c(
person("Yihui", "Xie", role = c("aut", "cre", "cph"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")),
person(given = "Posit Software, PBC", role = c("cph", "fnd")),
diff --git a/R/install.R b/R/install.R
index 854aaabac..932cddf1e 100644
--- a/R/install.R
+++ b/R/install.R
@@ -214,9 +214,39 @@ auto_repo = function() {
# retrieve all CTAN (https) mirrors
ctan_mirrors = function() {
- x = readLines('https://ctan.org/mirrors/mirmon')
- u = xfun::grep_sub('.*
)?\\s*([^<]+)\\s*(.*)$', i)
+ res = unlist(lapply(unlist(strsplit(html, ']*>')), function(x) {
+ x = unlist(strsplit(x, ']*>'))
+ if (length(x) < 2 || !grepl('', x[1])) return()
+ r2 = r(2)
+ continent = gsub(r2, '\\2', x[1])
+ x[1] = gsub(r2, '\\3', x[1])
+ x = x[!grepl('^\\s*$', x)]
+ r3 = r(3)
+ if (!grepl(r3, x[1])) return()
+ country = gsub(r3, '\\2', x)
+ x = gsub(r3, '\\3', x)
+ r4 = r(4)
+ x = lapply(x, function(z) {
+ z = unlist(strsplit(z, ']*>'))
+ m = regexec(']*>https', z)
+ link = unlist(lapply(regmatches(z, m), `[`, 2))
+ names(link) = gsub(r4, '\\2', z)
+ link[!is.na(link)]
+ })
+ structure(list(structure(x, names = country)), names = continent)
+ }))
+ nm = lapply(strsplit(names(res), '.', fixed = TRUE), function(x) {
+ x3 = paste(x[-(1:2)], collapse = '.')
+ r5 = '.*\\(|\\).*'
+ x3 = if (grepl(r5, x3)) gsub(r5, '', x3) else ''
+ c(x[1], x[2], x3)
+ })
+ nm = do.call(rbind, nm)
+ res = cbind(nm, unname(res))
+ colnames(res) = c('Continent', 'Country/Region', 'City', 'URL')
+ as.data.frame(res)
}
# use %APPDATA%/TinyTeX if it exists or doesn't contain spaces or non-ASCII
|