1
0
Fork 0

feat: Added SVG as output format and made it default in dashboard

This commit is contained in:
Benedikt Bastin 2021-03-23 12:14:50 +01:00
parent 6ee0666039
commit 093ee5f073
2 changed files with 10 additions and 9 deletions

View File

@ -175,16 +175,16 @@
<h1>Plots</h1>
{% for fig in figures %}
<figure>
<a href="{{ fig['filename'] }}.png">
<img
src="{{ fig['filename'] }}.png"
alt="{{ fig['caption'] }}" />
</a>
<picture>
<source srcset="{{ fig['filename']}}.svg" alt="{{ fig['caption']}}" />
<img src="{{ fig['filename'] }}.png" alt="{{ fig['caption'] }}" />
</picture>
<figcaption>
<a name="figure-{{ '{:03d}'.format(fig['index']) }}"><span class="ref">Abbildung {{ fig['index'] }}:</span></a>
{{ fig['caption'] }}<br />
<a href="{{ fig['filename'] }}.png" download="{{ fig['filename'] }}.png">Download als PNG</a>
<a href="{{ fig['filename'] }}.pdf" download="{{ fig['filename'] }}.pdf">Download als PDF</a>
<a href="{{ fig['filename'] }}.svg" download="{{ fig['filename'] }}.pdf">Download als SVG</a>
</figcaption>
</figure>
{% endfor %}

View File

@ -37,7 +37,8 @@ print_today = today.isoformat()
filename_now = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
force_renew = True
force_renew_plots = False
force_renew_dashboard = True
# https://www.tagesschau.de/ausland/europa/ursula-von-der-leyen-zu-corona-impfstoffen-101.html
target_date_for_herd_immunity = datetime.date(2021, 9, 22)
@ -289,7 +290,7 @@ def check_recreate_plot(plot_name):
archive_plot_filename = '{}/{}'.format(archive_folder, plot_name)
if os.path.isfile(archive_plot_filename + '.pdf') and not force_renew:
if os.path.isfile(archive_plot_filename + '.pdf') and not force_renew_plots:
print('Plot {} already exists'.format(plot_name))
return False
@ -298,7 +299,7 @@ def check_recreate_plot(plot_name):
def save_plot(plot_name):
folders = [archive_folder, site_folder]
file_formats = ['pdf', 'png']
file_formats = ['pdf', 'png', 'svg']
file_template = '{folder}/{plot_name}.{format}'
for folder in folders:
@ -747,7 +748,7 @@ def render_dashboard():
stylesheet_filename = 'site/rki-dashboard.css'
stylesheet_archive_filename = 'site/archive/{}/rki-dashboard.css'.format(filename_stand)
if os.path.isfile(dashboard_archive_filename) and not force_renew:
if os.path.isfile(dashboard_archive_filename) and not force_renew_dashboard:
print('Dashboard {} already exists'.format(dashboard_archive_filename))
return