NOTE: This documentation is out of date

I will be updating it soon. The main changes are:

How it works

A single function called quilt is given a target directory containing HTML files and a location to output a website directory. Below is a summary of how it works:

Together, the partial copy of the target directory (HTML files and their dependencies) and the pages used to display HTML files therein, constitute a portable and self-contained website. If the contents of the target directory change, the function can be run again to update the website. One benefit of this system is that even if a large HTML file appears multiple places on the website, it is only stored once. Also, the original file is available for viewing or download (in Firefox: right click > This frame > …), which is useful for printing notes or viewing embedded HTML slide shows.

Inferring menu hierarchy

The most useful feature of quiltr is inferring a menu hierarchy from the context of HTML files. There are two general ways to go about doing this:

Using file path information is probably most appropriate for documenting a computational analysis or research notebook directory since it takes the least upkeep and the organization of the project is evident in the website. Using configuration files can be more involved, but allows for a completely customized hierarchy regardless of the directory or name of HTML content files, making it more appropriate for conventional websites. In any case, the menu can have infinite levels and is mobile-device-friendly.

Using file path information

The placement of HTML content can be determined by the names in its path relative to the target directory. For example, if you had the following 5 HTML files on your computer…

/home/your_name/documents/notes/old/note_1.html
/home/your_name/documents/notes/old/note_2.html
/home/your_name/documents/notes/old/sub_dir/note_3.html
/home/your_name/documents/notes/old/sub_dir/another_sub_dir/note_4.html
/home/your_name/documents/notes/new/note_5.html

…and you specified that the target directory is /home/your_name/documents/notes, then:

  • note 1 and 2 would appear together on a page of the website reached by the old menu item
  • note 3 would appear on a page accessed by a sub-menu (old > sub_dir)
  • note 4 would appear on a page accessed by a sub-menu (old > sub_dir > another_sub_dir)
  • note 5 would appear on a page accessed by the menu item new

Which parts of the file path are used and how they are processed is affected by a variety of options. The example showed below corresponds to the default options values, but many variations are possible.

quilt(path = "/home/your_name/documents/notes")

Using content placement configurartion files

Configuration files can be used to specify the location in the menu hierarchy of specific HTML files. This can be used in combination with or independent of the file path information when determining display location. The example below is the same as the previous one except for the addition of two configuration files named “.note_config.yml”:

/home/your_name/documents/notes/old/note_1.html
/home/your_name/documents/notes/old/note_2.html
/home/your_name/documents/notes/old/note_config.yml
/home/your_name/documents/notes/old/sub_dir/note_3.html
/home/your_name/documents/notes/old/sub_dir/note_config.yml
/home/your_name/documents/notes/old/sub_dir/another_sub_dir/note_4.html
/home/your_name/documents/notes/new/note_5.html

The name of the configuration files can be specified when building the website, so they can be named anything; in this instance they are named “.note_config.yml”. The content of the configuration files should be a named list in YAML format, where the name is a file path relative to the configuration files’ location and the elements of the list are website menu locations. The file path can include wildcards or other common file path syntax. The configuration files listed above in the example have the following content:

/home/your_name/documents/notes/old/note_config.yml:

'note_1.html':
- absolute
- placement

/home/your_name/documents/notes/old/sub_dir/note_config.yml:

'note_3.html':
- .
- relative
- placement

'*/*.html': NULL

The first configuration file causes the content of “note_1.html” to be displayed in the menu location custom > placement instead of old. The second has two effects:

  • The the levels relative > placement are added to the menu location that “note_3.html” is displayed under. The . as the first list element causes the following levels to be added to the menu path instead of replacing it. The location in the hierarchy is therefore old > sub_dir > relative > placement.
  • All HTML files in any sub directory (relative to /home/your_name/documents/notes/old/sub_dir) will not be included in the website due to NULL being the only element specified. In this case, “note_4.html” will not be included.

Below is the result of building the above directory structure using default options:

quilt(path = "/home/your_name/documents/notes", note_config_name = "note_config.yml")

Using a website build configuration file

In addition to the configuration files used to determine content location, there is another type used to specify default website building options. This configuration file is also in YAML format and contains the values of some or all of the options accepted by the quilt function. Option values specified here replace the defaults when running quilt, although options specified in the configuration file can still be overwritten by function options used. Unlike the content placement configuration files, only one of this type of this type can be used each time a website is built. They are useful for storing the options used to build a specific website in its source directory so that rebuilding the website can be simplified to running quilt() in the project directory. Below is an example of website build configuration file content. In the context of the previous examples, this configuration file would be saved at “/home/your_name/documents/notes/build_config.yml”.

clean: false
theme: cosmo
note_config_name: note_config.yml

In addition to the user generated files in the source directory, these type of files are automatically made in the output each time a website is created to record the parameters used. Since the configuration file used can be specified by a quilt option, these can be referenced to rebuild a website with the same parameters as last time.