Skip to content
Snippets Groups Projects
Verified Commit 3cd27f93 authored by David Beniamine's avatar David Beniamine
Browse files

Reorganize url + bootstrap

parent cf4702aa
No related branches found
No related tags found
No related merge requests found
...@@ -6,16 +6,20 @@ app = Flask(__name__) ...@@ -6,16 +6,20 @@ app = Flask(__name__)
@app.route('/') @app.route('/')
def main(): def main():
return render_template('main.html') return render_template('home.html')
@app.route('/', methods=['POST']) @app.route('/unl2rdf', methods=['GET', 'POST'])
def handle(): def unl2rdf():
if request.method == 'POST':
unl = request.form['unl'] unl = request.form['unl']
rdf = unlToRdf(unl) rdf = convertUnl2Rdf(unl)
return render_template('output.html', unl=unl, rdf=rdf) else:
unl = None
rdf = None
return render_template('unl2rdf.html', unl=unl, rdf=rdf)
def unlToRdf(unl): def convertUnl2Rdf(unl):
# TODO handle text here, do not call bash command or sanitize input first # TODO handle text here, do not call bash command or sanitize input first
return "Please implement me so I can convert '{}' to RDF".format(unl) return "Please implement me so I can convert '{}' to RDF".format(unl)
This diff is collapsed.
<!DOCTYPE html>
<html lang="en">
<head>
{% block head %}
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
<title>{% block title %}{% endblock %}</title>
{% endblock %}
</head>
<body>
<div id="content">{% block content %}{% endblock %}</div>
<div id="footer">
{% block footer %}
&copy; Copyright 2020 by <a href="https://tetras-libre.fr">Tetras Libre</a>.
{% endblock %}
</div>
</body>
</html>
{% extends "base.html" %}
{% block title %}UNL demo{% endblock %}
{% block content %}
<h1>Demo tools for UNL</h1>
<ul>
<li><a href='/unl2rdf'>Unl2Rdf</a></li>
</ul>
{% endblock %}
<!DOCTYPE html>
<html lang="en">
<head>
<title>UNL 2 RDF demo</title>
</head>
<body>
<h1>Enter some UNL here I will convert it to RDF for you</h1>
<form action="/" method="POST">
<textarea name="unl" cols="80" rows="10" style="width: 300px; height: 150px;"></textarea>
<input type="submit">
</form>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>UNL 2 RDF demo</title>
</head>
<body>
<h1>UNL 2 RDF demo</h1>
<h2> UNL </h2>
<pre>
<code>
{{ unl }}
</code>
</pre>
<h2> RDF </h2>
<pre>
<code>
{{ rdf }}
</code>
</pre>
</body>
</html>
{% extends "base.html" %}
{% block title %}UNL 2 RDF demo{% endblock %}
{% block content %}
{% if not unl %}
<h1>Enter some UNL here I will convert it to RDF for you</h1>
<div class="form-group">
<form action="{{request.path}}" method="POST">
<textarea class="form-control" name="unl" cols="80" rows="10" style="width: 300px; height: 150px;"></textarea>
<button class="btn btn-primary" type="submit">Submit</button>
</form>
</div>
{% else %}
<h2> UNL </h2>
<pre>
<code>
{{ unl }}
</code>
</pre>
<h2> RDF </h2>
<pre>
<code>
{{ rdf }}
</code>
</pre>
{% endif %}
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment