From 5d19f7e71b34d19becf093b4db331c6582863e73 Mon Sep 17 00:00:00 2001 From: boyska Date: Wed, 3 May 2017 02:23:56 +0200 Subject: [PATCH] single talk directive --- plugins/talks.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plugins/talks.py b/plugins/talks.py index e8719b4..1085b11 100644 --- a/plugins/talks.py +++ b/plugins/talks.py @@ -102,6 +102,25 @@ class TalkListDirective(Directive): ] +class TalkDirective(Directive): + required_arguments = 1 + optional_arguments = 0 + final_argument_whitespace = True + has_content = True + + def run(self): + tmpl = jinja_env.get_template('talk.html') + data = get_talk_data(self.arguments[0]) + if data is None: + return [] + return [ + nodes.raw('', tmpl.render(**data), + format='html') + ] + +# TODO: TalkGridDirective (griglia completa) + + class TalksGenerator(generators.Generator): def __init__(self, *args, **kwargs): self.talks = [] @@ -142,3 +161,4 @@ else: signals.get_generators.connect(get_generators) signals.initialized.connect(add_talks_option_defaults) directives.register_directive('talklist', TalkListDirective) + directives.register_directive('talk', TalkDirective)