feat: Added SVG as output format and made it default in dashboard
This commit is contained in:
parent
6ee0666039
commit
093ee5f073
2 changed files with 10 additions and 9 deletions
|
@ -175,16 +175,16 @@
|
||||||
<h1>Plots</h1>
|
<h1>Plots</h1>
|
||||||
{% for fig in figures %}
|
{% for fig in figures %}
|
||||||
<figure>
|
<figure>
|
||||||
<a href="{{ fig['filename'] }}.png">
|
<picture>
|
||||||
<img
|
<source srcset="{{ fig['filename']}}.svg" alt="{{ fig['caption']}}" />
|
||||||
src="{{ fig['filename'] }}.png"
|
<img src="{{ fig['filename'] }}.png" alt="{{ fig['caption'] }}" />
|
||||||
alt="{{ fig['caption'] }}" />
|
</picture>
|
||||||
</a>
|
|
||||||
<figcaption>
|
<figcaption>
|
||||||
<a name="figure-{{ '{:03d}'.format(fig['index']) }}"><span class="ref">Abbildung {{ fig['index'] }}:</span></a>
|
<a name="figure-{{ '{:03d}'.format(fig['index']) }}"><span class="ref">Abbildung {{ fig['index'] }}:</span></a>
|
||||||
{{ fig['caption'] }}<br />
|
{{ fig['caption'] }}<br />
|
||||||
<a href="{{ fig['filename'] }}.png" download="{{ fig['filename'] }}.png">Download als PNG</a>
|
<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'] }}.pdf" download="{{ fig['filename'] }}.pdf">Download als PDF</a>
|
||||||
|
<a href="{{ fig['filename'] }}.svg" download="{{ fig['filename'] }}.pdf">Download als SVG</a>
|
||||||
</figcaption>
|
</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
9
plot.py
9
plot.py
|
@ -37,7 +37,8 @@ print_today = today.isoformat()
|
||||||
|
|
||||||
filename_now = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
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
|
# 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)
|
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)
|
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))
|
print('Plot {} already exists'.format(plot_name))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -298,7 +299,7 @@ def check_recreate_plot(plot_name):
|
||||||
def save_plot(plot_name):
|
def save_plot(plot_name):
|
||||||
|
|
||||||
folders = [archive_folder, site_folder]
|
folders = [archive_folder, site_folder]
|
||||||
file_formats = ['pdf', 'png']
|
file_formats = ['pdf', 'png', 'svg']
|
||||||
file_template = '{folder}/{plot_name}.{format}'
|
file_template = '{folder}/{plot_name}.{format}'
|
||||||
|
|
||||||
for folder in folders:
|
for folder in folders:
|
||||||
|
@ -747,7 +748,7 @@ def render_dashboard():
|
||||||
stylesheet_filename = 'site/rki-dashboard.css'
|
stylesheet_filename = 'site/rki-dashboard.css'
|
||||||
stylesheet_archive_filename = 'site/archive/{}/rki-dashboard.css'.format(filename_stand)
|
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))
|
print('Dashboard {} already exists'.format(dashboard_archive_filename))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue