Skip to content

Generate html manuals in extractManuals #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: devel
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion R/repository.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ extractManuals <- function(reposRoot, srcContrib, destDir) {
buildManualsFromTarball <- function(tarball, unpackDir=".") {
## helper function to unpack pdf & Rd files from the vig
status <- TRUE
cleanUnpackDir(tarball, unpackDir, "man", ".*\\.(pdf|Rd|rd)$")
cleanUnpackDir(tarball, unpackDir, "man", ".*\\.(html|pdf|Rd|rd)$")
ret <- unpack(tarball, unpackDir, "'*/man/*.[Rr]d'")
if (ret != 0) {
warning("non-zero exit status ", ret, " extracting man pages: ",
Expand All @@ -87,11 +87,16 @@ extractManuals <- function(reposRoot, srcContrib, destDir) {
pkg <- pkgName(tarball)
pkgDir <- file.path(unpackDir, pkg, "man")
RCmd <- file.path(Sys.getenv("R_HOME"), "bin", "R")
## create pdf
Rd2pdfCmd <- paste0(
RCmd, " CMD Rd2pdf --no-preview ",
"--output=", pkgDir, "/", pkg, ".pdf ",
"--title=", pkg, " ", pkgDir, "/*.[Rr]d")
ret <- system(Rd2pdfCmd)
## create html
hooks <- list(pkg_href = function(pkg) sprintf("../../%s/man/%s.html", pkg, pkg))
tools::pkg2HTML(dir = pkgDir, out = paste0(pkgDir, "/", pkg, ".html"),
hooks = hooks)
cleanUnpackDir(tarball, unpackDir, "man", ".*\\.(Rd|rd)$")
if (ret != 0) {
warning("non-zero exit status ", ret, " building ref man: ", pkg)
Expand Down