-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate R docs build from roxygen comments (#205)
* Automate R docs build from roxygen comments * Update docs on docs
- Loading branch information
Showing
15 changed files
with
609 additions
and
460 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Converts R documentation (.Rd) files to markdown (.md) files | ||
# for use in Sphinx. | ||
|
||
library(rd2markdown) | ||
library(roxygen2) | ||
|
||
roxygen2::roxygenize() | ||
|
||
files <- list.files("man", pattern="*.Rd") | ||
|
||
# we only want to doc exported functions, so we need | ||
# to read the NAMESPACE file | ||
namespace <- paste0(readLines("NAMESPACE"), collapse="\n") | ||
|
||
for (f in files){ | ||
name <- substr(f, 1, nchar(f)-3) | ||
|
||
if (!grepl(name, namespace, fixed=TRUE)){ | ||
print(paste0("Skipping unexported ", name)) | ||
next | ||
} | ||
|
||
# read .Rd file and convert to markdown | ||
rd <- rd2markdown::get_rd(file=file.path(".", "man", f)) | ||
md <- rd2markdown::rd2markdown(rd, fragments=c()) | ||
|
||
# write it to the docs folder | ||
writeLines(md, file.path("..", "docs", "languages", "_r", paste0(name, ".md"))) | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
11 changes: 6 additions & 5 deletions
11
R/man/verify_bridgestan_path.Rd → R/man/get_bridgestan_path.Rd
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
These files are automatically generated in `conf.py` and should | ||
not be manually edited. They are built from the documentation | ||
comments in the R source code. |
Oops, something went wrong.