2011-06-18 01:03:53 +02:00
|
|
|
from pelican import signals
|
2011-04-26 20:02:05 +02:00
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
License plugin for Pelican
|
|
|
|
|
==========================
|
|
|
|
|
|
|
|
|
|
Simply add license variable in article's context, which contain
|
|
|
|
|
the license text.
|
|
|
|
|
|
|
|
|
|
Settings:
|
|
|
|
|
---------
|
|
|
|
|
|
|
|
|
|
Add LICENSE to your settings file to define default license.
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
2011-06-17 23:37:08 +02:00
|
|
|
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():
|
2011-06-17 23:37:08 +02:00
|
|
|
metadata['license'] = generator.settings['LICENSE']
|
2011-04-26 20:02:05 +02:00
|
|
|
|
2011-06-18 01:03:53 +02:00
|
|
|
def register():
|
|
|
|
|
signals.article_generate_context.connect(add_license)
|