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)