aboutsummaryrefslogblamecommitdiff
path: root/test.R
blob: 1a81652dc3e7be46df2e612b3ebfe3fba644b0c0 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                
                 
 
                            





                                                   


                                                
                 

                                   



                                  












                                                                

 
                     
 
                                                                                         
 

                                   
 

                                                  
 
library(pkgdown)
library(testthat)

debug(pkgdown:::topic_index)

build_reference_index(".")

extract_tag(rd[[1]], "tag_title") # gives "\n"
extract_tag(rd[[4]], "tag_title") # gives the title

extract_tag(rd[[1]], "tag_alias") # one aliase
extract_tag(rd[[13]], "tag_alias") # two aliases

library(magrittr)

extract_tag_1 <- function(x, tag) {
  x %>%
    purrr::keep(inherits, tag) %>%
    unlist %>%
    paste(collapse = "") %>%
    trimws
}

extract_tag <- function(x, tag) {
  x %>%
    purrr::keep(inherits, tag) %>%
    purrr::map_chr(c(1, 1))
}

extract_tag_1 <- function(x, tag) {
  x %>%
    purrr::keep(inherits, tag) %>%
    purrr::map_chr(function(x) trimws(paste(x, collapse = " ")))
}

subset(rd[[1]][[1]], 

sapply(extract_tag_1(rd[[1]], "tag_title"), function(x) trimws(paste(x, collapse = " ")))

extract_tag_1(rd[[1]], "tag_title")
extract_tag_1(rd[[4]], "tag_title")

extract_tag_1(rd[[1]], "tag_alias") # one aliase
extract_tag_1(rd[[13]], "tag_alias") # two aliases

Contact - Imprint