Add cited-by links
This commit is contained in:
parent
2705764a6a
commit
44bb51f0a1
|
@ -332,10 +332,19 @@ def publish_turn(lexicon, drafts):
|
||||||
with lexicon.ctx.article.edit(filename, create=True) as f:
|
with lexicon.ctx.article.edit(filename, create=True) as f:
|
||||||
f['title'] = title
|
f['title'] = title
|
||||||
f['html'] = html
|
f['html'] = html
|
||||||
|
f['cites'] = citations_by_title[title]
|
||||||
|
f['citedby'] = [
|
||||||
|
citer for citer, citations
|
||||||
|
in citations_by_title.items()
|
||||||
|
if title in citations]
|
||||||
|
|
||||||
for title in phantom_titles:
|
for title in phantom_titles:
|
||||||
html = None
|
|
||||||
filename = filesafe_title(title)
|
filename = filesafe_title(title)
|
||||||
with lexicon.ctx.article.edit(filename, create=True) as f:
|
with lexicon.ctx.article.edit(filename, create=True) as f:
|
||||||
f['title'] = title
|
f['title'] = title
|
||||||
f['html'] = html
|
f['html'] = ""
|
||||||
|
f['cites'] = []
|
||||||
|
f['citedby'] = [
|
||||||
|
citer for citer, citations
|
||||||
|
in citations_by_title.items()
|
||||||
|
if title in citations]
|
||||||
|
|
|
@ -69,11 +69,8 @@ def get_bp():
|
||||||
@player_required_if_not_public
|
@player_required_if_not_public
|
||||||
def article(name, title):
|
def article(name, title):
|
||||||
with g.lexicon.ctx.article.read(title) as a:
|
with g.lexicon.ctx.article.read(title) as a:
|
||||||
article = dict(a)
|
article = { **a, 'html': Markup(a['html']) }
|
||||||
article['html'] = Markup(a['html'] or "")
|
return render_template('lexicon/article.html', article=article)
|
||||||
with g.lexicon.ctx.read('info') as info:
|
|
||||||
cites = info[a.title]['citations']
|
|
||||||
return render_template('lexicon/article.html', article=article, cites=cites)
|
|
||||||
|
|
||||||
@bp.route('/rules/', methods=['GET'])
|
@bp.route('/rules/', methods=['GET'])
|
||||||
@lexicon_param
|
@lexicon_param
|
||||||
|
|
|
@ -13,9 +13,16 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block citations %}
|
{% block citations %}
|
||||||
{% for cite in cites %}
|
<p>
|
||||||
<a href="{{ cite|articlelink }}">{{ cite }}</a> /
|
{% for citation in article.cites %}
|
||||||
|
<a href="{{ citation|articlelink }}">{{ citation }}</a> /
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{% for citation in article.citedby %}
|
||||||
|
<a href="{{ citation|articlelink }}">{{ citation }}</a> /
|
||||||
|
{% endfor %}
|
||||||
|
</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% set template_content_blocks = [self.main(), self.citations()] %}
|
{% set template_content_blocks = [self.main(), self.citations()] %}
|
Loading…
Reference in New Issue