Implemented BibTeX viewing

This commit is contained in:
str4d
2013-08-11 14:34:40 +00:00
parent 42f0247388
commit f147bb7978
4 changed files with 37 additions and 29 deletions

View File

@@ -1,28 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<!-- *** I AM MACHINE GENERATED! DO NOT EDIT ME!
*** EDIT THE .bib FILE or _template_.html INSTEAD!
Generated by `%(command_line)s'
(c) Eddie Kohler 1999-2000, Nick Mathewson 2003 -->
<title>%(title)s: BibTeX</title>
<link rel="stylesheet" type="text/css" href="%(root)s/css/main.css" />
<link rel="stylesheet" type="text/css" href="%(root)s/css/pubs.css" />
</head>
<body bgcolor="#ffffff" text="#000000" link="#bb0000" vlink="#990099"
alink="#ff9900" >
<table cellspacing="15" border="0" align="center" width="100%%">
%(entries)s
</table>
</body>
</html>

View File

@@ -44,3 +44,20 @@ def papers_list(tag=None, choice=None):
bib['sections'] = sections
return render_template('papers/list.html', bib=bib)
def papers_bibtex(tag=None):
config.load(ANONBIB_CFG)
rbib = BibTeX.parseFile(ANONBIB_FILE)
if tag:
rbib = [ b for b in rbib.entries if tag in b.get('www_tags', '').split() ]
else:
rbib = rbib.entries
entries = [ (ent.key, ent) for ent in rbib ]
entries.sort()
entries = [ ent[1] for ent in entries ]
bib = {}
bib['title'] = 'Papers on I2P'
bib['entries'] = rbib
return render_template('papers/bibtex.html', bib=bib)

View File

@@ -0,0 +1,17 @@
{% extends "global/layout.html" %}
{% block title %}{{ bib.title }}: BibTeX{% endblock %}
{% block headextra %}
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles/pubs.css') }}" />
{% endblock %}
{% block content %}
<table cellspacing="15" border="0" align="center" width="100%%">
{% for entry in bib.entries %}
<tr><td class='bibtex'>
<a name='{{ entry.key }}'>{{ entry.key }}</a>
<pre class='bibtex'>
{{ entry.format(90,8,1) }}
</pre>
</td></tr>
{% endfor %}
</table>
{% endblock %}

View File

@@ -39,8 +39,10 @@ url('/<lang:lang>/', 'views.site_show', defaults={'page': 'index'})
url('/<lang:lang>/<path:page>', 'views.site_show')
url('/<lang:lang>/papers/', 'anonbib.views.papers_list')
url('/<lang:lang>/papers/bibtex', 'anonbib.views.papers_bibtex')
url('/<lang:lang>/papers/by-<string:choice>', 'anonbib.views.papers_list')
url('/<lang:lang>/papers/tag/<string:tag>', 'anonbib.views.papers_list')
url('/<lang:lang>/papers/tag/<string:tag>/', 'anonbib.views.papers_list')
url('/<lang:lang>/papers/tag/<string:tag>/bibtex', 'anonbib.views.papers_bibtex')
url('/<lang:lang>/papers/tag/<string:tag>/by-<string:choice>', 'anonbib.views.papers_list')
url('/<lang:lang>/blog/', 'blog.views.blog_index', defaults={'page': 1})