Skip to content

Commit

Permalink
Improve style in dev-help.R
Browse files Browse the repository at this point in the history
  • Loading branch information
lionel- committed Jun 1, 2022
1 parent 8557ca0 commit 321e655
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions R/dev-help.r
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dev_help <- function(topic,

load_rd_macros <- function(dir) {
macros <- tools::loadPkgRdMacros(dir)
macros <- tools::loadRdMacros(
tools::loadRdMacros(
file.path(R.home("share"), "Rd", "macros", "system.Rd"),
macros = macros
)
Expand All @@ -62,15 +62,27 @@ print.dev_topic <- function(x, ...) {
macros <- load_rd_macros(dirname(dirname(x$path)))

if (type == "text") {
tools::Rd2txt(x$path, out = out_path, package = x$pkg, stages = x$stage, macros = macros)
tools::Rd2txt(
x$path,
out = out_path,
package = x$pkg,
stages = x$stage,
macros = macros
)
file.show(out_path, title = paste(x$pkg, basename(x$path), sep = ":"))
} else if (type == "html") {
if (is_installed("rstudioapi") && rstudioapi::hasFun("previewRd")) {
rstudioapi::callFun("previewRd", x$path)
return(invisible())
}
tools::Rd2HTML(x$path, out = out_path, package = x$pkg, stages = x$stage,
no_links = TRUE, macros = macros)
tools::Rd2HTML(
x$path,
out = out_path,
package = x$pkg,
stages = x$stage,
no_links = TRUE,
macros = macros
)

css_path <- file.path(tempdir(), "R.css")
if (!file.exists(css_path)) {
Expand Down

0 comments on commit 321e655

Please sign in to comment.