1
0
Fork 0
forked from github/pelican
pelican-theme/pelican/plugins/global_license.py

24 lines
664 B
Python
Raw Normal View History

2011-06-18 01:03:53 +02:00
from pelican import signals
"""
License plugin for Pelican
==========================
This plugin allows you to define a LICENSE setting and adds the contents of that
license variable to the article's context, making that variable available to use
from within your theme's templates.
Settings:
---------
Define LICENSE in your settings file with the contents of your default license.
"""
def add_license(generator, metadata):
if 'license' not in metadata.keys()\
2011-04-26 20:04:44 +02:00
and 'LICENSE' in generator.settings.keys():
metadata['license'] = generator.settings['LICENSE']
2011-06-18 01:03:53 +02:00
def register():
signals.article_generate_context.connect(add_license)