Set up tag links for /papers

This commit is contained in:
str4d
2013-08-12 04:16:15 +00:00
parent 5acba7ea55
commit b77fa1ee5d
3 changed files with 29 additions and 14 deletions

View File

@@ -3,7 +3,7 @@ from flask import render_template
from i2p2www import ANONBIB_CFG, ANONBIB_FILE from i2p2www import ANONBIB_CFG, ANONBIB_FILE
from i2p2www.anonbib import BibTeX, config from i2p2www.anonbib import BibTeX, config
def papers_list(tag=None, choice=None): def papers_list(tag='', choice='date'):
config.load(ANONBIB_CFG) config.load(ANONBIB_CFG)
rbib = BibTeX.parseFile(ANONBIB_FILE) rbib = BibTeX.parseFile(ANONBIB_FILE)
if tag: if tag:
@@ -31,12 +31,12 @@ def papers_list(tag=None, choice=None):
rbib = BibTeX.splitSortedEntriesBy(rbib, 'year') rbib = BibTeX.splitSortedEntriesBy(rbib, 'year')
bib = { bib = {
'title': 'Papers on I2P', 'tags': config.ALL_TAGS,
'short_title': 'I2P Papers', 'tag_titles': config.TAG_TITLES,
'otherbibs': '', 'tag_short_titles': config.TAG_SHORT_TITLES,
'sectiontypes': sectionType, 'tag': tag,
'tag': tag, 'sectiontypes': sectionType,
'field': choice, 'field': choice,
} }
sections = [] sections = []

View File

@@ -145,13 +145,13 @@ OMIT_ENTRIES = ("proceedings", "journal")
ALL_TAGS = ("selected", ) ALL_TAGS = ("selected", )
# Titles of page, by tag. # Titles of page, by tag.
TAG_TITLES = { "": "The Free Haven Anonymity Bibliography", TAG_TITLES = { "": "I2P Bibliography",
"selected": "Free Haven's Selected Papers in Anonymity" "selected": "Selected I2P Papers"
} }
# As TAG_TITLES, but shorter. # As TAG_TITLES, but shorter.
TAG_SHORT_TITLES = { "": "Anonymity Bibliography", TAG_SHORT_TITLES = { "": "I2P Bibliography",
"selected": "Selected Papers in Anonymity", "selected": "Selected I2P Papers",
} }
# Directories where tag pages get generated. # Directories where tag pages get generated.

View File

@@ -1,11 +1,26 @@
{% extends "global/layout.html" %} {% extends "global/layout.html" %}
{% block title %}{{ bib.title }}{% endblock %} {% block title %}{{ bib.tag_titles[bib.tag] }}{% endblock %}
{% block headextra %} {% block headextra %}
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles/pubs.css') }}" /> <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles/pubs.css') }}" />
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h1 align="center">{{ bib.short_title }}</h1> <h1 align="center">{{ bib.tag_short_titles[bib.tag] }}</h1>
<p align="center">{{ bib.otherbibs }}</p>
<p align="center">
{%- if bib.tag|length %}<a href='{% if bib.field != 'date' -%}
{{ get_url('papers_list', choice=bib.field) }}
{%- else %}{{ get_url('papers_list') }}{% endif %}'>
{%- endif %}{{ bib.tag_titles[''] }}
{%- if bib.tag|length %}</a>{% endif %}
{%- for tag in bib.tags %}&nbsp;|&nbsp;
{%- if tag != bib.tag %}<a href='{% if bib.field != 'date' -%}
{{ get_url('papers_list', tag=tag, choice=bib.field) }}
{%- else %}{{ get_url('papers_list', tag=tag) }}{% endif %}'>
{%- endif %}{{ bib.tag_titles[tag] }}
{%- if tag != bib.tag %}</a>{% endif %}
{%- endfor -%}
</p>
<p align="center"> <p align="center">
{%- if bib.field != 'topic' %}{% if bib.tag -%} {%- if bib.field != 'topic' %}{% if bib.tag -%}
<a href='{{ get_url('papers_list', tag=bib.tag, choice='topic') }}'> <a href='{{ get_url('papers_list', tag=bib.tag, choice='topic') }}'>