Set up choices links for /papers

This commit is contained in:
str4d
2013-08-12 03:52:21 +00:00
parent 787a3855f1
commit 5acba7ea55
2 changed files with 40 additions and 15 deletions

View File

@@ -12,6 +12,7 @@ def papers_list(tag=None, choice=None):
rbib = rbib.entries rbib = rbib.entries
if choice == 'topic': if choice == 'topic':
sectionType = 'Topics'
rbib = BibTeX.sortEntriesBy(rbib, 'www_section', 'ZZZZZZZZZZZZZZ') rbib = BibTeX.sortEntriesBy(rbib, 'www_section', 'ZZZZZZZZZZZZZZ')
rbib = BibTeX.splitSortedEntriesBy(rbib, 'www_section') rbib = BibTeX.splitSortedEntriesBy(rbib, 'www_section')
if rbib[-1][0].startswith("<span class='bad'>"): if rbib[-1][0].startswith("<span class='bad'>"):
@@ -21,25 +22,30 @@ def papers_list(tag=None, choice=None):
for s, ents in rbib for s, ents in rbib
] ]
elif choice == 'author': elif choice == 'author':
sectionType = 'Authors'
rbib, url_map = BibTeX.splitEntriesByAuthor(rbib) rbib, url_map = BibTeX.splitEntriesByAuthor(rbib)
else: else:
sectionType = 'Years'
choice = 'date'
rbib = BibTeX.sortEntriesByDate(rbib) rbib = BibTeX.sortEntriesByDate(rbib)
rbib = BibTeX.splitSortedEntriesBy(rbib, 'year') rbib = BibTeX.splitSortedEntriesBy(rbib, 'year')
bib = {} bib = {
bib['title'] = 'Papers on I2P' 'title': 'Papers on I2P',
bib['short_title'] = 'I2P Papers' 'short_title': 'I2P Papers',
bib['otherbibs'] = '' 'otherbibs': '',
bib['choices'] = '' 'sectiontypes': sectionType,
bib['sectiontypes'] = 'Dates' 'tag': tag,
bib['field'] = 'date' 'field': choice,
}
sections = [] sections = []
for section, entries in rbib: for section, entries in rbib:
s = {} s = {
s['name'] = section 'name': section,
s['slug'] = section 'slug': section,
s['entries'] = entries 'entries': entries,
}
sections.append(s) sections.append(s)
bib['sections'] = sections bib['sections'] = sections
@@ -56,8 +62,9 @@ def papers_bibtex(tag=None):
entries.sort() entries.sort()
entries = [ ent[1] for ent in entries ] entries = [ ent[1] for ent in entries ]
bib = {} bib = {
bib['title'] = 'Papers on I2P' 'title': 'Papers on I2P',
bib['entries'] = rbib 'entries': rbib,
}
return render_template('papers/bibtex.html', bib=bib) return render_template('papers/bibtex.html', bib=bib)

View File

@@ -6,7 +6,25 @@
{% block content %} {% block content %}
<h1 align="center">{{ bib.short_title }}</h1> <h1 align="center">{{ bib.short_title }}</h1>
<p align="center">{{ bib.otherbibs }}</p> <p align="center">{{ bib.otherbibs }}</p>
<p align="center">{{ bib.choices }}</p> <p align="center">
{%- if bib.field != 'topic' %}{% if bib.tag -%}
<a href='{{ get_url('papers_list', tag=bib.tag, choice='topic') }}'>
{%- else -%}
<a href='{{ get_url('papers_list', choice='topic') }}'>{% endif %}
{%- endif %}By topic{%- if bib.field != 'topic' -%}</a>{% endif -%}
&nbsp;|&nbsp;
{%- if bib.field != 'date' -%}{% if bib.tag -%}
<a href='{{ get_url('papers_list', tag=bib.tag) }}'>
{%- else -%}
<a href='{{ get_url('papers_list') }}'>{% endif %}
{%- endif %}By date{%- if bib.field != 'date' -%}</a>{% endif -%}
&nbsp;|&nbsp;
{%- if bib.field != 'author' -%}{% if bib.tag -%}
<a href='{{ get_url('papers_list', tag=bib.tag, choice='author') }}'>
{%- else -%}
<a href='{{ get_url('papers_list', choice='author') }}'>{% endif %}
{%- endif %}By author{%- if bib.field != 'author' -%}</a>{% endif -%}
</p>
<!-- Table 1: contains the sidebar and the body. --> <!-- Table 1: contains the sidebar and the body. -->
<table cellspacing="3" cellpadding="0" border="0" align="center" width="100%%"> <table cellspacing="3" cellpadding="0" border="0" align="center" width="100%%">