50 lines
1.7 KiB
Python
50 lines
1.7 KiB
Python
from app import app
|
|
from flask import render_template, jsonify
|
|
import os
|
|
|
|
capitula = [
|
|
{'title': '01 Imperium Romanum',
|
|
'pensa': ['A', 'B'],
|
|
'exercitia': [1, 2, 4, 5, 6, 8, 10, 11]},
|
|
{'title': '02 Familia Romana',
|
|
'pensa': ['A', 'B'],
|
|
'exercitia': [1, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13]},
|
|
{'title': '03 Puer Improbus',
|
|
'pensa': ['A', 'B'],
|
|
'exercitia': [1, 2, 3, 4]},
|
|
{'title': '04 Dominus et Servi'},
|
|
{'title': '05 Villa et Hortus'},
|
|
{'title': '06 Via Latina'},
|
|
{'title': '07 Puella et Rosa'},
|
|
{'title': '08 Taberna Romana'},
|
|
{'title': '09 Pastor et Oves'},
|
|
{'title': '10 Bestiae et Homines'}
|
|
]
|
|
|
|
for capitulum in capitula:
|
|
capitulum['filename'] = capitulum['title'].replace(' ', '_')
|
|
|
|
@app.route('/')
|
|
@app.route('/index')
|
|
@app.route('/llpsi')
|
|
def llpsi():
|
|
return render_template('index.html', capitula=capitula)
|
|
|
|
@app.route('/llpsi/<path:capitulum_id>')
|
|
def capitulum(capitulum_id):
|
|
filename = app.root_path + '/templates/Capitula/' + capitulum_id + '.html'
|
|
with open(filename, 'r') as file:
|
|
return render_template('Capitulum.html', capitulum_title=capitulum_id.replace('_', ' '), capitulum_content=file.read())
|
|
|
|
@app.route('/llpsi/pensum/<path:pensum_id>')
|
|
def pensum(pensum_id):
|
|
filename = app.root_path + '/templates/Pensa/' + pensum_id + '.html'
|
|
with open(filename, 'r') as file:
|
|
return render_template('Pensum_cloze.html', pensum_title=pensum_id.replace('_', ' '), pensum_content=file.read())
|
|
|
|
@app.route('/llpsi/exercitium/<path:exercitium_id>')
|
|
def exercitium(exercitium_id):
|
|
filename = app.root_path + '/templates/Exercitia/' + exercitium_id + '.html'
|
|
with open(filename, 'r') as file:
|
|
return render_template('Exercitium_cloze.html', exercitium_title=exercitium_id.replace('_', ' '), exercitium_content=file.read())
|