| output$template_info <- renderUI({ | output$template_info <- renderUI({ | ||||
| req(this_template()) | req(this_template()) | ||||
| tt <- this_template() | |||||
| rx_url <- "((https?|ftp|file)://)?([[:alnum:].-]+)\\.([a-zA-Z.]{2,6})([/[[:alpha:].-]*)*/?" | |||||
| tagList( | tagList( | ||||
| tags$h5("Description"), | tags$h5("Description"), | ||||
| tags$p(this_template()$description), | |||||
| tags$p(HTML(tt$description)), | |||||
| tags$h5("Pattern"), | tags$h5("Pattern"), | ||||
| tags$pre( | |||||
| tags$code( | |||||
| this_template()$regex | |||||
| ) | |||||
| tags$pre(tags$code(tt$regex)), | |||||
| if (!is.null(tt$source)) tags$p( | |||||
| "Source:", | |||||
| if (grepl(rx_url, tt$source)) tags$a(href = tt$source, tt$source) else tt$source | |||||
| ) | ) | ||||
| ) | ) | ||||
| }) | }) | ||||
| simplifyDataFrame = FALSE, | simplifyDataFrame = FALSE, | ||||
| simplifyMatrix = FALSE | simplifyMatrix = FALSE | ||||
| ) | ) | ||||
| patterns <- purrr::keep(patterns, ~ .$name != "") | |||||
| patterns[order(purrr::map_chr(patterns, 'name'))] | patterns[order(purrr::map_chr(patterns, 'name'))] | ||||
| } | } |