From 09567fa99ea0cb27ab4f1ca146c909cdacda814c Mon Sep 17 00:00:00 2001 From: Nicolas Duhamel Date: Tue, 26 Apr 2011 20:02:05 +0200 Subject: [PATCH] add global license capabability as a plugin --- plugins_samples/global_license.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 plugins_samples/global_license.py diff --git a/plugins_samples/global_license.py b/plugins_samples/global_license.py new file mode 100644 index 00000000..feae64e2 --- /dev/null +++ b/plugins_samples/global_license.py @@ -0,0 +1,23 @@ +from blinker import signal + +""" +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. + +""" + +def add_license(generator, metadatas): + if 'license' not in metadatas.keys()\ + and 'LICENSE' in self.settings.keys(): + metadatas['license'] = self.settings['LICENSE'] + + +signal('pelican_article_generate_context').connect(add_license)