Course: Class to build a web-site with rmarkdown rendering...

CourseR Documentation

Class to build a web-site with rmarkdown rendering functionalities.

Description

The class generates a web-site based on the Rmd files in the directory 'site'. The directory has a flat structure and contains several categories of files:

_site.yml

This file in YAML format describing the structure and the look of the site with menues and sub-menus.

_schedule.yml

This file contains information about the course (see details).

<module-name>.Rmd

These files contain the course material on a specific topic.

_<name>.Rmd

These Rmd files can be re-used and are called from inside other Rmd files. They do not have a html counterpart in the _site directory.

data and images

These directories are copied into _site directory

footer.html

Footer content for all pages.

setup.R

This is needed if the individual Rmd files need to be generated inside RStudio using the 'knit' button.

Styles.css

Stylesheet file for the appearance

The files prefixed with _ will not be rendered and are for internal use.

Format

An R6Class generator object

Details

The schedule file has the following structure:

   course:
       title: <course-title>
       start: <start-date>
       end: <end-date>
       exam:
           date: <exam-date>
           time: <time-time>
           venue: <venue>
       slots:
           <slot-id>:
               title:  <session-title>
               subtitle: <session-subtitle>
               goal: <goals/description>
               date: <session-date>
               time: <session-time>
               venue: <venue>
               tasks : "yes | no"
           <slot-id>:
               ...

Methods

Public methods


Method load_config()

Load config.yml file.

Usage
Course$load_config(path, config_file)
Arguments
path

...

config_file

...

path_

course directory path.


Method config()

Access config.yml file. Given 'id' return value otherwise the complete list.

Usage
Course$config(id = NULL)

Method new()

Builds a TheCourse instance based on the 'config.yml' file in the path 'dir'

Usage
Course$new(path, config_file = "config.yml", site = "docs")
Arguments
config

config-file name.


Method src()

Path to site's directory containing all Rmd files.

Usage
Course$src()

Method clear_nocode_html()

clear generated nocode html file

Usage
Course$clear_nocode_html()

Method render_off()

Render the site only for modified Rmd's.

Usage
Course$render_off(clean = FALSE, ...)
Arguments
clean

If true the clean the site first.

...

arguments to rmarkdown::render_site


Method render()

Render the site ( todo: only for modified Rmd's).

Usage
Course$render(out_dir = ".docs")
Arguments
publish

...


Method site()

Usage
Course$site()

Method url()

Return the path to site's index.html

Usage
Course$url()

Method view()

View the site in the browser.

Usage
Course$view(publish = FALSE)
Arguments
publish

If TRUE then show the published build (docs) otherwise the development version (.docs).


Method schedule()

Course schedule from schedule.yml. #' @description Edit '_schedule.yml'. Render the pages by render() to enforce the changes. schedule = function() file.edit(file.path(self$src(),"_schedule.yml")) ,

Usage
Course$schedule()

Method slots()

Returns the list of course slots. The data is taken from '_schedule.yml'.

Usage
Course$slots()

Method next_slot()

given the base name of the slot return the basename of the next slot from '_schedule.yml'.

Usage
Course$next_slot(base_name)
Arguments
base_name

the RMD file basename.


Method prev_slot()

given the base name of the slot return the basename of the previous slot from '_schedule.yml'.

Usage
Course$prev_slot(base_name)
Arguments
base_name

the RMD file basename.


Method related()

given the base name of the slot return the related slots from '_schedule.yml'.

Usage
Course$related(base_name)
Arguments
base_name

the RMD file basename.


Method lstmod()

Returns the list of modified files.

Usage
Course$lstmod()

Method listing()

Returns the list of files for zip archive.

Usage
Course$listing(set = "archive")
Arguments
set

archive, data


Method zip()

Create a zip archive.

Usage
Course$zip(filename = "archive.zip", what = "arvhive")
Arguments
filename

name of zip archive.

what

archive, data


Method push()

clear generted files, i.e. site/

Usage
Course$push(slot, server = "shark", server_dir = "/bam-export/crip")

Method publish()

publish _site to remote site with rsync

Usage
Course$publish(
  remote = NULL,
  remote_dir = "/bam-export",
  server = "shark",
  group = "5-A-SHARK_BioCentEXP"
)

Method clean()

clear generted files, i.e. site/

Usage
Course$clean()

Method clone()

The objects of this class are cloneable with this method.

Usage
Course$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

rcourse <- Course$new()
rcourse$view()


LUMC/rcourse documentation built on Jan. 25, 2025, 12:20 a.m.