Move index to be just another node.

This commit is contained in:
Flancian 2020-12-04 22:11:44 +01:00
parent 77f305387e
commit 7f07fd0e31
3 changed files with 17 additions and 6 deletions

View file

@ -18,13 +18,16 @@ from markupsafe import escape
from . import config from . import config
from . import db from . import db
from . import forms from . import forms
from . import util
bp = Blueprint('agora', __name__) bp = Blueprint('agora', __name__)
@bp.route('/index') @bp.route('/index')
@bp.route('/') @bp.route('/')
def index(): def index():
return render_template('index.html', version=config.AGORA_VERSION, help=url_for('agora.help'), nodes=url_for('agora.nodes'), subnodes=url_for('agora.subnodes'), users=url_for('agora.users'), journals=url_for('agora.journals'), search=url_for('agora.search'), latest=url_for('agora.latest')) node='index'
# return render_template('index.html', version=config.AGORA_VERSION, help_url=url_for('agora.help'), nodes_url=url_for('agora.nodes'), subnodes_url=url_for('agora.subnodes'), users_url=url_for('agora.users'), journals_url=url_for('agora.journals'), search_url=url_for('agora.search'), latest_url=url_for('agora.latest'), wikilink=node, subnodes=db.subnodes_by_wikilink(node), backlinks=db.subnodes_by_outlink(node))
return render_template('node_rendered.html', wikilink=node, subnodes=util.rank(db.subnodes_by_wikilink(node), user='agora'), backlinks=db.subnodes_by_outlink(node))
@bp.route('/help') @bp.route('/help')
def help(): def help():

View file

@ -14,6 +14,8 @@
limitations under the License. limitations under the License.
--> -->
<!-- DEPRECATED-->
{% extends "base.html" %} {% extends "base.html" %}
{% block content %} {% block content %}
<div class="subnode"> <div class="subnode">
@ -23,11 +25,11 @@ This is the <strong>Agora v{{version}}</strong>.<br />
<br /> <br />
This site is very much under construction, but feel free to look around: This site is very much under construction, but feel free to look around:
<ul> <ul>
<li><a href="{{nodes}}">{{nodes}}</a> lists all non-journal nodes in this Agora; a node is the set of all subnodes with a given title, or otherwise about the same entity. Subnodes can come from a variety of sources; currently these are mostly notes as volunteered by users.</li> <li><a href="{{nodes_url}}">{{nodes}}</a> lists all non-journal nodes in this Agora; a node is the set of all subnodes with a given title, or otherwise about the same entity. Subnodes can come from a variety of sources; currently these are mostly notes as volunteered by users.</li>
<li><a href="{{journals}}">{{journals}}</a> displays all journal entries (these are just nodes matching YYYY-MM-DD).</li> <li><a href="{{journals_url}}">{{journals}}</a> displays all journal entries (these are just nodes matching YYYY-MM-DD).</li>
<li><a href="{{users}}">{{users}}</a> displays all users in this Agora. Click through to see their subnodes.</li> <li><a href="{{users_url}}">{{users}}</a> displays all users in this Agora. Click through to see their subnodes.</li>
<li><a href="{{subnodes}}">{{latest}}</a> shows which subnodes were added or modified recently.</li> <li><a href="{{subnodes_url}}">{{latest}}</a> shows which subnodes were added or modified recently.</li>
<li><a href="{{search}}">{{search}}</a> offers full text search over all subnodes (supports regexes).</li> <li><a href="{{search_url}}">{{search}}</a> offers full text search over all subnodes (supports regexes).</li>
</ul> </ul>
The <a href="/node/wikilink">[[wikilink]]</a> is the heart of the Agora. <a href="/node/foo">/node/foo</a> will render every subnode that resolves to wikilink <a href="/node/foo">[[foo]]</a>. For example: <a href="/node/agora">[[Agora]]</a>. The <a href="/node/wikilink">[[wikilink]]</a> is the heart of the Agora. <a href="/node/foo">/node/foo</a> will render every subnode that resolves to wikilink <a href="/node/foo">[[foo]]</a>. For example: <a href="/node/agora">[[Agora]]</a>.
@ -35,4 +37,6 @@ The <a href="/node/wikilink">[[wikilink]]</a> is the heart of the Agora. <a href
<br /><br /> <br /><br />
For more information, please visit the <a href="https://flancia.org/go/agora">Agora repository.</a> If you're interested in knowing what's coming, please refer to <a href="https://anagora.org/node/agora-plan">Agora plan</a>. For more information, please visit the <a href="https://flancia.org/go/agora">Agora repository.</a> If you're interested in knowing what's coming, please refer to <a href="https://anagora.org/node/agora-plan">Agora plan</a>.
</div> </div>
{% include "node_rendered.html" %}
{% endblock %} {% endblock %}

View file

@ -17,6 +17,10 @@ from functools import lru_cache
parser = DateDataParser(languages=['en']) parser = DateDataParser(languages=['en'])
def rank(l, user):
# hack hack
return sorted(l, key=lambda x: x.user)
def canonical_wikilink(wikilink): def canonical_wikilink(wikilink):
if is_journal(wikilink): if is_journal(wikilink):