summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAgathe Porte <microjoe@microjoe.org>2017-09-02 22:33:10 +0200
committerAgathe Porte <microjoe@microjoe.org>2017-09-02 22:33:10 +0200
commit97c376dc7beb304efc72b9fa3249aca503300a14 (patch)
treedbe6627e3aec82f8b53e80a599def3c2abb026e0
parent41fbcd99201301836bbaa7b4d1e639dbf737946d (diff)
downloadpelican-gen-date-97c376dc7beb304efc72b9fa3249aca503300a14.tar.gz
pelican-gen-date-97c376dc7beb304efc72b9fa3249aca503300a14.zip
Way simpler plugin
-rw-r--r--__init__.py22
1 files changed, 1 insertions, 21 deletions
diff --git a/__init__.py b/__init__.py
index 2d6e837..5272f27 100644
--- a/__init__.py
+++ b/__init__.py
@@ -3,31 +3,11 @@ import datetime
from pelican import signals
-class GenDate:
- def __init__(self, gen):
- self.settings = gen.settings
- self.process()
-
- def process(self):
- """Initialization process."""
- pass
-
- def defer_process(self):
- """Check and return git describe value."""
- return datetime.datetime.now()
-
-
-def initialize(gen):
- """Function called upon article generator initialization."""
- gen.plugin_instance = GenDate(gen)
-
-
def fetch(gen, metadata):
"""Function called upon article generation context fetching."""
- gen.context['gen_date'] = gen.plugin_instance.defer_process()
+ gen.context['gen_date'] = datetime.date.today().isoformat()
def register():
"""Register Pelican signals to dedicated functions."""
- signals.article_generator_init.connect(initialize)
signals.article_generator_context.connect(fetch)