Capitula list done with jinja. Deleted coniugationes (I'll do it after LLPSI).

This commit is contained in:
sergiusz 2020-12-07 00:02:45 +01:00
parent fbce34008b
commit c3598b099f
7 changed files with 44 additions and 153 deletions

View File

@ -1,23 +1 @@
from app import app
# from flask import render_template
# from flask_sqlalchemy import SQLAlchemy
# from sqlalchemy import func
# from flask_wtf import FlaskForm
# from wtforms import Form, RadioField, SubmitField, HiddenField
# db = SQLAlchemy(app)
# class Word(db.Model):
# id = db.Column(db.Integer, primary_key=True)
# dictionarium = db.Column(db.String, unique=True, nullable=False)
# coniugatio = db.Column(db.Integer, unique=False, nullable=False)
# def __repr__(self):
# return '%r; %d conjugation' % (self.dictionarium, self.coniugatio)
# class ConjugatioAnswer(FlaskForm):
# radio = RadioField('', choices=[(1, 'Prima'), (2, 'Secunda'), (3, 'Tertia'), (4, 'Quarta')])
# word = HiddenField()
# submit = SubmitField('Check')
# next_word = SubmitField('Next word')

View File

@ -1,39 +1,33 @@
from app import app
from flask import render_template
from flask import render_template, jsonify
import os
capitula = [
{'title': '01 Imperium Romanum'},
{'title': '02 Familia Romana'},
{'title': '03 Puer Improbus'},
{'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(' ', '_')
print(capitula)
@app.route('/')
@app.route('/index')
def index():
return "Hello, World!"
@app.route('/latin')
def latin():
return render_template('latin.html')
@app.route('/latin/llpsi')
@app.route('/llpsi')
def llpsi():
return render_template('LLPSI/LLPSI.html')
return render_template('index.html', capitula=capitula)
@app.route('/latin/llpsi/<path:pensum_id>')
@app.route('/llpsi/<path:pensum_id>')
def pensum(pensum_id):
filename = 'templates/Pensa/' + pensum_id + '.html'
with open(filename, 'r') as file:
return render_template('LLPSI/Pensum_cloze.html', pensum_title=pensum_id.replace('_', ' '), pensum_content=file.read())
@app.route('/latin/coniugationes')
def coniugationes():
return render_template('coniugationes.html')
@app.route('/latin/coniugationes/quod', methods=["GET", "POST"])
def coniugationes_test():
form = ConjugatioAnswer()
if form.validate_on_submit():
word = Word.query.filter_by(dictionarium=form.word.data).first()
if not form.next_word.data:
if int(form.radio.data) == word.coniugatio:
return render_template('coniugationes.html', dictionarium = word.dictionarium, form = form, success = True)
return render_template('coniugationes.html', dictionarium = word.dictionarium, form = form, fail = True)
word = Word.query.order_by(func.random()).first()
form.word.data = word.dictionarium
return render_template('coniugationes.html', dictionarium = word.dictionarium, form = form)
return render_template('Pensum_cloze.html', pensum_title=pensum_id.replace('_', ' '), pensum_content=file.read())

View File

@ -1,49 +0,0 @@
<!DOCTYPE html>
<html lang="la">
<head>
<meta charset="UTF-8">
<title>Lingua Latina Per Se Illustrata</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>Lingua Latina Per Se Illustrata</h1>
<ul>
<li>Imperium Romanum
<ul>
<li><a href="/latin/llpsi/01_Imperium_Romanum_Pensum_A">Pensum A</a></li>
<li><a href="/latin/llpsi/01_Imperium_Romanum_Pensum_B">Pensum B</a></li>
</ul>
</li>
<li>Familia Romana
<ul>
<li><a href="/latin/llpsi/02_Familia_Romana_Pensum_A">Pensum A</a></li>
<li><a href="/latin/llpsi/02_Familia_Romana_Pensum_B">Pensum B</a></li>
</ul>
</li>
<li>Puer Improbus
<ul>
<li><a href="/latin/llpsi/03_Puer_Improbus_Pensum_A">Pensum A</a></li>
<li><a href="/latin/llpsi/03_Puer_Improbus_Pensum_B">Pensum B</a></li>
</ul>
</li>
<li>Dominus et servi
<ul>
<li><a href="/latin/llpsi/04_Dominus_et_Servi_Pensum_A">Pensum A</a></li>
<li><a href="/latin/llpsi/04_Dominus_et_Servi_Pensum_B">Pensum B</a></li>
</ul>
</li>
<li>Villa et Hortus
<ul>
<li><a href="/latin/llpsi/05_Villa_et_Hortus_Pensum_A">Pensum A</a></li>
<li><a href="/latin/llpsi/05_Villa_et_Hortus_Pensum_B">Pensum B</a></li>
</ul>
</li>
<li>Via Latina
<ul>
<li><a href="/latin/llpsi/06_Via_Latina_Pensum_A">Pensum A</a></li>
<li><a href="/latin/llpsi/06_Via_Latina_Pensum_B">Pensum B</a></li>
</ul>
</li>
</ul>
</body>
</html>

View File

@ -61,7 +61,6 @@
Array.from(form.elements).forEach((input) => {
if (input.type=="text" && document.getElementById('vowel_length').checked == false) {
is_macron_ok = (input.value == input_to_nomacron(input.dataset.expected));
console.log(input_to_nomacron(input.dataset.expected));
is_double_ok = false;
} else {
is_double_ok = (input_to_macron(input.value) == input.dataset.expected);

View File

@ -1,41 +0,0 @@
<!DOCTYPE html>
<html lang="la">
<head>
<meta charset="UTF-8">
<title>Lingua Latina Quattuor coniugationes verborum</title>
</head>
<body>
<h2>Quod coniugatio?</h2>
<form method="POST">
<p>{{dictionarium}}</p>
<!-- <input type="radio" id="con1" name="asnwer" value="1">
<label for="con1">Prima</label>
<input type="radio" id="con2" name="asnwer" value="2">
<label for="con2">Secunda</label>
<input type="radio" id="con3" name="asnwer" value="3">
<label for="con3">Tertia</label>
<input type="radio" id="con4" name="asnwer" value="4">
<label for="con4">Quarta</label> -->
<!-- <input type="submit"> -->
{{form.word}}
{{form.csrf_token}}
{% for subfield in form.radio %}
<tr>
<td>{{ subfield }}</td>
<td>{{ subfield.label }}</td>
</tr>
{% endfor %}
{{form.submit}}
{%if success %}
<br>Correct!<br>
{{form.next_word}}
{%endif%}
{% if fail %}
<br>Wrong!<br>
{% endif %}
<!-- <label for="ego">Ego</label><br>
<input type="text" id="ego" name="ego"><br>
--></body>
</html>

21
app/templates/index.html Normal file
View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="la">
<head>
<meta charset="UTF-8">
<title>Lingua Latina Per Se Illustrata</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>Lingua Latina Per Se Illustrata</h1>
<ul>
{% for capitulum in capitula %}
<li>{{capitulum.title}}
<ul>
<li><a href="/llpsi/{{capitulum.filename}}_Pensum_A">Pensum A</a></li>
<li><a href="/llpsi/{{capitulum.filename}}_Pensum_B">Pensum B</a></li>
</ul>
</li>
{% endfor %}
</ul>
</body>
</html>

View File

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html lang="la">
<head>
<meta charset="UTF-8">
<title>Lingua Latina</title>
</head>
<body>
<a href="/latin/llpsi">Lingua Latina Per Se Illustrata</a><br>
<a href="/latin/coniugationes">Coniugationes</a>
</body>
</html>