vene / pelican-bibtex Goto Github PK
View Code? Open in Web Editor NEWpelican-bibtex: Manage your academic publications page with Pelican and BibTeX
License: The Unlicense
pelican-bibtex: Manage your academic publications page with Pelican and BibTeX
License: The Unlicense
A PyPI entry for pelican_bibtex
exists, but no tarball has been uploaded, so
$ pip install pelican_bibtex
Collecting pelican_bibtex
Could not find a version that satisfies the requirement pelican_bibtex (from versions: )
No matching distribution found for pelican_bibtex
It would be a good idea in my opinion to support the url key, for linking for example to an arXiv page.
HTML rendering is pretty bad. Evaluate how much it improves in the dev version of pybtex.
Nice work for this plugin ! I helped me a lot !
I took your plugin for my website, but I wanted to group the publication by types (Journal, Conference, ... and so on). So, I did a very little modification to your plugin to get this feature (sorry for my Python, I do not program often in this language, this code must certainly be improved that's why I didn't do a pull request):
diff --git a/pelican_bibtex.py b/pelican_bibtex.py
index be12dda..42e7f00 100644
--- a/pelican_bibtex.py
+++ b/pelican_bibtex.py
@@ -19,6 +19,28 @@ from pelican import signals
__version__ = '0.2'
+def entrytype(label):
+ entries = {
+ 'book' : (0, 'Book'),
+ 'incollection' : (1, 'Book in a Collection'),
+ 'booklet' : (2, 'Booklet'),
+ 'proceedings' : (3, 'Proceedings'),
+ 'inbook' : (4, 'Chapter in a Book'),
+ 'article' : (5, 'Journal'),
+ 'inproceedings' : (6, 'Conference'),
+ 'phdthesis' : (7, 'PhD Thesis'),
+ 'masterthesis' : (8, 'Master Thesis'),
+ 'techreport' : (9, 'Technical Report'),
+ 'manual' : (10, 'Manual'),
+ 'misc' : (11, 'Miscellaneous'),
+ 'unpublished' : (12, 'Unpublished'),
+ }
+
+ if label in entries:
+ return entries[label]
+ else:
+ return label
+
def add_publications(generator):
"""
Populates context with a list of BibTeX publications.
@@ -69,6 +91,7 @@ def add_publications(generator):
for formatted_entry in formatted_entries:
key = formatted_entry.key
entry = bibdata_all.entries[key]
+ type = entry.type
year = entry.fields.get('year')
pdf = entry.fields.pop('pdf', None)
slides = entry.fields.pop('slides', None)
@@ -80,13 +103,14 @@ def add_publications(generator):
Writer().write_stream(bibdata_this, bib_buf)
text = formatted_entry.text.render(html_backend)
- publications.append((key,
- year,
- text,
- bib_buf.getvalue(),
- pdf,
- slides,
- poster))
+ publications.append({'entry' : entrytype(type),
+ 'key' : key,
+ 'year' : year,
+ 'text' : text,
+ 'bibtex' : bib_buf.getvalue(),
+ 'pdf' : pdf,
+ 'slides' : slides,
+ 'poster' : poster})
generator.context['publications'] = publications
With this version, the HTML template can be as follow:
{% for group in publications|groupby('entry') %}
<h2>{{ group.grouper[1] }}</h2>
<ul>
{% for publication in group.list|sort(attribute='year')|reverse %}
<li id="{{ publication.key }}">{{ publication.text }}
[<a href="javascript:disp('{{ publication.bibtex|replace('\n', '<br>')|escape }}');">Bibtex</a>]
{% for label, target in [('PDF', publication.pdf), ('Slides', publication.slides), ('Poster', publication.poster)] %}
{{ "[<a href=\"publications/%s\">%s</a>]" % (target, label) if target }}
{% endfor %}
</li>
{% endfor %}
</ul>
{% endfor %}
I don't know if you can find something useful in what I did, but if this is the case feel free to use and/or modify my code !
At the moment I don't really know how entries are sorted. It would be nice to have year grouping.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.