# ------------------------------------------------------------------- # - NAME: prepareStaticContent.R # - AUTHOR: Reto Stauffer # - DATE: 2018-09-15 # ------------------------------------------------------------------- # - DESCRIPTION: # ------------------------------------------------------------------- # - EDITORIAL: 2016-10-23, RS: Created file on pc24-c707. # ------------------------------------------------------------------- # - L@ST MODIFIED: 2018-09-22 14:19 on marvin # ------------------------------------------------------------------- library("colorspace") # ------------------------------------------------------------------- # Snippet from: # http://yihui.name/en/2012/10/build-static-html-help/ # Create static html from Rd files. # ------------------------------------------------------------------- static_help = function(pkg, methods, links = tools::findHTMLlinks()) { pkgRdDB = tools:::fetchRdDB(file.path(find.package(pkg), 'help', pkg)) force(links); topics = names(pkgRdDB) for (p in topics) { if ( ! is.null(methods) ) { if ( ! p %in% methods ) next } message(sprintf("Create static html help page for %s::%s",pkg,p)) content = pkgRdDB[[p]] tools::Rd2HTML(pkgRdDB[[p]], sprintf("tmp_%s.html",p), package = pkg, Links = links, no_links = is.null(links)) } } cat(" * Create static help pages using Rd2HTML\n") static_help("colorspace","cvd_emulator") static_help("colorspace","cvd_image") # ------------------------------------------------------------------- # Parsing html content and create new static help page for # the hclwizard. # ------------------------------------------------------------------- # Reading help page content getHTMLcontent <- function(file) { # Helper function to extract the different sections extract <- function(html,sec) { r <- regmatches(html,regexpr(sprintf("