Readers

Readers are responsible for parsing the content sources passed on by the loader. For each content source, the Reader attempts to produce a blot.assets.ContentAsset:

class blot.assets.ContentAsset(source=None, content=None, metadata={})

An object with some data and associated metadata.

ContentAssets represent the result of loading and reading content sources. The result of parsing the source source provides its content and optional metadata dictionary.

ContentAssets are fed through a pipeline of processors where they may be modified in various ways. Eventually, they are passed to Writers which can render them to their final destinations on disk.

A basic dictionary-like access is avaiable as a shortcut to the asset’s metadata. Once the assets’s target attribute has been set, its url property will become available.

Some assets are produced by the processing of other assets and have no source.

StaticReader

The simplest reader in Blot is the blot.readers.staticreader.StaticReader which performs no parsing on source content. Therefore it also produces no metadata.

class blot.readers.StaticReader(asset_class=<class 'blot.assets.base.ContentAsset'>)

Simple reader which performs no content or metadata parsing.

MarkdownReader

A reader which parses source content as Markdown. If the content source contains a “fenced block” of key-value properties, these will be parsed as the metadata for the asset:

---
title: Awesome Post!
---

Reasons to read this post:
  - it is awesome!
  - because!
class blot.readers.MarkdownReader(asset_class=<class 'blot.assets.base.ContentAsset'>, extras=['metadata', 'fenced-code-blocks'])

Reader which parses a content source as Markdown.

Metadata should be specified by a “fenced” yaml block at the top of the file. Metadata keys will be lower-cased. Duplicate keys will override ones earlier in the file.