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:
|
||||
f['title'] = title
|
||||
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:
|
||||
html = None
|
||||
filename = filesafe_title(title)
|
||||
with lexicon.ctx.article.edit(filename, create=True) as f:
|
||||
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
|
||||
def article(name, title):
|
||||
with g.lexicon.ctx.article.read(title) as a:
|
||||
article = dict(a)
|
||||
article['html'] = Markup(a['html'] or "")
|
||||
with g.lexicon.ctx.read('info') as info:
|
||||
cites = info[a.title]['citations']
|
||||
return render_template('lexicon/article.html', article=article, cites=cites)
|
||||
article = { **a, 'html': Markup(a['html']) }
|
||||
return render_template('lexicon/article.html', article=article)
|
||||
|
||||
@bp.route('/rules/', methods=['GET'])
|
||||
@lexicon_param
|
||||
|
|
|
@ -13,9 +13,16 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block citations %}
|
||||
{% for cite in cites %}
|
||||
<a href="{{ cite|articlelink }}">{{ cite }}</a> /
|
||||
{% endfor %}
|
||||
<p>
|
||||
{% for citation in article.cites %}
|
||||
<a href="{{ citation|articlelink }}">{{ citation }}</a> /
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
{% for citation in article.citedby %}
|
||||
<a href="{{ citation|articlelink }}">{{ citation }}</a> /
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
{% set template_content_blocks = [self.main(), self.citations()] %}
|
Loading…
Reference in New Issue