Module: Polites::Nanoc

Defined in:
lib/polites/nanoc.rb,
lib/polites/nanoc/data_source.rb,
lib/polites/nanoc/extract_file_filter.rb,
lib/polites/nanoc/embedded_images_filter.rb

Overview

The Nanoc module provides integration with the Nanoc static site generator. It allows you to configure a Polites external directory as a data source in a Nanoc site, so you can transform Polites files straight into HTML documents.

This gem consists of the following parts:

  • DataSource implements the data source that reads .ulyz files from disk and creates Nanoc HTML items from them.
  • EmbeddedImagesFilter implements a filter you can use to transform the image paths in your HTML to the pats generated by your Nanoc rules.
  • ExtractFileFilter is a filter that will extract embedded files from the .ulyz zip file to actual output files on disk in your Nanoc site.

Examples:

Nanoc configuration using Polites data source

# in nanoc.yaml
data_sources:
  - type: polites
    items_root: /articles/
    path: path/to/articles

Require Ulussyes::Nanoc in your site

# lib/default.rb
require 'polites/nanoc'

Nanoc rule to compile Ulussyes articles

compile "/articles/*.ulyz" do
  filter :polites_embedded_images
  layout "/default.*"
  write item.identifier.without_ext + "/index.html"
end

Nanoc rule to extract embedded media

compile(%r{\A/articles/.+\.ulyz/media/.+\Z}) do
  filter :extract_file
  write item.identifier.to_s.sub(".ulyz", "")
end

Defined Under Namespace

Classes: DataSource, EmbeddedImagesFilter, ExtractFileFilter