devdocs/lib/docs/scrapers/r.rb

59 lines
1.6 KiB
Ruby
Raw Permalink Normal View History

Add R documentation Contains the R base + recommended package help pages converted to HTML. Equivalent to the fullrefman.pdf generated from source, which is also called « The R Reference Index » on https://cran.r-project.org/manuals.html Currently does not include reference manuals and miscellanea (FAQ, etc.) Script building the documentation: ```bash set -e set -o pipefail DEVDOCSROOT=/path/to/devdocs/docs/r RSOURCEDIR=${TMPDIR:-/tmp}/R/latest RBUILDDIR=${TMPDIR:-/tmp}/R/build RLATEST=https://cran.r-project.org/src/base/R-latest.tar.gz R="$RBUILDDIR/bin/R" libdir="$RBUILDDIR/library" docdir=$RBUILDDIR/doc makevars="$RSOURCEDIR/share/make/vars.mk" if [ ! -f "$R" ] ; then if [ ! -d "$RSOURCEDIR" ]; then mkdir -p "$RSOURCEDIR" && curl "$RLATEST" | tar -C "$RSOURCEDIR" -xzf - --strip-components=1 fi [ -d "$RBUILDDIR" ] || mkdir -p "$RBUILDDIR" [ -f "$RBUILDDIR/config.status" ] || (cd "$RBUILDDIR" && "$RSOURCEDIR/configure") make -C "$RBUILDDIR" && make -C "$RBUILDDIR" docs fi mkdir -p "$DEVDOCSROOT/doc" && cp -r "$docdir"/* "$DEVDOCSROOT/doc/" find "$libdir" -type d -name 'html' -printf '%P\n' | while read d; do mkdir -p "$DEVDOCSROOT/library/$d" cp -r "$libdir/$d"/* "$DEVDOCSROOT/library/$d/" done R_PKGS_BASE="`sed -n 's/^R_PKGS_BASE *= *//p' $makevars`" R_PKGS_RECOMMENDED="`sed -n 's/^R_PKGS_RECOMMENDED *= *//p' $makevars`" cat <<EOF | _R_HELP_LINKS_TO_TOPICS_=FALSE $R --vanilla --no-echo links <- tools::findHTMLlinks() for (pkg in c(`echo $R_PKGS_BASE $R_PKGS_RECOMMENDED | sed 's/\S\+/"&"/g;s/ /, /g'`)) { Rd <- tools::Rd_db(pkg, lib.loc="$libdir") if (!length(Rd)) { message(paste("ERROR: no help files found for package", pkg)) } else { message(paste0(pkg, "...")) } for(f in names(Rd)) { out <- file.path("$DEVDOCSROOT/library", pkg, "html", sub("[Rr]d$", "html", basename(f))) tools::Rd2HTML(Rd[[f]], out, package = "$pkg", defines = .Platform\$OS.type, outputEncoding = "UTF-8", no_links = FALSE, dynamic = FALSE, Links = links, stages = c("build", "install", "render")) } } EOF echo "DONE! Start at $DEVDOCSROOT/doc/html/index.html (or $DEVDOCSROOT/doc/html/packages.html)" ```
2021-05-25 16:18:01 +02:00
module Docs
class R < FileScraper
self.name = 'R'
self.slug = 'r'
self.type = 'simple'
self.release = '4.1.0'
self.links = {
home: 'https://www.r-project.org/',
code: 'https://svn.r-project.org/R/'
}
self.root_path = 'doc/html/packages.html'
html_filters.push 'r/entries', 'r/clean_html'
options[:skip_links] = false
options[:attribution] = <<-HTML
Copyright (&copy;) 19992012 R Foundation for Statistical Computing.<br>
Add R documentation Contains the R base + recommended package help pages converted to HTML. Equivalent to the fullrefman.pdf generated from source, which is also called « The R Reference Index » on https://cran.r-project.org/manuals.html Currently does not include reference manuals and miscellanea (FAQ, etc.) Script building the documentation: ```bash set -e set -o pipefail DEVDOCSROOT=/path/to/devdocs/docs/r RSOURCEDIR=${TMPDIR:-/tmp}/R/latest RBUILDDIR=${TMPDIR:-/tmp}/R/build RLATEST=https://cran.r-project.org/src/base/R-latest.tar.gz R="$RBUILDDIR/bin/R" libdir="$RBUILDDIR/library" docdir=$RBUILDDIR/doc makevars="$RSOURCEDIR/share/make/vars.mk" if [ ! -f "$R" ] ; then if [ ! -d "$RSOURCEDIR" ]; then mkdir -p "$RSOURCEDIR" && curl "$RLATEST" | tar -C "$RSOURCEDIR" -xzf - --strip-components=1 fi [ -d "$RBUILDDIR" ] || mkdir -p "$RBUILDDIR" [ -f "$RBUILDDIR/config.status" ] || (cd "$RBUILDDIR" && "$RSOURCEDIR/configure") make -C "$RBUILDDIR" && make -C "$RBUILDDIR" docs fi mkdir -p "$DEVDOCSROOT/doc" && cp -r "$docdir"/* "$DEVDOCSROOT/doc/" find "$libdir" -type d -name 'html' -printf '%P\n' | while read d; do mkdir -p "$DEVDOCSROOT/library/$d" cp -r "$libdir/$d"/* "$DEVDOCSROOT/library/$d/" done R_PKGS_BASE="`sed -n 's/^R_PKGS_BASE *= *//p' $makevars`" R_PKGS_RECOMMENDED="`sed -n 's/^R_PKGS_RECOMMENDED *= *//p' $makevars`" cat <<EOF | _R_HELP_LINKS_TO_TOPICS_=FALSE $R --vanilla --no-echo links <- tools::findHTMLlinks() for (pkg in c(`echo $R_PKGS_BASE $R_PKGS_RECOMMENDED | sed 's/\S\+/"&"/g;s/ /, /g'`)) { Rd <- tools::Rd_db(pkg, lib.loc="$libdir") if (!length(Rd)) { message(paste("ERROR: no help files found for package", pkg)) } else { message(paste0(pkg, "...")) } for(f in names(Rd)) { out <- file.path("$DEVDOCSROOT/library", pkg, "html", sub("[Rr]d$", "html", basename(f))) tools::Rd2HTML(Rd[[f]], out, package = "$pkg", defines = .Platform\$OS.type, outputEncoding = "UTF-8", no_links = FALSE, dynamic = FALSE, Links = links, stages = c("build", "install", "render")) } } EOF echo "DONE! Start at $DEVDOCSROOT/doc/html/index.html (or $DEVDOCSROOT/doc/html/packages.html)" ```
2021-05-25 16:18:01 +02:00
Licensed under the <a href="https://www.gnu.org/copyleft/gpl.html">GNU General Public License</a>.
HTML
# Never want those
options[:skip_patterns] = [
/\/DESCRIPTION$/,
/\/NEWS(\.[^\/]*)?$/,
/\/doc\/index\.html$/,
/\/demo$/,
/\.pdf$/
]
options[:replace_paths] = {
## We want to fix links like so but only if the targets dont exist:
# 'library/MASS/html/cov.mve.html' => 'library/MASS/html/cov.rob.html'
## Paths for target packages or keywords that do not have their own file
## are generated in the entries filter from 00Index.html files
}
Add R documentation Contains the R base + recommended package help pages converted to HTML. Equivalent to the fullrefman.pdf generated from source, which is also called « The R Reference Index » on https://cran.r-project.org/manuals.html Currently does not include reference manuals and miscellanea (FAQ, etc.) Script building the documentation: ```bash set -e set -o pipefail DEVDOCSROOT=/path/to/devdocs/docs/r RSOURCEDIR=${TMPDIR:-/tmp}/R/latest RBUILDDIR=${TMPDIR:-/tmp}/R/build RLATEST=https://cran.r-project.org/src/base/R-latest.tar.gz R="$RBUILDDIR/bin/R" libdir="$RBUILDDIR/library" docdir=$RBUILDDIR/doc makevars="$RSOURCEDIR/share/make/vars.mk" if [ ! -f "$R" ] ; then if [ ! -d "$RSOURCEDIR" ]; then mkdir -p "$RSOURCEDIR" && curl "$RLATEST" | tar -C "$RSOURCEDIR" -xzf - --strip-components=1 fi [ -d "$RBUILDDIR" ] || mkdir -p "$RBUILDDIR" [ -f "$RBUILDDIR/config.status" ] || (cd "$RBUILDDIR" && "$RSOURCEDIR/configure") make -C "$RBUILDDIR" && make -C "$RBUILDDIR" docs fi mkdir -p "$DEVDOCSROOT/doc" && cp -r "$docdir"/* "$DEVDOCSROOT/doc/" find "$libdir" -type d -name 'html' -printf '%P\n' | while read d; do mkdir -p "$DEVDOCSROOT/library/$d" cp -r "$libdir/$d"/* "$DEVDOCSROOT/library/$d/" done R_PKGS_BASE="`sed -n 's/^R_PKGS_BASE *= *//p' $makevars`" R_PKGS_RECOMMENDED="`sed -n 's/^R_PKGS_RECOMMENDED *= *//p' $makevars`" cat <<EOF | _R_HELP_LINKS_TO_TOPICS_=FALSE $R --vanilla --no-echo links <- tools::findHTMLlinks() for (pkg in c(`echo $R_PKGS_BASE $R_PKGS_RECOMMENDED | sed 's/\S\+/"&"/g;s/ /, /g'`)) { Rd <- tools::Rd_db(pkg, lib.loc="$libdir") if (!length(Rd)) { message(paste("ERROR: no help files found for package", pkg)) } else { message(paste0(pkg, "...")) } for(f in names(Rd)) { out <- file.path("$DEVDOCSROOT/library", pkg, "html", sub("[Rr]d$", "html", basename(f))) tools::Rd2HTML(Rd[[f]], out, package = "$pkg", defines = .Platform\$OS.type, outputEncoding = "UTF-8", no_links = FALSE, dynamic = FALSE, Links = links, stages = c("build", "install", "render")) } } EOF echo "DONE! Start at $DEVDOCSROOT/doc/html/index.html (or $DEVDOCSROOT/doc/html/packages.html)" ```
2021-05-25 16:18:01 +02:00
options[:skip] = %w(
doc/html/packages-head-utf8.html
doc/html/SearchOn.html
doc/html/Search.html
doc/html/UserManuals.html
doc/html/faq.html
doc/manual/R-FAQ.html
doc/manual/R-admin.html
doc/manual/R-exts.html
doc/manual/R-ints.html
doc/manual/R-lang.html
Add R documentation Contains the R base + recommended package help pages converted to HTML. Equivalent to the fullrefman.pdf generated from source, which is also called « The R Reference Index » on https://cran.r-project.org/manuals.html Currently does not include reference manuals and miscellanea (FAQ, etc.) Script building the documentation: ```bash set -e set -o pipefail DEVDOCSROOT=/path/to/devdocs/docs/r RSOURCEDIR=${TMPDIR:-/tmp}/R/latest RBUILDDIR=${TMPDIR:-/tmp}/R/build RLATEST=https://cran.r-project.org/src/base/R-latest.tar.gz R="$RBUILDDIR/bin/R" libdir="$RBUILDDIR/library" docdir=$RBUILDDIR/doc makevars="$RSOURCEDIR/share/make/vars.mk" if [ ! -f "$R" ] ; then if [ ! -d "$RSOURCEDIR" ]; then mkdir -p "$RSOURCEDIR" && curl "$RLATEST" | tar -C "$RSOURCEDIR" -xzf - --strip-components=1 fi [ -d "$RBUILDDIR" ] || mkdir -p "$RBUILDDIR" [ -f "$RBUILDDIR/config.status" ] || (cd "$RBUILDDIR" && "$RSOURCEDIR/configure") make -C "$RBUILDDIR" && make -C "$RBUILDDIR" docs fi mkdir -p "$DEVDOCSROOT/doc" && cp -r "$docdir"/* "$DEVDOCSROOT/doc/" find "$libdir" -type d -name 'html' -printf '%P\n' | while read d; do mkdir -p "$DEVDOCSROOT/library/$d" cp -r "$libdir/$d"/* "$DEVDOCSROOT/library/$d/" done R_PKGS_BASE="`sed -n 's/^R_PKGS_BASE *= *//p' $makevars`" R_PKGS_RECOMMENDED="`sed -n 's/^R_PKGS_RECOMMENDED *= *//p' $makevars`" cat <<EOF | _R_HELP_LINKS_TO_TOPICS_=FALSE $R --vanilla --no-echo links <- tools::findHTMLlinks() for (pkg in c(`echo $R_PKGS_BASE $R_PKGS_RECOMMENDED | sed 's/\S\+/"&"/g;s/ /, /g'`)) { Rd <- tools::Rd_db(pkg, lib.loc="$libdir") if (!length(Rd)) { message(paste("ERROR: no help files found for package", pkg)) } else { message(paste0(pkg, "...")) } for(f in names(Rd)) { out <- file.path("$DEVDOCSROOT/library", pkg, "html", sub("[Rr]d$", "html", basename(f))) tools::Rd2HTML(Rd[[f]], out, package = "$pkg", defines = .Platform\$OS.type, outputEncoding = "UTF-8", no_links = FALSE, dynamic = FALSE, Links = links, stages = c("build", "install", "render")) } } EOF echo "DONE! Start at $DEVDOCSROOT/doc/html/index.html (or $DEVDOCSROOT/doc/html/packages.html)" ```
2021-05-25 16:18:01 +02:00
)
def get_latest_version(opts)
body = fetch('https://cran.r-project.org/src/base/NEWS', opts)
body.match(/CHANGES IN R ([\d.]+):/)[1]
end
Add R documentation Contains the R base + recommended package help pages converted to HTML. Equivalent to the fullrefman.pdf generated from source, which is also called « The R Reference Index » on https://cran.r-project.org/manuals.html Currently does not include reference manuals and miscellanea (FAQ, etc.) Script building the documentation: ```bash set -e set -o pipefail DEVDOCSROOT=/path/to/devdocs/docs/r RSOURCEDIR=${TMPDIR:-/tmp}/R/latest RBUILDDIR=${TMPDIR:-/tmp}/R/build RLATEST=https://cran.r-project.org/src/base/R-latest.tar.gz R="$RBUILDDIR/bin/R" libdir="$RBUILDDIR/library" docdir=$RBUILDDIR/doc makevars="$RSOURCEDIR/share/make/vars.mk" if [ ! -f "$R" ] ; then if [ ! -d "$RSOURCEDIR" ]; then mkdir -p "$RSOURCEDIR" && curl "$RLATEST" | tar -C "$RSOURCEDIR" -xzf - --strip-components=1 fi [ -d "$RBUILDDIR" ] || mkdir -p "$RBUILDDIR" [ -f "$RBUILDDIR/config.status" ] || (cd "$RBUILDDIR" && "$RSOURCEDIR/configure") make -C "$RBUILDDIR" && make -C "$RBUILDDIR" docs fi mkdir -p "$DEVDOCSROOT/doc" && cp -r "$docdir"/* "$DEVDOCSROOT/doc/" find "$libdir" -type d -name 'html' -printf '%P\n' | while read d; do mkdir -p "$DEVDOCSROOT/library/$d" cp -r "$libdir/$d"/* "$DEVDOCSROOT/library/$d/" done R_PKGS_BASE="`sed -n 's/^R_PKGS_BASE *= *//p' $makevars`" R_PKGS_RECOMMENDED="`sed -n 's/^R_PKGS_RECOMMENDED *= *//p' $makevars`" cat <<EOF | _R_HELP_LINKS_TO_TOPICS_=FALSE $R --vanilla --no-echo links <- tools::findHTMLlinks() for (pkg in c(`echo $R_PKGS_BASE $R_PKGS_RECOMMENDED | sed 's/\S\+/"&"/g;s/ /, /g'`)) { Rd <- tools::Rd_db(pkg, lib.loc="$libdir") if (!length(Rd)) { message(paste("ERROR: no help files found for package", pkg)) } else { message(paste0(pkg, "...")) } for(f in names(Rd)) { out <- file.path("$DEVDOCSROOT/library", pkg, "html", sub("[Rr]d$", "html", basename(f))) tools::Rd2HTML(Rd[[f]], out, package = "$pkg", defines = .Platform\$OS.type, outputEncoding = "UTF-8", no_links = FALSE, dynamic = FALSE, Links = links, stages = c("build", "install", "render")) } } EOF echo "DONE! Start at $DEVDOCSROOT/doc/html/index.html (or $DEVDOCSROOT/doc/html/packages.html)" ```
2021-05-25 16:18:01 +02:00
end
end