Skip to main content

pelican-metadataparsing

A plugin for Pelican that allows the easy definition of custom metadata parsers.

Install

To install the library, you can use pip

$ pip install pelican-metadataparsing

Usage

  1. Update pelicanconf.py:

    1. Add metadataparsing to PLUGINS.

      You should add it before any metadata-affecting plugins.

      PLUGINS = [..., 'metadataparsing', ...]
    2. Define your custom metadata parsers through the METADATA_PARSERS setting:

      METADATA_PARSERS = {
          "<metadata-field-name1>": <function parser1(x)>,
          "<metadata-field-name2>": <function parser2(x)>
      }
  2. Corresponding fields of the page, article or entity object will have the value returned from the respective parser function.

Example

Multi-line metadata to simple string

import collections
import six

def parse_description(string):
    if string is None or isinstance(string, six.string_types):
        return string

    if isinstance(string, collections.Iterable):
        string = " ".join(string)

    return string


METADATA_PARSERS = {
    "Description": parse_description
}

For a working example check my site and my site’s source code.

Metadata

Release files for pelican-metadataparsing 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pelican-metadataparsing 0.1.0
File Size Uploaded Provenance Actions
pelican-metadataparsing-0.1.0.tar.gz 7.0 kB Without provenance Details for pelican-metadataparsing-0.1.0.tar.gz

Release files / pelican-metadataparsing-0.1.0.tar.gz

Download URL pelican-metadataparsing-0.1.0.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0a36518c612570882f376ca184c3436ef024b35ea93d56556efbab1277df72ef
BLAKE2b-256 checksum
How to use checksums
4bdb4abf2b78842861d3035b4de94919cd6ac39f7e84a8b5084af251c7934e6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pelican-metadataparsing 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page