Package: pelican-cite
pelican-citeAllows the use of BibTeX citations within a Pelican site. This plugin is based on thepelican-bibtexplugin written byVlad Niculaeandpelican-citewritten byChris MacMackinand aims to improve the following points:More flexibility using configurationThe user can use any label, soring and naming styleThe user can create their own Jinja2 template for bibliography and label (This is still a TODO)Better maintainabilityEverything is tested with PyTestInstallationTo install simply runpip install pelican-citeand add it to thePLUGINSsection ofpelicanconf.pyPLUGINS=['...','pelican_cite''...',]How to UseThis 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 withpelican-citebyChris MacMackin.If a citation key is used which does not exist within the BibTeX file then
a warning will be displayed.ConfigurationPUBLICATIONS_SRCLocation of the BibTeX file.The BibTeX file may, optionally, be appended on a per-article
basis by supplying the meta-datapublications_src.BIBLIOGRAPHY_NAME_STYLEDefines how names will be formatted in the output.
Styles included in"Pybtex"are"plain"and"lastfirst". Defaults toNone.BIBLIOGRAPHY_LABEL_STYLEDefines how the labels will be formatted in the output.Styles included inPybtexare"alpha"and"number". Defaults to"alpha"Author_year label styleThere 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 likeAuthor (year)You can use this by installing it withpip install pybtex-author-year-label.BIBLIOGRAPHY_SORTING_STYLEDefines how the bibliography will be sorted.
Styles included inPybtexare"author_year_title"and"none". Defaults to"author_year_title"Usage in Pelican templateLabelsLabels are rendered with theBIBLIOGRAPHY_LABEL_STYLEsetting, and you cannot set anything
in the template.BibliographyUse out of the box templateYou can add the bibliography anywhere in your template.pelican_citecomes 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 frompelican_cite/templates/citations.htmlto render a bibliographyCreate your own templateYou can also create your own template. To do thisarticle.bibliographyhas acitesattribute.AttributeDescriptionarticle.bibliography.cites.cite_keyThe id you used for the citation in your.bibfile.article.bibliography.cites.ref_idThecite_key, without spaces.article.bibliography.cites.rendered_entryA rendered string containing the citation.article.bibliography.cites.countThe 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 %}