Commit 1f9a9526 authored by tr's avatar tr
Browse files

plugin events: function description

parent bf8527d2
......@@ -55,7 +55,6 @@ def parse_timedelta(delta):
:returns: timedelta
"""
chunks = delta.split()
tdargs = {}
for chunk in chunks:
......@@ -84,7 +83,8 @@ def parse_timedelta(delta):
def parse_file(file):
"""Parse the list of events. Normalize them to each include critical
iCal data."""
iCal data.
"""
with open(file) as event_file:
data = json.load(event_file)
......@@ -129,12 +129,13 @@ def parse_file(file):
def run(generator):
"""If not done before, the JSON gets parsed."""
"""If not done before, the JSON gets parsed.
"""
parse_file("content/events.json")
def generate_ical_file(generator):
"""Generate an iCalendar file
"""Generate an iCalendar file.
"""
ics_fname = generator.settings['PLUGIN_EVENTS']['ics_fname']
if not ics_fname:
......@@ -211,19 +212,22 @@ def generate_ical_file(generator):
def generate_events_list(generator):
"""Populate the event_list variable to be used in jinja templates"""
"""Populate the event_list variable to be used in jinja templates.
"""
# generator.context['events_list'] = sorted(event_groups, reverse=False)
generator.context['events_list'] = events['event groups']
def init_plugin(pelican_obj):
"""Init the plugin with values from the Pelican config"""
"""Init the plugin with values from the Pelican config.
"""
global _SITEURL
_SITEURL = posixpath.split(pelican_obj.settings['SITEURL'])[0]
def register():
"""Register the plugin with the Pelicaon generator."""
"""Register the plugin with the Pelicaon generator.
"""
signals.get_generators.connect(init_plugin)
signals.page_generator_init.connect(run)
signals.page_generator_init.connect(generate_events_list)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment