staticdocs is a Hadley Wickham package that can make nifty web pages for a package. I've used it with great success (though haven't figured out how to add the examples without error yet) but each time I have to manually reformat the readme portion of the index.html
file that is created. This seems silly as it appears from the ggplot2 staticdocs use that there is a way to set up readme in the index file inside of inst/staticdocs/
.
Right now Hadley hasn't documented the package that well (staticdocs) and I'm unsure how to alter the readme argument/list entry in the index file. Does anyone have guidance on what the format for this should look like; i.e., the format of how the entry should look?
Until Hadley and his team are able to develop staticdocs and its documentation more here is my work around found in a very rough package:
#' Change read.me File
#'
#' Alter the read.me file with a preset.
#'
#' @param path Path to the index.html file.
#' @param readme Path to the readme file.
#' @param file The path/file name to output.
readme_statdoc <- function(path, readme, file = NULL) {
if (length(path) > 1) {
x <- path
} else {
x <- suppressWarnings(readLines(path))
}
y <- suppressWarnings(readLines(readme))
start <- which(grepl("<h1></h1>", x))
end <- which(grepl("<h2>Help topics</h2>", x))
x <- c(x[1:start], "", y, "", x[end:length(x)])
if (!is.null(file)) {
cat(paste(x, collapse="\n"), file = file)
}
return(x)
}
Basically you create an external document to insert into the read me portion. I used this in qdap and you can see how I use it in creating a staticdoc web site via this script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With