tree: 06571aeb50ed3e73f942f87446283fe503a04395 [path history] [tgz]

Plugin Architecture

The plugins used operate at various points in a pelican build. Pelican uses signals at various points. These are documented here. At a high level consider the following sequence of events:

  1. Pelican Settings. Settings for a Pelican Build are in your Pelican Configuration
PLUGIN_PATHS = ['./theme/plugins']
PLUGINS = ['asfgenid', 'asfdata', 'pelican-gfm', 'asfreader', 'sitemap']
  1. Init (initialized). At this point any ASF_DATA is read into a metadata dictionary made available in every page.
  • The asfdata plugin reads an .asfdata.yaml file and creates the metadata dictionary.
ASF_DATA_YAML = ".asfdata.yaml"
    'data': ASF_DATA_YAML,
    'metadata': { },
    'debug': True
    'metadata': True,
    'elements': True,
    'headings': True,
    'permalinks': True,
    'toc': True,
    'toc_headers': r"h[1-6]",
    'debug': False
  1. Readers (readers_init). Two important readers are set at this point. Readers are responsible for transforming page files to html and providing a metadata dictionary
    • GFMReader by the pelican-gfm plugin. This code is in a private repository - ask Infra. Transforms GitHub Flavored Markdown(GFM) to HTML.
      • .md
      • .markdown
      • .mkd
      • .mdown
    • ASFReader by the asfreader plugin. Transforms an ezt template into GFM and then to HTML.
      • .ezmd
  2. Content Init (content_object_init). This is signaled after a Reader has processed content. At this point plugins can review, record, and transform the html content.
    • The asfgenid plugin performs a number of steps. Some of the steps are optional.
      • Metadata transformation by looking up {{ key_expression }} in the page metadata.
      • Inventory of existing id attributes.
      • Set id and class attributes specified by and {.class} syntax.
      • Assign id to all headings without ids.
      • Insert a Table of Contents if a [TOC] tag is present.