Skip to content

Commit 4b243c1

Browse files
author
hornik
committed
Turn 'doi:' URLs into the corresponding DOI URLs.
git-svn-id: https://svn.r-project.org/R/trunk@88483 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 360cd89 commit 4b243c1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/library/tools/R/Rd2HTML.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,13 +794,19 @@ Rd2HTML <-
794794
## watch out for empty URLs (TeachingDemos had one)
795795
"\\url" = if(length(block)) {
796796
url <- lines2str(as.character(block))
797+
if(startsWith(url, "doi:"))
798+
url <- paste0("https://doi.org/",
799+
substring(url, 5L))
797800
enterPara(doParas)
798801
of0('<a href="', urlify(url), '">', htmlify(url), '</a>')
799802
},
800803
"\\href" = {
801804
closing <-
802805
if(length(block[[1L]])) {
803806
url <- lines2str(as.character(block[[1L]]))
807+
if(startsWith(url, "doi:"))
808+
url <- paste0("https://doi.org/",
809+
substring(url, 5L))
804810
enterPara(doParas)
805811
of0('<a href="', urlify(url), '">')
806812
"</a>"

0 commit comments

Comments
 (0)