Crate futhorc[][src]

The library code for the futhorc static site generator. The architecture can be generally broken down into two distinct steps:

  1. Parsing posts from source files on disk (crate::post)
  2. Converting the posts into output files on disk (crate::write)

Of the two, the second step is the more involved. It is itself composed of three distinct sub-steps:

  1. Building post pages
  2. Building index pages
  3. Rendering all pages to disk

Again here the second sub-step is the more involved, because we need to create groups of index pages for each tag and another group for the empty tag which corresponds to all posts. A group of index pages is referred to as an “index”, and each index is paginated–converted into groups of pages based on a configurable number of posts per index page.

The third substep is pretty straight-forward: for each page, apply the template (either the post template or the index template) and write the result to disk.

Modules

build

Exports the build_site function which stitches together the high-level steps of building the output static site: parsing the posts (crate::post), rendering index and post pages (crate::write), and copying the static source directory into the static output directory.

config

Contains the logic for collecting and consolidating the program’s configuration.

htmlrenderer

Implements a custom push_html to support footnotes in summaries. pulldown_cmark::html::push_html assumes that the footnote definition is on the same page as the footnote reference, which is true for post pages, but not for the index pages (in cases where the footnote reference appears above the fold in the post summary, but the footnote definition is at the bottom of the post page).

post

Defines the Post, Parser, and Error types. Also defines the logic for parsing posts from the file system into memory. See the Post::to_value and Post::summarize for details on how posts are converted into template values.

tag

Defines the Tag type, which represents a crate::post::Post tag.

url

Defines Url and UrlBuf types which are analogous to the str and String or std::path::Path and std::path::PathBuf pairs. These are effectively newtypes for str and String.

write

Takes Post objects created by the crate::post module and turns them into index and post HTML files on the file system.