Commit 4aabe4ad authored by Virgile Gerecke's avatar Virgile Gerecke 🤘
Browse files

Merge branch 'release/2.0.2'

parents c41b2155 3333f45a
Pipeline #14795 passed with stage
in 35 seconds
<p><b>Date de début : </b>{{ item['start'] }}</p>
<p><b>Date de fin : </b>{{ item['end'] }}</p>
{% if 'duration' in item and item['duration'] != 0 %}
<p><b>Durée : </b>{{ item['duration'] }} minutes</p>
{% endif %}
{{ item['content'] }}
\ No newline at end of file
anytree==2.4.3
feedgen==0.7.0
python-slugify==1.2.6
Jinja2==2.10
\ No newline at end of file
from feedgen.feed import FeedGenerator
from slugify import slugify
from json import load
import dateutil.parser
from feedgen.feed import FeedGenerator
from slugify import slugify
from jinja2 import Template
data = load(open('weather.json', 'r'))
data = load(open('weather.json','r'))
def df(date):
dt = dateutil.parser.parse(date)
return dt.strftime("%d/%m/%Y à %Hh%M")
dt = dateutil.parser.parse(date)
return dt.strftime("%d/%m/%Y à %Hh%M")
fg = FeedGenerator()
fg.id('https://support.unistra.fr/')
......@@ -15,21 +19,29 @@ fg.title('Maintenance des services numériques')
fg.subtitle('Annonces de la Direction du Numérique')
fg.link(href='https://support.unistra.fr/#go-weather')
fg.language('fr')
fg.link(href='https://support.unistra.fr/atom.php', rel='self')
fg.author(name='Direction du Numérique', email='support@unistra.fr')
fg.logo('http://www.unistra.fr/fileadmin/templates/unistra/images/uds_ico.ico')
fg.logo('https://langagevisuel.unistra.fr/fileadmin/Contenu/4.2.Favicon/favicon2.png')
slugs = []
template = Template(open('item.html', 'r').read())
for item in data:
fe = fg.add_entry()
title=item['title']
fe.title(title)
fe.id(slugify(title))
content = "<p><b>Date de début : </b>{}</p><p><b>Date de fin : </b>{}</p>{}".format(df(item['start']), df(item['end']), item['content'])
fe.description(content)
fe.pubDate(item['start'])
rssfeed = fg.rss_str(pretty=True)
fe = fg.add_entry()
title = item['title']
slug = slugify(title)
while slug in slugs:
slug = slug + "-"
slugs.append(slug)
fe.title(title)
fe.id(slugify(title))
fe.description(template.render(item=item))
fe.pubDate(item['start'])
fg.link(href='https://support.unistra.fr/rss.php', rel='self')
rssfeed = fg.rss_str(pretty=True)
fg.rss_file('rss.xml')
fg.link(href='https://support.unistra.fr/atom.php', rel='self')
atomfeed = fg.atom_str(pretty=True)
fg.atom_file('atom.xml')
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