Skip to main content

Support Wikilinks when generating Pelican sites

Project description

Summary is a plugin for Pelican, a static site generator written in Python.

Summary allows easy, variable length summaries directly embedded into the body of your articles.

PyPI version number Changelog Supported Python version License Download Count

Installation

The easiest way to install Summary is through the use of pip. This will also install the required dependencies automatically.

pip install minchin.pelican.plugins.summary

If you are using Pelican 4.5, it should automatically be activated (through my AutoLoader plugin).

If you are using an earlier version of Pelican or autoloading isn’t working, then in your pelicanconf.py file, add Summary to your list of plugins:

PLUGINS = [
    # others...
    'minchin.pelican.plugins.summary',
    # ...
]

You may also need to configure the summary start and end markers (see Configuration below).

Requirements

Summary depends on (and is really only useful with) Pelican; it also depends on semantic-version and minchin.pelican.plugins.autoloader. These can be manually installed with pip (but are automatically installed if the plugin is installed with pip):

pip install pelican semantic-version minchin.pelican.plugins.autoloader

Configuration and Usage

This plugin introduces two new settings: SUMMARY_BEGIN_MARKER and SUMMARY_END_MARKER: strings which can be placed directly into an article to mark the beginning and end of a summary. When found, the standard SUMMARY_MAX_LENGTH setting will be ignored. The markers themselves will also be removed from your articles before they are published. The default values are <!-- PELICAN_BEGIN_SUMMARY --> and <!-- PELICAN_END_SUMMARY -->.

For example:

Title: My super title
Date: 2010-12-03 10:20
Tags: thats, awesome
Category: yeah
Slug: my-super-post
Author: Alexis Metaireau

This is the content of my super blog post.
<!-- PELICAN_END_SUMMARY -->
and this content occurs after the summary.

Here, the summary is taken to be the first line of the post. Because no beginning marker was found, it starts at the top of the body. It is possible to leave out the end marker instead, in which case the summary will start at the beginning marker and continue to the end of the body.

If no beginning or end marker is found, and if SUMMARY_USE_FIRST_PARAGRAPH is enabled in the settings, the summary will be the first paragraph of the post.

The plugin also sets a has_summary attribute on every article. It is True for articles with an explicitly-defined summary, and False otherwise. (It is also False for an article truncated by SUMMARY_MAX_LENGTH.) Your templates can use this e.g. to add a link to the full text at the end of the summary.

ReST example

Inserting the markers into a reStructuredText document makes use of the comment directive, because raw HTML is automatically escaped. The reST equivalent of the above Markdown example looks like this:

My super title
##############

:date: 2010-12-03 10:20
:tags: thats, awesome
:category: yeah
:slug: my-super-post
:author: Alexis Metaireau

This is the content of my super blog post.

.. PELICAN_END_SUMMARY

and this content occurs after the summary.

Pelican 3 Support

The plugin also includes support for Pelican 3, however general support for Pelican 3 is somewhat limited. In particular, Python 3.9 or earlier is needed, and the most recent version dependencies include pelican==3.7.1, jinja2==2.11.3, and markupsafe==1.1.1.

For extra clarity, the plugins to designed to support Pelican 4 as well.

Test Suite

There is an included test suite, available at minchin\pelican\plugins\summary\test_summary.py. The plugin itself doesn’t need to be installed for the suite to run, but the plugin dependencies do need to be installed.

Credits

Original plugin from the Pelican-Plugins repo.

License

The plugin code is assumed to be under the AGPLv3 license (this is the license of the Pelican-Plugins repo).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

minchin_pelican_plugins_summary-1.3.1.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file minchin_pelican_plugins_summary-1.3.1.tar.gz.

File metadata

File hashes

Hashes for minchin_pelican_plugins_summary-1.3.1.tar.gz
Algorithm Hash digest
SHA256 7a400ff4e4d77b7a9a2880f896cc1524eec34fcbd80c5e8efb459f3bd0809536
MD5 a25b993278478fe215ce7d58de51980d
BLAKE2b-256 9c941bf9ae5b369157d81d3dc94566b9e14b1a6ae1fb5abd4447f916c77a8a3a

See more details on using hashes here.

File details

Details for the file minchin_pelican_plugins_summary-1.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for minchin_pelican_plugins_summary-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3f7db7aa137a339ebf49c491f9692604a78bc9c3c7b541b833a103b6c41ad039
MD5 75d893b52d9e9bdd6e9d5ed2c8d0d478
BLAKE2b-256 7dd990549d1758f27ba2e19aaca23f238b4d190ce7d1e757b746676ad47edb02

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page