Commit 04d30f7f authored by gijs's avatar gijs
Browse files

Reference to event notes where of

parent 9dd8955f
......@@ -389,6 +389,9 @@ class Model(object):
def __getattr__ (self, name):
if name in self.metadata:
return self.metadata[name]
elif name.lower() != name:
name = re.sub('[A-Z]', lambda m: '-{}'.format(m.group(0).lower()), name)
return self.__getattr__(name)
else:
# super().__getattr__(name)
# debug('Attribute error', name, self.metadata)
......@@ -648,8 +651,9 @@ class Video (Model):
'video': fields.Single(fields.StringField()),
'type': fields.Single(fields.StringField()),
'title': fields.Single(fields.InlineMarkdownField()),
'caption': fields.Single(fields.InlineMarkdownField()),
'tags': multiLinkMultiReverse('tag', 'video'),
'produser': multiLinkMultiReverse('produser', 'video')
'produser': multiLinkMultiReverse('produser', 'video'),
}
class Audio (Model):
......@@ -661,8 +665,9 @@ class Audio (Model):
'audio': fields.Single(fields.StringField()),
'type': fields.Single(fields.StringField()),
'title': fields.Single(fields.InlineMarkdownField()),
'caption': fields.Single(fields.InlineMarkdownField()),
'tags': multiLinkMultiReverse('tag', 'audio'),
'produser': multiLinkMultiReverse('produser', 'audio')
'produser': multiLinkMultiReverse('produser', 'audio'),
}
class Image (Model):
......@@ -674,7 +679,8 @@ class Image (Model):
'image': fields.Single(fields.StringField()),
'tags': multiLinkMultiReverse('tag', 'image'),
'produser': multiLinkMultiReverse('produser', 'image'),
'caption': fields.Single(fields.StringField()),
'title': fields.Single(fields.InlineMarkdownField()),
'caption': fields.Single(fields.InlineMarkdownField()),
}
class ExternalProject (Model):
......
......@@ -118,11 +118,12 @@ def parse_pads ():
for m in models:
# resolve links
# collect inline links
content, _ = resolveReferences(m.content, model=m) # Second return are the collected references
# render markdown
m.resolveLinks()
md = markdown.Markdown(extensions=['extra', TocExtension(baselevel=2), 'attr_list'])
m.content = mark_safe(md.convert(content))
if m.content:
content, _ = resolveReferences(m.content, model=m) # Second return are the collected references
# render markdown
m.resolveLinks()
md = markdown.Markdown(extensions=['extra', TocExtension(baselevel=2), 'attr_list'])
m.content = mark_safe(md.convert(content))
return models
class Command(BaseCommand):
......
{% extends "generator_base.html" %}
{% block title %}
Caveat → {{ note.title|striptags }}
{% endblock %}
{% block title %}Caveat → {{ note.title|striptags }}{% endblock %}
{% block content %}
<nav class="breadcrumbs">
<ul>
</ul>
</nav>
<section class="item-reference">
{% if note.programmeItem %}
<a href="{{ note.programmeItem.link }}">
<h2>{{ note.programmeItem.date }} {{ note.programmeItem.time }} {{ note.programmeItem }}</h2>
</a>
{{ note.programmeItem.summary }}
{% elif note.event %}
<a href="{{ note.event.link }}">
<h2>{{ note.event.date }} {{ note.event.time }} {{ note.event }}</h2>
</a>
{{ note.event.summary }}
{% endif %}
</section>
<h1>{{ note.title }}</h1>
{{ note.content }}
{{ note.content }}
{% endblock %}
{% block footerresources %}
<script src="{{ SITE_URL }}static/js/timejumper.js"></script>
......
......@@ -300,7 +300,7 @@ footer {
background: var(--rose-karel);
}
.breadcrumbs {
.breadcrumbs, .item-reference {
border-bottom: 2px solid black;
margin: -1em -1em 0 -1em;
position: sticky;
......@@ -309,6 +309,10 @@ footer {
z-index: 1;
}
.item-reference {
padding: .5em 1em;
}
.breadcrumbs ul {
list-style-type: none;
margin: 0;
......
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