Class: Nanoc3::DataSources::FilesystemUnified

Inherits:
Nanoc3::DataSource show all
Includes:
Filesystem
Defined in:
lib/nanoc3/data_sources/filesystem_unified.rb

Overview

The filesystem_unified data source stores its items and layouts in nested directories. Items and layouts are represented by one or two files; if it is represented using one file, the metadata can be contained in this file. The root directory for items is the ‘content` directory; for layouts, this is the `layouts` directory.

The metadata for items and layouts can be stored in a separate file with the same base name but with the ‘.yaml` extension. If such a file is found, metadata is read from that file. Alternatively, the content file itself can start with a metadata section: it can be stored at the top of the file, between `—` (three dashes) separators. For example:

---
title: "Moo!"
---
h1. Hello!

The metadata section can be omitted. If the file does not start with three or five dashes, the entire file will be considered as content.

The identifier of items and layouts is determined as follows. A file with an ‘index.*` filename, such as `index.txt`, will have the filesystem path with the `index.*` part stripped as a identifier. For example:

foo/bar/index.html 

In other cases, the identifier is calculated by stripping the extension. If the ‘allow_periods_in_identifiers` attribute in the configuration is true, only the last extension will be stripped if the file has multiple extensions; if it is false or unset, all extensions will be stripped. For example:

(`allow_periods_in_identifiers` set to true)
foo.entry.html 

Note that each item must have an unique identifier. nanoc will display an error if two items with the same identifier are found.

Some more examples:

content/index.html          

The file extension does not determine the filters to run on items; the Rules file is used to specify processing instructors for each item.

Instance Attribute Summary

Attributes included from Filesystem

#vcs

Attributes inherited from Nanoc3::DataSource

#config, #items_root, #layouts_root

Method Summary

Methods included from Filesystem

#create_item, #create_layout, #down, #items, #layouts, #setup, #up

Methods inherited from Nanoc3::DataSource

#create_item, #create_layout, #down, #initialize, #items, #layouts, #loading, #setup, #unuse, #up, #update, #use

Methods included from PluginRegistry::PluginMethods

#identifier, #identifiers, #named, #register

Constructor Details

This class inherits a constructor from Nanoc3::DataSource