Hide linuxinstructions when missing

Fixes #3
This commit is contained in:
odecif 2022-10-28 15:37:21 +02:00
parent 16cc5a44eb
commit dee805633e
2 changed files with 12 additions and 5 deletions

View File

@ -27,7 +27,12 @@ def game(lang_code):
# game['game']['plot'] = game['game']['plot'].replace("\\n", "<br />")
game['game']['plot'] = game['game']['plot'].split('\\n')
game['game']['linuxinstructions'] = game['game']['linuxinstructions'].split('\\n')
if 'linuxinstructions' in game['game']:
if game['game']['linuxinstructions'] != "":
game['game']['linuxinstructions'] = (
game['game']['linuxinstructions'].split('\\n'))
else:
game['game'].pop('linuxinstructions')
return render_template('game.html', game=game,
**languages[lang_code], lang_code=lang_code)

View File

@ -75,10 +75,12 @@
<p>{{game.game.cdkey}}</p>
{% endif %}
{% if 'linuxinstructions' in game.game %}
<h3>{{lang_game_linuxinstructions}}</h3>
{% for part in game.game.linuxinstructions %}
<p>{{part}}</p>
{% endfor %}
{% endif%}
{% endblock %}
</body>
</html>