Skip to content

Commit

Permalink
do not transform self github links to local links
Browse files Browse the repository at this point in the history
This buys me some time to make sure carpentries/sandpaper#447
will not break a lot of things.
  • Loading branch information
zkamvar committed May 2, 2023
1 parent 44f8898 commit e9482f6
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions librarycarpentry/lc-data-intro.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,11 @@ that <- "/librarycarpentry/lc-data-intro/blob/gh-pages/"
to_fix <- startsWith(tolower(lnks$path), this) | startsWith(tolower(lnks$path), that)
purrr::walk(lnks$node[to_fix], function(node) {
dst <- xml2::xml_attr(node, "destination")
new <- sub(paste0("https://github.com", this), "", dst, ignore.case = TRUE)
new <- sub(paste0("https://github.com", that), "", new, ignore.case = TRUE)
if (startsWith(new, "files")) {
xml2::xml_set_attr(node, "destination", paste0("../episodes/", new))
if (new == "files") {
xml2::xml_set_text(node, "episodes/files")
}
} else {
xml2::xml_set_attr(node, "destination", new)
new <- sub("gh-pages", "main", dst)
if (endsWith(new, "files")) {
xml2::xml_set_text(node, "episodes/files")
}
xml2::xml_set_attr(node, "destination", new)
})
all_fix <- to_fix | all_fix

Expand Down

0 comments on commit e9482f6

Please sign in to comment.