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

View File

@@ -6,7 +6,25 @@
{% block content %}
<h1 align="center">{{ bib.short_title }}</h1>
<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 cellspacing="3" cellpadding="0" border="0" align="center" width="100%%">