pelican-cite
Allows the use of BibTeX citations within a Pelican site. This plugin is based on the pelican-bibtex plugin written by Vlad Niculae and pelican-cite written by Chris MacMackin and aims to improve the following points:
- More flexibility using configuration
- The user can use any label, soring and naming style
- The user can create their own Jinja2 template for bibliography and label (This is still a TODO)
- Better maintainability
- Everything is tested with PyTest
Installation
To install simply run pip install pelican-cite and add it to the PLUGINS section of pelicanconf.py
PLUGINS = [
'...',
'pelican_cite'
'...',
]
How to Use
This plugin reads a user-specified BibTeX file and generates bibliographic information within your articles and pages.
If the file is present and readable, then content will be scanned for references
to citation keys. These take the format [@Bai2011].
The format [@@Bai2011] is also possible for backwards compatibility with pelican-cite by
Chris MacMackin.
If a citation key is used which does not exist within the BibTeX file then a warning will be displayed.
Configuration
PUBLICATIONS_SRC
Location of the BibTeX file.
The BibTeX file may, optionally, be appended on a per-article
basis by supplying the meta-data publications_src.
BIBLIOGRAPHY_NAME_STYLE
Defines how names will be formatted in the output.
Styles included in "Pybtex" are "plain" and "lastfirst". Defaults to None.
BIBLIOGRAPHY_LABEL_STYLE
Defines how the labels will be formatted in the output.
Styles included in Pybtex are "alpha" and "number". Defaults to "alpha"
Author_year label style
There is also a custom style available called "author_year_1" and "author_year_2".
The first will show labels like (Author,year), the second will show labels like Author (year)
You can use this by installing it with pip install pybtex-author-year-label.
BIBLIOGRAPHY_SORTING_STYLE
Defines how the bibliography will be sorted.
Styles included in Pybtex are "author_year_title" and "none". Defaults to "author_year_title"
Usage in Pelican template
Labels
Labels are rendered with the BIBLIOGRAPHY_LABEL_STYLE setting, and you cannot set anything
in the template.
Bibliography
Use out of the box template
You can add the bibliography anywhere in your template.
pelican_cite comes with a rendered bibliography out of the box. Simply add the following to your template:
{% if article.bibliography %}
{{ article.bibliography.rendered }}
{% endif %}
This will use the template from pelican_cite/templates/citations.html to render a bibliography
Create your own template
You can also create your own template. To do this article.bibliography has a cites attribute.
| Attribute | Description |
|---|---|
article.bibliography.cites.cite_key |
The id you used for the citation in your .bib file. |
article.bibliography.cites.ref_id |
The cite_key, without spaces. |
article.bibliography.cites.rendered_entry |
A rendered string containing the citation. |
article.bibliography.cites.count |
The number of times the entry was cited in the article. |
Here is a template to get you started:
{% if article.bibliography %}
<div id="citations">
<hr>
<h3>Citations</h3>
<ol class="references">
{% for cite in article.bibliography.cites %}
<li id="{{ cite.ref_id }}">
<span class="reference-text">{{ cite.rendered_entry }}</span>
{% for i in range(1, cite.count + 1) %}
<a class="cite-backref" href="#ref-{{ cite.ref_id }}-{{ i }}"
title="Jump back to reference {{ i }}">
<sup>
<i>
<b>
{{ i }}
</b>
</i>
</sup>
</a>
{% endfor %}
</li>
{% endfor %}
</ol>
</div>
{% endif %}
Metadata
Release files for pelican-cite 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pelican-cite-1.1.1.tar.gz | 19.2 kB | Without provenance | Details for pelican-cite-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pelican_cite-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for pelican_cite-1.1.1-py3-none-any.whl |
Total release size: 38.1 kB
Release files / pelican-cite-1.1.1.tar.gz
| Download URL | pelican-cite-1.1.1.tar.gz |
|---|---|
| Size | 19.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6bcc6754827c4be7fce4ffc8162a451506faef20f4a2164aa90b8b34afeff312
|
|
BLAKE2b-256 checksum How to use checksums |
b50aff5190494ccf90775354ef000f1edb32aab8da787148dfbc291c6dcbe285
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.0 CPython/3.7.5 Darwin/19.2.0
|
Release files / pelican_cite-1.1.1-py3-none-any.whl
| Download URL | pelican_cite-1.1.1-py3-none-any.whl |
|---|---|
| Size | 18.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cbca133856650e49b59cef39f1fa4dd8bf2decbd4735252e036f4581b326d157
|
|
BLAKE2b-256 checksum How to use checksums |
c8f8ffa9661f8b38402c8ca060bad03b77b6b813f4051a8d9b27579ddc241786
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.0 CPython/3.7.5 Darwin/19.2.0
|
Security for pelican-cite 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.