pelican-cite2


Namepelican-cite2 JSON
Version 1.1.3 PyPI version JSON
download
home_pageNone
SummaryAllows the use of BibTeX citations within a Pelican site
upload_time2025-08-22 17:33:53
maintainerNone
docs_urlNone
authorJohan Vergeer
requires_python<4.0,>=3.8
licenseAGPL-3.0
keywords pelican plugin
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            pelican-cite
==============

Allows the use of BibTeX citations within a Pelican site. This plugin is based on the
[pelican-bibtex](https://github.com/vene/pelican-bibtex) plugin written by
[Vlad Niculae](https://github.com/vene)
and [pelican-cite](https://github.com/cmacmackin/pelican-cite) written by
[Chris MacMackin](https://github.com/cmacmackin) 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`

```python
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](https://github.com/cmacmackin/pelican-cite) by
[Chris MacMackin](https://github.com/cmacmackin).

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:

```jinja2
{% 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:

```jinja2
{% 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 %}
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pelican-cite2",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "pelican, plugin",
    "author": "Johan Vergeer",
    "author_email": "johanvergeer@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ed/64/34c7dbb3eba31488fc900f7f6b26ebd1865716bae8c1bf9b4052588b1d9f/pelican_cite2-1.1.3.tar.gz",
    "platform": null,
    "description": "pelican-cite\n==============\n\nAllows the use of BibTeX citations within a Pelican site. This plugin is based on the\n[pelican-bibtex](https://github.com/vene/pelican-bibtex) plugin written by\n[Vlad Niculae](https://github.com/vene)\nand [pelican-cite](https://github.com/cmacmackin/pelican-cite) written by\n[Chris MacMackin](https://github.com/cmacmackin) and aims to improve the following points:\n\n- More flexibility using configuration\n    - The user can use any label, soring and naming style\n    - The user can create their own Jinja2 template for bibliography and label (This is still a TODO)\n- Better maintainability\n- Everything is tested with PyTest\n\n\nInstallation\n============\n\nTo install simply run `pip install pelican-cite` and add it to the `PLUGINS` section of `pelicanconf.py`\n\n```python\nPLUGINS = [\n    '...',\n    'pelican_cite'\n    '...',\n]\n```\n\n\n## How to Use\n\nThis plugin reads a user-specified BibTeX file and generates bibliographic\ninformation within your articles and pages.\n\nIf the file is present and readable, then content will be scanned for references\nto citation keys. These take the format `[@Bai2011]`.\nThe format `[@@Bai2011]` is also possible for backwards compatibility with [pelican-cite](https://github.com/cmacmackin/pelican-cite) by\n[Chris MacMackin](https://github.com/cmacmackin).\n\nIf a citation key is used which does not exist within the BibTeX file then\na warning will be displayed.\n\n### Configuration\n\n#### `PUBLICATIONS_SRC`\n\nLocation of the BibTeX file.\n\nThe BibTeX file may, optionally, be appended on a per-article\nbasis by supplying the meta-data `publications_src`.\n\n#### `BIBLIOGRAPHY_NAME_STYLE`\n\nDefines how names will be formatted in the output.\nStyles included in `\"Pybtex\"` are `\"plain\"` and `\"lastfirst\"`. Defaults to `None`.\n\n#### `BIBLIOGRAPHY_LABEL_STYLE`\n\nDefines how the labels will be formatted in the output.\n\nStyles included in `Pybtex` are `\"alpha\"` and `\"number\"`. Defaults to `\"alpha\"`\n\n##### Author_year label style\n\nThere is also a custom style available called `\"author_year_1\"` and `\"author_year_2\"`.\nThe first will show labels like `(Author,year)`, the second will show labels like `Author (year)`\n\nYou can use this by installing it with `pip install pybtex-author-year-label`.\n\n#### `BIBLIOGRAPHY_SORTING_STYLE`\n\nDefines how the bibliography will be sorted.\nStyles included in `Pybtex` are `\"author_year_title\"` and `\"none\"`. Defaults to `\"author_year_title\"`\n\n### Usage in Pelican template\n\n#### Labels\n\nLabels are rendered with the `BIBLIOGRAPHY_LABEL_STYLE` setting, and you cannot set anything\nin the template.\n\n#### Bibliography\n\n##### Use out of the box template\n\nYou can add the bibliography anywhere in your template.\n`pelican_cite` comes with a rendered bibliography out of the box. Simply add the following to your template:\n\n```jinja2\n{% if article.bibliography %}\n    {{ article.bibliography.rendered }}\n{% endif %}\n```\n\nThis will use the template from `pelican_cite/templates/citations.html` to render a bibliography\n\n##### Create your own template\n\nYou can also create your own template. To do this `article.bibliography` has a `cites` attribute.\n\nAttribute | Description\n---|---\n`article.bibliography.cites.cite_key` | The id you used for the citation in your `.bib` file.\n`article.bibliography.cites.ref_id` | The `cite_key`, without spaces.\n`article.bibliography.cites.rendered_entry` | A rendered string containing the citation.\n`article.bibliography.cites.count` | The number of times the entry was cited in the article.\n\nHere is a template to get you started:\n\n```jinja2\n{% if article.bibliography %}\n<div id=\"citations\">\n    <hr>\n    <h3>Citations</h3>\n    <ol class=\"references\">\n        {% for cite in article.bibliography.cites %}\n            <li id=\"{{ cite.ref_id }}\">\n                <span class=\"reference-text\">{{ cite.rendered_entry }}</span>\n                {% for i in range(1, cite.count + 1) %}\n                    <a class=\"cite-backref\" href=\"#ref-{{ cite.ref_id }}-{{ i }}\"\n                       title=\"Jump back to reference {{ i }}\">\n                        <sup>\n                            <i>\n                                <b>\n                                    {{ i }}\n                                </b>\n                            </i>\n                        </sup>\n                    </a>\n                {% endfor %}\n            </li>\n        {% endfor %}\n    </ol>\n</div>\n{% endif %}\n```\n\n",
    "bugtrack_url": null,
    "license": "AGPL-3.0",
    "summary": "Allows the use of BibTeX citations within a Pelican site",
    "version": "1.1.3",
    "project_urls": {
        "Documentation": "https://docs.getpelican.com/",
        "Funding": "https://donate.getpelican.com/",
        "Repository": "https://github.com/efcy/pelican-cite",
        "Source": "https://github.com/johanvergeer/pelican-cite",
        "Tracker": "https://github.com/johanvergeer/pelican-cite/issues"
    },
    "split_keywords": [
        "pelican",
        " plugin"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f1f8b2f28b33416021f0bb6804c928f5a043d70c36e91a93e5689ab15022f864",
                "md5": "764174ccd6e79cd717cff3cad300e7e2",
                "sha256": "191cd0476489dc26b984c5e69886afc034fb8333db30469d20ac19c6b89dabd0"
            },
            "downloads": -1,
            "filename": "pelican_cite2-1.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "764174ccd6e79cd717cff3cad300e7e2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 19146,
            "upload_time": "2025-08-22T17:33:52",
            "upload_time_iso_8601": "2025-08-22T17:33:52.498005Z",
            "url": "https://files.pythonhosted.org/packages/f1/f8/b2f28b33416021f0bb6804c928f5a043d70c36e91a93e5689ab15022f864/pelican_cite2-1.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ed6434c7dbb3eba31488fc900f7f6b26ebd1865716bae8c1bf9b4052588b1d9f",
                "md5": "8ae3e3b2d5e1f0bad66c3e2a05c62586",
                "sha256": "e52b215a630f36dedc4765af35ddb116a1c252f165330c1473c37326b5a158f7"
            },
            "downloads": -1,
            "filename": "pelican_cite2-1.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "8ae3e3b2d5e1f0bad66c3e2a05c62586",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 17911,
            "upload_time": "2025-08-22T17:33:53",
            "upload_time_iso_8601": "2025-08-22T17:33:53.318427Z",
            "url": "https://files.pythonhosted.org/packages/ed/64/34c7dbb3eba31488fc900f7f6b26ebd1865716bae8c1bf9b4052588b1d9f/pelican_cite2-1.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-22 17:33:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "efcy",
    "github_project": "pelican-cite",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "pelican-cite2"
}
        
Elapsed time: 0.84851s