Attachment 'rhelium.R'

Download

   1 #' Format R Help Pages from Package Documentation
   2 #'
   3 #' This package was developed to allow additional formats for help pages created from R package
   4 #' documentation (viz., DESCRIPTION and Rd files in the 'man' folder). It includes a wrapper
   5 #' for the standard formats provided in 'tools' package (text, HTML, Latex and examples),
   6 #' but at this stage only for single Rd files. Currently the only additional format provided
   7 #' is \special{MoinMoin} wiki markup. For \special{MoinMoin} and for PDF, pages can be made
   8 #' for both single Rd files and for whole packages (with header and footers).
   9 #'
  10 #' This package is work-in-progress, so do not expect all Rd features to be converted
  11 #' to \special{MoinMoin} markup at this stage.
  12 #'
  13 #' The package name, 'rhelium', is in honour of 'roxygen2' that creates the Rd files used.
  14 #' Helium is ligher than oxygen, so the name has both illustrative and metaphorical meanings.
  15 #'
  16 #' For a complete list, use library(help = "rhelium").
  17 #'
  18 #' @note
  19 #' 'tools' does not export the functions used in this package, so this are subject to change,
  20 #' and if so, this package will need to be revised accordingly.
  21 #'
  22 #' 'rhelium' uses some general functions from 'local' package, see \link{\Sexpr{local:::self_url}}.
  23 #'
  24 #' @author Ian Riley \email{ian@@riley.asia}
  25 #' @docType package
  26 #' @section Version:
  27 #' \Sexpr{packageVersion("rhelium")}
  28 #' @importFrom tools parse_Rd Rd_db Rd2txt Rd2HTML Rd2latex Rd2ex file_ext
  29 #' @name rhelium
  30 "_PACKAGE"
  31 
  32 self <- "rhelium"
  33 options(installing_package = TRUE)
  34 source('~/.Rprofile')
  35 options(installing_package = NULL)
  36 home_path <- function() ifelse(is.null(options()$home), getwd(), options()$home)
  37 self_path <- file.path(home_path(), paste0(self, "-package"))
  38 self_url <- desc::desc_get_urls(self_path)[1]
  39 
  40 #' Document and install self
  41 #'
  42 #' Load required libraries, `devtools` and `roxygen2`, then document and install 'self'-package.
  43 #' @keywords internal
  44 #' @return Nothing returned.
  45 install_self <- function(package = self)
  46 {
  47 	local:::install_self(package = package)
  48 }
  49 
  50 #' Set working directory to package root
  51 #'
  52 #' @keywords internal
  53 #' @return Current working directory.
  54 pkgdir <- function(package = self)
  55 {
  56 	local:::pkgdir(package = package)
  57 }
  58 
  59 isLoaded <- function()
  60 {
  61 	isNamespaceLoaded(self)	
  62 }
  63 
  64 rhelium <- isLoaded()

You are not allowed to attach a file to this page.