diff --git a/app/agora.py b/app/agora.py index 628a51c..402d708 100644 --- a/app/agora.py +++ b/app/agora.py @@ -13,8 +13,9 @@ # limitations under the License. import datetime -from flask import Blueprint, url_for, render_template, current_app, Response, redirect +from flask import Blueprint, url_for, render_template, current_app, Response, redirect, request from markupsafe import escape +from slugify import slugify, SLUG_OK from . import config from . import db from . import forms @@ -97,16 +98,22 @@ def pull(node): Here it "broadcasts": it renders all nodes that pull from a given node. Unclear at this point if this should exist at all, or whether it should do something else. + + TODO: probably remove this, [[pull]] changed. """ return redirect('/node/{}'.format(node)) - +@bp.route('/jump') +def jump(): + """Redirects to the right node.""" + jump = request.args.get('jump') + return redirect(url_for('.node', node=slugify(jump))) # Entities +@bp.route('/wikilink/') @bp.route('/node/') -@bp.route('/wikilink/') # alias for now -def wikilink(node): +def node(node): n = G.node(node) n.subnodes = util.uprank(n.subnodes, user='flancian') diff --git a/app/templates/base.html b/app/templates/base.html index 3e6bf76..446838c 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -43,12 +43,12 @@
diff --git a/requirements.txt b/requirements.txt index d9f1596..7c67f60 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,7 +23,10 @@ python-Levenshtein==0.12.0 pytz==2020.4 regex==2020.11.13 six==1.15.0 +text-unidecode==1.3 tzlocal==2.1 +unicode-slugify==0.1.3 +Unidecode==1.1.2 uWSGI==2.0.19.1 webencodings==0.5.1 Werkzeug==1.0.1